pyrepl-web 0.1.3 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/pyrepl.js +56 -37
- package/package.json +2 -2
package/dist/pyrepl.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
var lK=Object.create;var{getPrototypeOf:oK,defineProperty:kZ,getOwnPropertyNames:CQ,getOwnPropertyDescriptor:nK}=Object,AQ=Object.prototype.hasOwnProperty;var jZ=(U,Z,X)=>{X=U!=null?lK(oK(U)):{};let Q=Z||!U||!U.__esModule?kZ(X,"default",{value:U,enumerable:!0}):X;for(let K of CQ(U))if(!AQ.call(Q,K))kZ(Q,K,{get:()=>U[K],enumerable:!0});return Q},OQ=new WeakMap,m0=(U)=>{var Z=OQ.get(U),X;if(Z)return Z;if(Z=kZ({},"__esModule",{value:!0}),U&&typeof U==="object"||typeof U==="function")CQ(U).map((Q)=>!AQ.call(Z,Q)&&kZ(Z,Q,{get:()=>U[Q],enumerable:!(X=nK(U,Q))||X.enumerable}));return OQ.set(U,Z),Z},mK=(U,Z)=>()=>(Z||U((Z={exports:{}}).exports,Z),Z.exports);var WZ=(U,Z)=>{for(var X in Z)kZ(U,X,{get:Z[X],enumerable:!0,configurable:!0,set:(Q)=>Z[X]=()=>Q})};var IZ=(U,Z)=>()=>(U&&(Z=U(U=0)),Z);var EU=((U)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(U,{get:(Z,X)=>(typeof require<"u"?require:Z)[X]}):U)(function(U){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+U+'" is not supported')});var DY={};WZ(DY,{resolveObject:()=>SQ,resolve:()=>EQ,parse:()=>
|
|
2
|
-
`,"\t"],eK=["{","}","|","\\","^","`"].concat(iK),FY=["'"].concat(eK),DQ=["%","/","?",";","#"].concat(FY),MQ=["/","?","#"],qQ=/^[+a-z0-9A-Z_-]{0,63}$/,ZW=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,XW={javascript:!0,"javascript:":!0},OY={javascript:!0,"javascript:":!0},HZ={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},CY={parse(U){var Z=decodeURIComponent;return(U+"").replace(/\+/g," ").split("&").filter(Boolean).reduce(function(X,Q,K){var H=Q.split("="),$=Z(H[0]||""),M=Z(H[1]||""),q=X[$];return X[$]=q===void 0?M:[].concat(q,M),X},{})},stringify(U){var Z=encodeURIComponent;return Object.keys(U||{}).reduce(function(X,Q){return[].concat(U[Q]).forEach(function(K){X.push(Z(Q)+"="+Z(K))}),X},[]).join("&").replace(/\s/g,"+")}};XU.prototype.parse=function(U,Z,X){if(!zY(U))throw TypeError("Parameter 'url' must be a string, not "+typeof U);var Q=U.indexOf("?"),K=Q!==-1&&Q<U.indexOf("#")?"?":"#",H=U.split(K),$=/\\/g;H[0]=H[0].replace($,"/"),U=H.join(K);var M=U;if(M=M.trim(),!X&&U.split("#").length===1){var q=tK.exec(M);if(q){if(this.path=M,this.href=M,this.pathname=q[1],q[2])if(this.search=q[2],Z)this.query=CY.parse(this.search.substr(1));else this.query=this.search.substr(1);else if(Z)this.search="",this.query={};return this}}var z=rK.exec(M);if(z){z=z[0];var T=z.toLowerCase();this.protocol=T,M=M.substr(z.length)}if(X||z||M.match(/^\/\/[^@\/]+@[^@\/]+/)){var A=M.substr(0,2)==="//";if(A&&!(z&&OY[z]))M=M.substr(2),this.slashes=!0}if(!OY[z]&&(A||z&&!HZ[z])){var L=-1;for(var E=0;E<MQ.length;E++){var S=M.indexOf(MQ[E]);if(S!==-1&&(L===-1||S<L))L=S}var j,k;if(L===-1)k=M.lastIndexOf("@");else k=M.lastIndexOf("@",L);if(k!==-1)j=M.slice(0,k),M=M.slice(k+1),this.auth=decodeURIComponent(j);L=-1;for(var E=0;E<DQ.length;E++){var S=M.indexOf(DQ[E]);if(S!==-1&&(L===-1||S<L))L=S}if(L===-1)L=M.length;this.host=M.slice(0,L),M=M.slice(L),this.parseHost(),this.hostname=this.hostname||"";var B=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!B){var v=this.hostname.split(/\./);for(var E=0,x=v.length;E<x;E++){var N=v[E];if(!N)continue;if(!N.match(qQ)){var w="";for(var u=0,Z0=N.length;u<Z0;u++)if(N.charCodeAt(u)>127)w+="x";else w+=N[u];if(!w.match(qQ)){var V0=v.slice(0,E),Y0=v.slice(E+1),b=N.match(ZW);if(b)V0.push(b[1]),Y0.unshift(b[2]);if(Y0.length)M="/"+Y0.join(".")+M;this.hostname=V0.join(".");break}}}}if(this.hostname.length>UW)this.hostname="";else this.hostname=this.hostname.toLowerCase();if(!B)this.hostname=new AY(`https://${this.hostname}`).hostname;var i=this.port?":"+this.port:"",Y=this.hostname||"";if(this.host=Y+i,this.href+=this.host,B){if(this.hostname=this.hostname.substr(1,this.hostname.length-2),M[0]!=="/")M="/"+M}}if(!XW[T])for(var E=0,x=FY.length;E<x;E++){var V=FY[E];if(M.indexOf(V)===-1)continue;var I=encodeURIComponent(V);if(I===V)I=escape(V);M=M.split(V).join(I)}var G=M.indexOf("#");if(G!==-1)this.hash=M.substr(G),M=M.slice(0,G);var W=M.indexOf("?");if(W!==-1){if(this.search=M.substr(W),this.query=M.substr(W+1),Z)this.query=CY.parse(this.query);M=M.slice(0,W)}else if(Z)this.search="",this.query={};if(M)this.pathname=M;if(HZ[T]&&this.hostname&&!this.pathname)this.pathname="/";if(this.pathname||this.search){var i=this.pathname||"",C=this.search||"";this.path=i+C}return this.href=this.format(),this};XU.prototype.format=function(){var U=this.auth||"";if(U)U=encodeURIComponent(U),U=U.replace(/%3A/i,":"),U+="@";var Z=this.protocol||"",X=this.pathname||"",Q=this.hash||"",K=!1,H="";if(this.host)K=U+this.host;else if(this.hostname){if(K=U+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port)K+=":"+this.port}if(this.query&&TQ(this.query)&&Object.keys(this.query).length)H=CY.stringify(this.query);var $=this.search||H&&"?"+H||"";if(Z&&Z.substr(-1)!==":")Z+=":";if(this.slashes||(!Z||HZ[Z])&&K!==!1){if(K="//"+(K||""),X&&X.charAt(0)!=="/")X="/"+X}else if(!K)K="";if(Q&&Q.charAt(0)!=="#")Q="#"+Q;if($&&$.charAt(0)!=="?")$="?"+$;return X=X.replace(/[?#]/g,function(M){return encodeURIComponent(M)}),$=$.replace("#","%23"),Z+K+X+$+Q};XU.prototype.resolve=function(U){return this.resolveObject(FZ(U,!1,!0)).format()};XU.prototype.resolveObject=function(U){if(zY(U)){var Z=new XU;Z.parse(U,!1,!0),U=Z}var X=new XU,Q=Object.keys(this);for(var K=0;K<Q.length;K++){var H=Q[K];X[H]=this[H]}if(X.hash=U.hash,U.href==="")return X.href=X.format(),X;if(U.slashes&&!U.protocol){var $=Object.keys(U);for(var M=0;M<$.length;M++){var q=$[M];if(q!=="protocol")X[q]=U[q]}if(HZ[X.protocol]&&X.hostname&&!X.pathname)X.path=X.pathname="/";return X.href=X.format(),X}if(U.protocol&&U.protocol!==X.protocol){if(!HZ[U.protocol]){var z=Object.keys(U);for(var T=0;T<z.length;T++){var A=z[T];X[A]=U[A]}return X.href=X.format(),X}if(X.protocol=U.protocol,!U.host&&!OY[U.protocol]){var x=(U.pathname||"").split("/");while(x.length&&!(U.host=x.shift()));if(!U.host)U.host="";if(!U.hostname)U.hostname="";if(x[0]!=="")x.unshift("");if(x.length<2)x.unshift("");X.pathname=x.join("/")}else X.pathname=U.pathname;if(X.search=U.search,X.query=U.query,X.host=U.host||"",X.auth=U.auth,X.hostname=U.hostname||U.host,X.port=U.port,X.pathname||X.search){var L=X.pathname||"",E=X.search||"";X.path=L+E}return X.slashes=X.slashes||U.slashes,X.href=X.format(),X}var S=X.pathname&&X.pathname.charAt(0)==="/",j=U.host||U.pathname&&U.pathname.charAt(0)==="/",k=j||S||X.host&&U.pathname,B=k,v=X.pathname&&X.pathname.split("/")||[],x=U.pathname&&U.pathname.split("/")||[],N=X.protocol&&!HZ[X.protocol];if(N){if(X.hostname="",X.port=null,X.host)if(v[0]==="")v[0]=X.host;else v.unshift(X.host);if(X.host="",U.protocol){if(U.hostname=null,U.port=null,U.host)if(x[0]==="")x[0]=U.host;else x.unshift(U.host);U.host=null}k=k&&(x[0]===""||v[0]==="")}if(j)X.host=U.host||U.host===""?U.host:X.host,X.hostname=U.hostname||U.hostname===""?U.hostname:X.hostname,X.search=U.search,X.query=U.query,v=x;else if(x.length){if(!v)v=[];v.pop(),v=v.concat(x),X.search=U.search,X.query=U.query}else if(!sK(U.search)){if(N){X.hostname=X.host=v.shift();var w=X.host&&X.host.indexOf("@")>0?X.host.split("@"):!1;if(w)X.auth=w.shift(),X.host=X.hostname=w.shift()}if(X.search=U.search,X.query=U.query,!CX(X.pathname)||!CX(X.search))X.path=(X.pathname?X.pathname:"")+(X.search?X.search:"");return X.href=X.format(),X}if(!v.length){if(X.pathname=null,X.search)X.path="/"+X.search;else X.path=null;return X.href=X.format(),X}var u=v.slice(-1)[0],Z0=(X.host||U.host||v.length>1)&&(u==="."||u==="..")||u==="",V0=0;for(var Y0=v.length;Y0>=0;Y0--)if(u=v[Y0],u===".")v.splice(Y0,1);else if(u==="..")v.splice(Y0,1),V0++;else if(V0)v.splice(Y0,1),V0--;if(!k&&!B)for(;V0--;V0)v.unshift("..");if(k&&v[0]!==""&&(!v[0]||v[0].charAt(0)!=="/"))v.unshift("");if(Z0&&v.join("/").substr(-1)!=="/")v.push("");var b=v[0]===""||v[0]&&v[0].charAt(0)==="/";if(N){X.hostname=X.host=b?"":v.length?v.shift():"";var w=X.host&&X.host.indexOf("@")>0?X.host.split("@"):!1;if(w)X.auth=w.shift(),X.host=X.hostname=w.shift()}if(k=k||X.host&&v.length,k&&!b)v.unshift("");if(!v.length)X.pathname=null,X.path=null;else X.pathname=v.join("/");if(!CX(X.pathname)||!CX(X.search))X.path=(X.pathname?X.pathname:"")+(X.search?X.search:"");return X.auth=U.auth||X.auth,X.slashes=X.slashes||U.slashes,X.href=X.format(),X};XU.prototype.parseHost=function(){var U=this.host,Z=aK.exec(U);if(Z){if(Z=Z[0],Z!==":")this.port=Z.substr(1);U=U.substr(0,U.length-Z.length)}if(U)this.hostname=U};YW={parse:FZ,resolve:EQ,resolveObject:SQ,format:RQ,Url:XU,URL:AY,URLSearchParams:LQ}});var LY={};WZ(LY,{sep:()=>wQ,resolve:()=>AX,relative:()=>vQ,posix:()=>cQ,parse:()=>fQ,normalize:()=>qY,join:()=>jQ,isAbsolute:()=>kQ,format:()=>gQ,extname:()=>NQ,dirname:()=>BQ,delimiter:()=>yQ,default:()=>QW,basename:()=>xQ,_makeLong:()=>_Q});function CU(U){if(typeof U!=="string")throw TypeError("Path must be a string. Received "+JSON.stringify(U))}function PQ(U,Z){var X="",Q=0,K=-1,H=0,$;for(var M=0;M<=U.length;++M){if(M<U.length)$=U.charCodeAt(M);else if($===47)break;else $=47;if($===47){if(K===M-1||H===1);else if(K!==M-1&&H===2){if(X.length<2||Q!==2||X.charCodeAt(X.length-1)!==46||X.charCodeAt(X.length-2)!==46){if(X.length>2){var q=X.lastIndexOf("/");if(q!==X.length-1){if(q===-1)X="",Q=0;else X=X.slice(0,q),Q=X.length-1-X.lastIndexOf("/");K=M,H=0;continue}}else if(X.length===2||X.length===1){X="",Q=0,K=M,H=0;continue}}if(Z){if(X.length>0)X+="/..";else X="..";Q=2}}else{if(X.length>0)X+="/"+U.slice(K+1,M);else X=U.slice(K+1,M);Q=M-K-1}K=M,H=0}else if($===46&&H!==-1)++H;else H=-1}return X}function JW(U,Z){var X=Z.dir||Z.root,Q=Z.base||(Z.name||"")+(Z.ext||"");if(!X)return Q;if(X===Z.root)return X+Q;return X+U+Q}function AX(){var U="",Z=!1,X;for(var Q=arguments.length-1;Q>=-1&&!Z;Q--){var K;if(Q>=0)K=arguments[Q];else{if(X===void 0)X=process.cwd();K=X}if(CU(K),K.length===0)continue;U=K+"/"+U,Z=K.charCodeAt(0)===47}if(U=PQ(U,!Z),Z)if(U.length>0)return"/"+U;else return"/";else if(U.length>0)return U;else return"."}function qY(U){if(CU(U),U.length===0)return".";var Z=U.charCodeAt(0)===47,X=U.charCodeAt(U.length-1)===47;if(U=PQ(U,!Z),U.length===0&&!Z)U=".";if(U.length>0&&X)U+="/";if(Z)return"/"+U;return U}function kQ(U){return CU(U),U.length>0&&U.charCodeAt(0)===47}function jQ(){if(arguments.length===0)return".";var U;for(var Z=0;Z<arguments.length;++Z){var X=arguments[Z];if(CU(X),X.length>0)if(U===void 0)U=X;else U+="/"+X}if(U===void 0)return".";return qY(U)}function vQ(U,Z){if(CU(U),CU(Z),U===Z)return"";if(U=AX(U),Z=AX(Z),U===Z)return"";var X=1;for(;X<U.length;++X)if(U.charCodeAt(X)!==47)break;var Q=U.length,K=Q-X,H=1;for(;H<Z.length;++H)if(Z.charCodeAt(H)!==47)break;var $=Z.length,M=$-H,q=K<M?K:M,z=-1,T=0;for(;T<=q;++T){if(T===q){if(M>q){if(Z.charCodeAt(H+T)===47)return Z.slice(H+T+1);else if(T===0)return Z.slice(H+T)}else if(K>q){if(U.charCodeAt(X+T)===47)z=T;else if(T===0)z=0}break}var A=U.charCodeAt(X+T),L=Z.charCodeAt(H+T);if(A!==L)break;else if(A===47)z=T}var E="";for(T=X+z+1;T<=Q;++T)if(T===Q||U.charCodeAt(T)===47)if(E.length===0)E+="..";else E+="/..";if(E.length>0)return E+Z.slice(H+z);else{if(H+=z,Z.charCodeAt(H)===47)++H;return Z.slice(H)}}function _Q(U){return U}function BQ(U){if(CU(U),U.length===0)return".";var Z=U.charCodeAt(0),X=Z===47,Q=-1,K=!0;for(var H=U.length-1;H>=1;--H)if(Z=U.charCodeAt(H),Z===47){if(!K){Q=H;break}}else K=!1;if(Q===-1)return X?"/":".";if(X&&Q===1)return"//";return U.slice(0,Q)}function xQ(U,Z){if(Z!==void 0&&typeof Z!=="string")throw TypeError('"ext" argument must be a string');CU(U);var X=0,Q=-1,K=!0,H;if(Z!==void 0&&Z.length>0&&Z.length<=U.length){if(Z.length===U.length&&Z===U)return"";var $=Z.length-1,M=-1;for(H=U.length-1;H>=0;--H){var q=U.charCodeAt(H);if(q===47){if(!K){X=H+1;break}}else{if(M===-1)K=!1,M=H+1;if($>=0)if(q===Z.charCodeAt($)){if(--$===-1)Q=H}else $=-1,Q=M}}if(X===Q)Q=M;else if(Q===-1)Q=U.length;return U.slice(X,Q)}else{for(H=U.length-1;H>=0;--H)if(U.charCodeAt(H)===47){if(!K){X=H+1;break}}else if(Q===-1)K=!1,Q=H+1;if(Q===-1)return"";return U.slice(X,Q)}}function NQ(U){CU(U);var Z=-1,X=0,Q=-1,K=!0,H=0;for(var $=U.length-1;$>=0;--$){var M=U.charCodeAt($);if(M===47){if(!K){X=$+1;break}continue}if(Q===-1)K=!1,Q=$+1;if(M===46){if(Z===-1)Z=$;else if(H!==1)H=1}else if(Z!==-1)H=-1}if(Z===-1||Q===-1||H===0||H===1&&Z===Q-1&&Z===X+1)return"";return U.slice(Z,Q)}function gQ(U){if(U===null||typeof U!=="object")throw TypeError('The "pathObject" argument must be of type Object. Received type '+typeof U);return JW("/",U)}function fQ(U){CU(U);var Z={root:"",dir:"",base:"",ext:"",name:""};if(U.length===0)return Z;var X=U.charCodeAt(0),Q=X===47,K;if(Q)Z.root="/",K=1;else K=0;var H=-1,$=0,M=-1,q=!0,z=U.length-1,T=0;for(;z>=K;--z){if(X=U.charCodeAt(z),X===47){if(!q){$=z+1;break}continue}if(M===-1)q=!1,M=z+1;if(X===46){if(H===-1)H=z;else if(T!==1)T=1}else if(H!==-1)T=-1}if(H===-1||M===-1||T===0||T===1&&H===M-1&&H===$+1){if(M!==-1)if($===0&&Q)Z.base=Z.name=U.slice(1,M);else Z.base=Z.name=U.slice($,M)}else{if($===0&&Q)Z.name=U.slice(1,H),Z.base=U.slice(1,M);else Z.name=U.slice($,H),Z.base=U.slice($,M);Z.ext=U.slice(H,M)}if($>0)Z.dir=U.slice(0,$-1);else if(Q)Z.dir="/";return Z}var wQ="/",yQ=":",cQ,QW;var TY=IZ(()=>{cQ=((U)=>(U.posix=U,U))({resolve:AX,normalize:qY,isAbsolute:kQ,join:jQ,relative:vQ,_makeLong:_Q,dirname:BQ,basename:xQ,extname:NQ,format:gQ,parse:fQ,sep:wQ,delimiter:yQ,win32:null,posix:null}),QW=cQ});var N1={};WZ(N1,{transcode:()=>lW,resolveObjectURL:()=>uW,kStringMaxLength:()=>mQ,kMaxLength:()=>vZ,isUtf8:()=>bW,isAscii:()=>dW,default:()=>oW,constants:()=>CW,btoa:()=>IW,atob:()=>HW,INSPECT_MAX_BYTES:()=>nQ,File:()=>FW,Buffer:()=>W0,Blob:()=>OW});function GW(U){var Z=U.length;if(Z%4>0)throw Error("Invalid string. Length must be a multiple of 4");var X=U.indexOf("=");if(X===-1)X=Z;var Q=X===Z?0:4-X%4;return[X,Q]}function VW(U,Z){return(U+Z)*3/4-Z}function $W(U){var Z,X=GW(U),Q=X[0],K=X[1],H=new Uint8Array(VW(Q,K)),$=0,M=K>0?Q-4:Q,q;for(q=0;q<M;q+=4)Z=KU[U.charCodeAt(q)]<<18|KU[U.charCodeAt(q+1)]<<12|KU[U.charCodeAt(q+2)]<<6|KU[U.charCodeAt(q+3)],H[$++]=Z>>16&255,H[$++]=Z>>8&255,H[$++]=Z&255;if(K===2)Z=KU[U.charCodeAt(q)]<<2|KU[U.charCodeAt(q+1)]>>4,H[$++]=Z&255;if(K===1)Z=KU[U.charCodeAt(q)]<<10|KU[U.charCodeAt(q+1)]<<4|KU[U.charCodeAt(q+2)]>>2,H[$++]=Z>>8&255,H[$++]=Z&255;return H}function KW(U){return AU[U>>18&63]+AU[U>>12&63]+AU[U>>6&63]+AU[U&63]}function WW(U,Z,X){var Q,K=[];for(var H=Z;H<X;H+=3)Q=(U[H]<<16&16711680)+(U[H+1]<<8&65280)+(U[H+2]&255),K.push(KW(Q));return K.join("")}function hQ(U){var Z,X=U.length,Q=X%3,K=[],H=16383;for(var $=0,M=X-Q;$<M;$+=H)K.push(WW(U,$,$+H>M?M:$+H));if(Q===1)Z=U[X-1],K.push(AU[Z>>2]+AU[Z<<4&63]+"==");else if(Q===2)Z=(U[X-2]<<8)+U[X-1],K.push(AU[Z>>10]+AU[Z>>4&63]+AU[Z<<2&63]+"=");return K.join("")}function zX(U,Z,X,Q,K){var H,$,M=K*8-Q-1,q=(1<<M)-1,z=q>>1,T=-7,A=X?K-1:0,L=X?-1:1,E=U[Z+A];A+=L,H=E&(1<<-T)-1,E>>=-T,T+=M;for(;T>0;H=H*256+U[Z+A],A+=L,T-=8);$=H&(1<<-T)-1,H>>=-T,T+=Q;for(;T>0;$=$*256+U[Z+A],A+=L,T-=8);if(H===0)H=1-z;else if(H===q)return $?NaN:(E?-1:1)*(1/0);else $=$+Math.pow(2,Q),H=H-z;return(E?-1:1)*$*Math.pow(2,H-Q)}function oQ(U,Z,X,Q,K,H){var $,M,q,z=H*8-K-1,T=(1<<z)-1,A=T>>1,L=K===23?Math.pow(2,-24)-Math.pow(2,-77):0,E=Q?0:H-1,S=Q?1:-1,j=Z<0||Z===0&&1/Z<0?1:0;if(Z=Math.abs(Z),isNaN(Z)||Z===1/0)M=isNaN(Z)?1:0,$=T;else{if($=Math.floor(Math.log(Z)/Math.LN2),Z*(q=Math.pow(2,-$))<1)$--,q*=2;if($+A>=1)Z+=L/q;else Z+=L*Math.pow(2,1-A);if(Z*q>=2)$++,q/=2;if($+A>=T)M=0,$=T;else if($+A>=1)M=(Z*q-1)*Math.pow(2,K),$=$+A;else M=Z*Math.pow(2,A-1)*Math.pow(2,K),$=0}for(;K>=8;U[X+E]=M&255,E+=S,M/=256,K-=8);$=$<<K|M,z+=K;for(;z>0;U[X+E]=$&255,E+=S,$/=256,z-=8);U[X+E-S]|=j*128}function SU(U){if(U>vZ)throw RangeError('The value "'+U+'" is invalid for option "size"');let Z=new Uint8Array(U);return Object.setPrototypeOf(Z,W0.prototype),Z}function jY(U,Z,X){return class extends X{constructor(){super();Object.defineProperty(this,"message",{value:Z.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${U}]`,this.stack,delete this.name}get code(){return U}set code(Q){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:Q,writable:!0})}toString(){return`${this.name} [${U}]: ${this.message}`}}}function W0(U,Z,X){if(typeof U==="number"){if(typeof Z==="string")throw TypeError('The "string" argument must be of type string. Received type number');return vY(U)}return sQ(U,Z,X)}function sQ(U,Z,X){if(typeof U==="string")return MW(U,Z);if(ArrayBuffer.isView(U))return qW(U);if(U==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof U);if(zU(U,ArrayBuffer)||U&&zU(U.buffer,ArrayBuffer))return PY(U,Z,X);if(typeof SharedArrayBuffer<"u"&&(zU(U,SharedArrayBuffer)||U&&zU(U.buffer,SharedArrayBuffer)))return PY(U,Z,X);if(typeof U==="number")throw TypeError('The "value" argument must not be of type number. Received type number');let Q=U.valueOf&&U.valueOf();if(Q!=null&&Q!==U)return W0.from(Q,Z,X);let K=LW(U);if(K)return K;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof U[Symbol.toPrimitive]==="function")return W0.from(U[Symbol.toPrimitive]("string"),Z,X);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof U)}function rQ(U){if(typeof U!=="number")throw TypeError('"size" argument must be of type number');else if(U<0)throw RangeError('The value "'+U+'" is invalid for option "size"')}function DW(U,Z,X){if(rQ(U),U<=0)return SU(U);if(Z!==void 0)return typeof X==="string"?SU(U).fill(Z,X):SU(U).fill(Z);return SU(U)}function vY(U){return rQ(U),SU(U<0?0:_Y(U)|0)}function MW(U,Z){if(typeof Z!=="string"||Z==="")Z="utf8";if(!W0.isEncoding(Z))throw TypeError("Unknown encoding: "+Z);let X=aQ(U,Z)|0,Q=SU(X),K=Q.write(U,Z);if(K!==X)Q=Q.slice(0,K);return Q}function SY(U){let Z=U.length<0?0:_Y(U.length)|0,X=SU(Z);for(let Q=0;Q<Z;Q+=1)X[Q]=U[Q]&255;return X}function qW(U){if(zU(U,Uint8Array)){let Z=new Uint8Array(U);return PY(Z.buffer,Z.byteOffset,Z.byteLength)}return SY(U)}function PY(U,Z,X){if(Z<0||U.byteLength<Z)throw RangeError('"offset" is outside of buffer bounds');if(U.byteLength<Z+(X||0))throw RangeError('"length" is outside of buffer bounds');let Q;if(Z===void 0&&X===void 0)Q=new Uint8Array(U);else if(X===void 0)Q=new Uint8Array(U,Z);else Q=new Uint8Array(U,Z,X);return Object.setPrototypeOf(Q,W0.prototype),Q}function LW(U){if(W0.isBuffer(U)){let Z=_Y(U.length)|0,X=SU(Z);if(X.length===0)return X;return U.copy(X,0,0,Z),X}if(U.length!==void 0){if(typeof U.length!=="number"||Number.isNaN(U.length))return SU(0);return SY(U)}if(U.type==="Buffer"&&Array.isArray(U.data))return SY(U.data)}function _Y(U){if(U>=vZ)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+vZ.toString(16)+" bytes");return U|0}function aQ(U,Z){if(W0.isBuffer(U))return U.length;if(ArrayBuffer.isView(U)||zU(U,ArrayBuffer))return U.byteLength;if(typeof U!=="string")throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof U);let X=U.length,Q=arguments.length>2&&arguments[2]===!0;if(!Q&&X===0)return 0;let K=!1;for(;;)switch(Z){case"ascii":case"latin1":case"binary":return X;case"utf8":case"utf-8":return kY(U).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return X*2;case"hex":return X>>>1;case"base64":return QG(U).length;default:if(K)return Q?-1:kY(U).length;Z=(""+Z).toLowerCase(),K=!0}}function TW(U,Z,X){let Q=!1;if(Z===void 0||Z<0)Z=0;if(Z>this.length)return"";if(X===void 0||X>this.length)X=this.length;if(X<=0)return"";if(X>>>=0,Z>>>=0,X<=Z)return"";if(!U)U="utf8";while(!0)switch(U){case"hex":return xW(this,Z,X);case"utf8":case"utf-8":return iQ(this,Z,X);case"ascii":return _W(this,Z,X);case"latin1":case"binary":return BW(this,Z,X);case"base64":return jW(this,Z,X);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return NW(this,Z,X);default:if(Q)throw TypeError("Unknown encoding: "+U);U=(U+"").toLowerCase(),Q=!0}}function sU(U,Z,X){let Q=U[Z];U[Z]=U[X],U[X]=Q}function tQ(U,Z,X,Q,K){if(U.length===0)return-1;if(typeof X==="string")Q=X,X=0;else if(X>2147483647)X=2147483647;else if(X<-2147483648)X=-2147483648;if(X=+X,Number.isNaN(X))X=K?0:U.length-1;if(X<0)X=U.length+X;if(X>=U.length)if(K)return-1;else X=U.length-1;else if(X<0)if(K)X=0;else return-1;if(typeof Z==="string")Z=W0.from(Z,Q);if(W0.isBuffer(Z)){if(Z.length===0)return-1;return bQ(U,Z,X,Q,K)}else if(typeof Z==="number"){if(Z=Z&255,typeof Uint8Array.prototype.indexOf==="function")if(K)return Uint8Array.prototype.indexOf.call(U,Z,X);else return Uint8Array.prototype.lastIndexOf.call(U,Z,X);return bQ(U,[Z],X,Q,K)}throw TypeError("val must be string, number or Buffer")}function bQ(U,Z,X,Q,K){let H=1,$=U.length,M=Z.length;if(Q!==void 0){if(Q=String(Q).toLowerCase(),Q==="ucs2"||Q==="ucs-2"||Q==="utf16le"||Q==="utf-16le"){if(U.length<2||Z.length<2)return-1;H=2,$/=2,M/=2,X/=2}}function q(T,A){if(H===1)return T[A];else return T.readUInt16BE(A*H)}let z;if(K){let T=-1;for(z=X;z<$;z++)if(q(U,z)===q(Z,T===-1?0:z-T)){if(T===-1)T=z;if(z-T+1===M)return T*H}else{if(T!==-1)z-=z-T;T=-1}}else{if(X+M>$)X=$-M;for(z=X;z>=0;z--){let T=!0;for(let A=0;A<M;A++)if(q(U,z+A)!==q(Z,A)){T=!1;break}if(T)return z}}return-1}function RW(U,Z,X,Q){X=Number(X)||0;let K=U.length-X;if(!Q)Q=K;else if(Q=Number(Q),Q>K)Q=K;let H=Z.length;if(Q>H/2)Q=H/2;let $;for($=0;$<Q;++$){let M=parseInt(Z.substr($*2,2),16);if(Number.isNaN(M))return $;U[X+$]=M}return $}function EW(U,Z,X,Q){return DX(kY(Z,U.length-X),U,X,Q)}function SW(U,Z,X,Q){return DX(yW(Z),U,X,Q)}function PW(U,Z,X,Q){return DX(QG(Z),U,X,Q)}function kW(U,Z,X,Q){return DX(cW(Z,U.length-X),U,X,Q)}function jW(U,Z,X){if(Z===0&&X===U.length)return hQ(U);else return hQ(U.slice(Z,X))}function iQ(U,Z,X){X=Math.min(U.length,X);let Q=[],K=Z;while(K<X){let H=U[K],$=null,M=H>239?4:H>223?3:H>191?2:1;if(K+M<=X){let q,z,T,A;switch(M){case 1:if(H<128)$=H;break;case 2:if(q=U[K+1],(q&192)===128){if(A=(H&31)<<6|q&63,A>127)$=A}break;case 3:if(q=U[K+1],z=U[K+2],(q&192)===128&&(z&192)===128){if(A=(H&15)<<12|(q&63)<<6|z&63,A>2047&&(A<55296||A>57343))$=A}break;case 4:if(q=U[K+1],z=U[K+2],T=U[K+3],(q&192)===128&&(z&192)===128&&(T&192)===128){if(A=(H&15)<<18|(q&63)<<12|(z&63)<<6|T&63,A>65535&&A<1114112)$=A}}}if($===null)$=65533,M=1;else if($>65535)$-=65536,Q.push($>>>10&1023|55296),$=56320|$&1023;Q.push($),K+=M}return vW(Q)}function vW(U){let Z=U.length;if(Z<=dQ)return String.fromCharCode.apply(String,U);let X="",Q=0;while(Q<Z)X+=String.fromCharCode.apply(String,U.slice(Q,Q+=dQ));return X}function _W(U,Z,X){let Q="";X=Math.min(U.length,X);for(let K=Z;K<X;++K)Q+=String.fromCharCode(U[K]&127);return Q}function BW(U,Z,X){let Q="";X=Math.min(U.length,X);for(let K=Z;K<X;++K)Q+=String.fromCharCode(U[K]);return Q}function xW(U,Z,X){let Q=U.length;if(!Z||Z<0)Z=0;if(!X||X<0||X>Q)X=Q;let K="";for(let H=Z;H<X;++H)K+=pW[U[H]];return K}function NW(U,Z,X){let Q=U.slice(Z,X),K="";for(let H=0;H<Q.length-1;H+=2)K+=String.fromCharCode(Q[H]+Q[H+1]*256);return K}function x1(U,Z,X){if(U%1!==0||U<0)throw RangeError("offset is not uint");if(U+Z>X)throw RangeError("Trying to access beyond buffer length")}function t1(U,Z,X,Q,K,H){if(!W0.isBuffer(U))throw TypeError('"buffer" argument must be a Buffer instance');if(Z>K||Z<H)throw RangeError('"value" argument is out of bounds');if(X+Q>U.length)throw RangeError("Index out of range")}function eQ(U,Z,X,Q,K){JG(Z,Q,K,U,X,7);let H=Number(Z&BigInt(4294967295));U[X++]=H,H=H>>8,U[X++]=H,H=H>>8,U[X++]=H,H=H>>8,U[X++]=H;let $=Number(Z>>BigInt(32)&BigInt(4294967295));return U[X++]=$,$=$>>8,U[X++]=$,$=$>>8,U[X++]=$,$=$>>8,U[X++]=$,X}function UG(U,Z,X,Q,K){JG(Z,Q,K,U,X,7);let H=Number(Z&BigInt(4294967295));U[X+7]=H,H=H>>8,U[X+6]=H,H=H>>8,U[X+5]=H,H=H>>8,U[X+4]=H;let $=Number(Z>>BigInt(32)&BigInt(4294967295));return U[X+3]=$,$=$>>8,U[X+2]=$,$=$>>8,U[X+1]=$,$=$>>8,U[X]=$,X+8}function ZG(U,Z,X,Q,K,H){if(X+Q>U.length)throw RangeError("Index out of range");if(X<0)throw RangeError("Index out of range")}function XG(U,Z,X,Q,K){if(Z=+Z,X=X>>>0,!K)ZG(U,Z,X,4,340282346638528860000000000000000000000,-340282346638528860000000000000000000000);return oQ(U,Z,X,Q,23,4),X+4}function YG(U,Z,X,Q,K){if(Z=+Z,X=X>>>0,!K)ZG(U,Z,X,8,179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);return oQ(U,Z,X,Q,52,8),X+8}function lQ(U){let Z="",X=U.length,Q=U[0]==="-"?1:0;for(;X>=Q+4;X-=3)Z=`_${U.slice(X-3,X)}${Z}`;return`${U.slice(0,X)}${Z}`}function gW(U,Z,X){if(OZ(Z,"offset"),U[Z]===void 0||U[Z+X]===void 0)_Z(Z,U.length-(X+1))}function JG(U,Z,X,Q,K,H){if(U>X||U<Z){let $=typeof Z==="bigint"?"n":"",M;if(H>3)if(Z===0||Z===BigInt(0))M=`>= 0${$} and < 2${$} ** ${(H+1)*8}${$}`;else M=`>= -(2${$} ** ${(H+1)*8-1}${$}) and < 2 ** ${(H+1)*8-1}${$}`;else M=`>= ${Z}${$} and <= ${X}${$}`;throw new EY("value",M,U)}gW(Q,K,H)}function OZ(U,Z){if(typeof U!=="number")throw new zW(Z,"number",U)}function _Z(U,Z,X){if(Math.floor(U)!==U)throw OZ(U,X),new EY(X||"offset","an integer",U);if(Z<0)throw new AW;throw new EY(X||"offset",`>= ${X?1:0} and <= ${Z}`,U)}function wW(U){if(U=U.split("=")[0],U=U.trim().replace(fW,""),U.length<2)return"";while(U.length%4!==0)U=U+"=";return U}function kY(U,Z){Z=Z||1/0;let X,Q=U.length,K=null,H=[];for(let $=0;$<Q;++$){if(X=U.charCodeAt($),X>55295&&X<57344){if(!K){if(X>56319){if((Z-=3)>-1)H.push(239,191,189);continue}else if($+1===Q){if((Z-=3)>-1)H.push(239,191,189);continue}K=X;continue}if(X<56320){if((Z-=3)>-1)H.push(239,191,189);K=X;continue}X=(K-55296<<10|X-56320)+65536}else if(K){if((Z-=3)>-1)H.push(239,191,189)}if(K=null,X<128){if((Z-=1)<0)break;H.push(X)}else if(X<2048){if((Z-=2)<0)break;H.push(X>>6|192,X&63|128)}else if(X<65536){if((Z-=3)<0)break;H.push(X>>12|224,X>>6&63|128,X&63|128)}else if(X<1114112){if((Z-=4)<0)break;H.push(X>>18|240,X>>12&63|128,X>>6&63|128,X&63|128)}else throw Error("Invalid code point")}return H}function yW(U){let Z=[];for(let X=0;X<U.length;++X)Z.push(U.charCodeAt(X)&255);return Z}function cW(U,Z){let X,Q,K,H=[];for(let $=0;$<U.length;++$){if((Z-=2)<0)break;X=U.charCodeAt($),Q=X>>8,K=X%256,H.push(K),H.push(Q)}return H}function QG(U){return $W(wW(U))}function DX(U,Z,X,Q){let K;for(K=0;K<Q;++K){if(K+X>=Z.length||K>=U.length)break;Z[K+X]=U[K]}return K}function zU(U,Z){return U instanceof Z||U!=null&&U.constructor!=null&&U.constructor.name!=null&&U.constructor.name===Z.name}function fU(U){return typeof BigInt>"u"?hW:U}function hW(){throw Error("BigInt not supported")}function BY(U){return()=>{throw Error(U+" is not implemented for node:buffer browser polyfill")}}var AU,KU,RY="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",mU,pQ,uQ,nQ=50,vZ=2147483647,mQ=536870888,IW,HW,FW,OW,CW,AW,zW,EY,dQ=4096,fW,pW,uW,bW,dW=(U)=>{for(let Z of U)if(Z.charCodeAt(0)>127)return!1;return!0},lW,oW;var g1=IZ(()=>{AU=[],KU=[];for(mU=0,pQ=RY.length;mU<pQ;++mU)AU[mU]=RY[mU],KU[RY.charCodeAt(mU)]=mU;KU[45]=62;KU[95]=63;uQ=typeof Symbol==="function"&&typeof Symbol.for==="function"?Symbol.for("nodejs.util.inspect.custom"):null,IW=globalThis.btoa,HW=globalThis.atob,FW=globalThis.File,OW=globalThis.Blob,CW={MAX_LENGTH:vZ,MAX_STRING_LENGTH:mQ};AW=jY("ERR_BUFFER_OUT_OF_BOUNDS",function(U){if(U)return`${U} is outside of buffer bounds`;return"Attempt to access memory outside buffer bounds"},RangeError),zW=jY("ERR_INVALID_ARG_TYPE",function(U,Z){return`The "${U}" argument must be of type number. Received type ${typeof Z}`},TypeError),EY=jY("ERR_OUT_OF_RANGE",function(U,Z,X){let Q=`The value of "${U}" is out of range.`,K=X;if(Number.isInteger(X)&&Math.abs(X)>4294967296)K=lQ(String(X));else if(typeof X==="bigint"){if(K=String(X),X>BigInt(2)**BigInt(32)||X<-(BigInt(2)**BigInt(32)))K=lQ(K);K+="n"}return Q+=` It must be ${Z}. Received ${K}`,Q},RangeError);Object.defineProperty(W0.prototype,"parent",{enumerable:!0,get:function(){if(!W0.isBuffer(this))return;return this.buffer}});Object.defineProperty(W0.prototype,"offset",{enumerable:!0,get:function(){if(!W0.isBuffer(this))return;return this.byteOffset}});W0.poolSize=8192;W0.from=function(U,Z,X){return sQ(U,Z,X)};Object.setPrototypeOf(W0.prototype,Uint8Array.prototype);Object.setPrototypeOf(W0,Uint8Array);W0.alloc=function(U,Z,X){return DW(U,Z,X)};W0.allocUnsafe=function(U){return vY(U)};W0.allocUnsafeSlow=function(U){return vY(U)};W0.isBuffer=function(U){return U!=null&&U._isBuffer===!0&&U!==W0.prototype};W0.compare=function(U,Z){if(zU(U,Uint8Array))U=W0.from(U,U.offset,U.byteLength);if(zU(Z,Uint8Array))Z=W0.from(Z,Z.offset,Z.byteLength);if(!W0.isBuffer(U)||!W0.isBuffer(Z))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(U===Z)return 0;let X=U.length,Q=Z.length;for(let K=0,H=Math.min(X,Q);K<H;++K)if(U[K]!==Z[K]){X=U[K],Q=Z[K];break}if(X<Q)return-1;if(Q<X)return 1;return 0};W0.isEncoding=function(U){switch(String(U).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}};W0.concat=function(U,Z){if(!Array.isArray(U))throw TypeError('"list" argument must be an Array of Buffers');if(U.length===0)return W0.alloc(0);let X;if(Z===void 0){Z=0;for(X=0;X<U.length;++X)Z+=U[X].length}let Q=W0.allocUnsafe(Z),K=0;for(X=0;X<U.length;++X){let H=U[X];if(zU(H,Uint8Array))if(K+H.length>Q.length){if(!W0.isBuffer(H))H=W0.from(H);H.copy(Q,K)}else Uint8Array.prototype.set.call(Q,H,K);else if(!W0.isBuffer(H))throw TypeError('"list" argument must be an Array of Buffers');else H.copy(Q,K);K+=H.length}return Q};W0.byteLength=aQ;W0.prototype._isBuffer=!0;W0.prototype.swap16=function(){let U=this.length;if(U%2!==0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let Z=0;Z<U;Z+=2)sU(this,Z,Z+1);return this};W0.prototype.swap32=function(){let U=this.length;if(U%4!==0)throw RangeError("Buffer size must be a multiple of 32-bits");for(let Z=0;Z<U;Z+=4)sU(this,Z,Z+3),sU(this,Z+1,Z+2);return this};W0.prototype.swap64=function(){let U=this.length;if(U%8!==0)throw RangeError("Buffer size must be a multiple of 64-bits");for(let Z=0;Z<U;Z+=8)sU(this,Z,Z+7),sU(this,Z+1,Z+6),sU(this,Z+2,Z+5),sU(this,Z+3,Z+4);return this};W0.prototype.toString=function(){let U=this.length;if(U===0)return"";if(arguments.length===0)return iQ(this,0,U);return TW.apply(this,arguments)};W0.prototype.toLocaleString=W0.prototype.toString;W0.prototype.equals=function(U){if(!W0.isBuffer(U))throw TypeError("Argument must be a Buffer");if(this===U)return!0;return W0.compare(this,U)===0};W0.prototype.inspect=function(){let U="",Z=nQ;if(U=this.toString("hex",0,Z).replace(/(.{2})/g,"$1 ").trim(),this.length>Z)U+=" ... ";return"<Buffer "+U+">"};if(uQ)W0.prototype[uQ]=W0.prototype.inspect;W0.prototype.compare=function(U,Z,X,Q,K){if(zU(U,Uint8Array))U=W0.from(U,U.offset,U.byteLength);if(!W0.isBuffer(U))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof U);if(Z===void 0)Z=0;if(X===void 0)X=U?U.length:0;if(Q===void 0)Q=0;if(K===void 0)K=this.length;if(Z<0||X>U.length||Q<0||K>this.length)throw RangeError("out of range index");if(Q>=K&&Z>=X)return 0;if(Q>=K)return-1;if(Z>=X)return 1;if(Z>>>=0,X>>>=0,Q>>>=0,K>>>=0,this===U)return 0;let H=K-Q,$=X-Z,M=Math.min(H,$),q=this.slice(Q,K),z=U.slice(Z,X);for(let T=0;T<M;++T)if(q[T]!==z[T]){H=q[T],$=z[T];break}if(H<$)return-1;if($<H)return 1;return 0};W0.prototype.includes=function(U,Z,X){return this.indexOf(U,Z,X)!==-1};W0.prototype.indexOf=function(U,Z,X){return tQ(this,U,Z,X,!0)};W0.prototype.lastIndexOf=function(U,Z,X){return tQ(this,U,Z,X,!1)};W0.prototype.write=function(U,Z,X,Q){if(Z===void 0)Q="utf8",X=this.length,Z=0;else if(X===void 0&&typeof Z==="string")Q=Z,X=this.length,Z=0;else if(isFinite(Z))if(Z=Z>>>0,isFinite(X)){if(X=X>>>0,Q===void 0)Q="utf8"}else Q=X,X=void 0;else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let K=this.length-Z;if(X===void 0||X>K)X=K;if(U.length>0&&(X<0||Z<0)||Z>this.length)throw RangeError("Attempt to write outside buffer bounds");if(!Q)Q="utf8";let H=!1;for(;;)switch(Q){case"hex":return RW(this,U,Z,X);case"utf8":case"utf-8":return EW(this,U,Z,X);case"ascii":case"latin1":case"binary":return SW(this,U,Z,X);case"base64":return PW(this,U,Z,X);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return kW(this,U,Z,X);default:if(H)throw TypeError("Unknown encoding: "+Q);Q=(""+Q).toLowerCase(),H=!0}};W0.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};W0.prototype.slice=function(U,Z){let X=this.length;if(U=~~U,Z=Z===void 0?X:~~Z,U<0){if(U+=X,U<0)U=0}else if(U>X)U=X;if(Z<0){if(Z+=X,Z<0)Z=0}else if(Z>X)Z=X;if(Z<U)Z=U;let Q=this.subarray(U,Z);return Object.setPrototypeOf(Q,W0.prototype),Q};W0.prototype.readUintLE=W0.prototype.readUIntLE=function(U,Z,X){if(U=U>>>0,Z=Z>>>0,!X)x1(U,Z,this.length);let Q=this[U],K=1,H=0;while(++H<Z&&(K*=256))Q+=this[U+H]*K;return Q};W0.prototype.readUintBE=W0.prototype.readUIntBE=function(U,Z,X){if(U=U>>>0,Z=Z>>>0,!X)x1(U,Z,this.length);let Q=this[U+--Z],K=1;while(Z>0&&(K*=256))Q+=this[U+--Z]*K;return Q};W0.prototype.readUint8=W0.prototype.readUInt8=function(U,Z){if(U=U>>>0,!Z)x1(U,1,this.length);return this[U]};W0.prototype.readUint16LE=W0.prototype.readUInt16LE=function(U,Z){if(U=U>>>0,!Z)x1(U,2,this.length);return this[U]|this[U+1]<<8};W0.prototype.readUint16BE=W0.prototype.readUInt16BE=function(U,Z){if(U=U>>>0,!Z)x1(U,2,this.length);return this[U]<<8|this[U+1]};W0.prototype.readUint32LE=W0.prototype.readUInt32LE=function(U,Z){if(U=U>>>0,!Z)x1(U,4,this.length);return(this[U]|this[U+1]<<8|this[U+2]<<16)+this[U+3]*16777216};W0.prototype.readUint32BE=W0.prototype.readUInt32BE=function(U,Z){if(U=U>>>0,!Z)x1(U,4,this.length);return this[U]*16777216+(this[U+1]<<16|this[U+2]<<8|this[U+3])};W0.prototype.readBigUInt64LE=fU(function(U){U=U>>>0,OZ(U,"offset");let Z=this[U],X=this[U+7];if(Z===void 0||X===void 0)_Z(U,this.length-8);let Q=Z+this[++U]*256+this[++U]*65536+this[++U]*16777216,K=this[++U]+this[++U]*256+this[++U]*65536+X*16777216;return BigInt(Q)+(BigInt(K)<<BigInt(32))});W0.prototype.readBigUInt64BE=fU(function(U){U=U>>>0,OZ(U,"offset");let Z=this[U],X=this[U+7];if(Z===void 0||X===void 0)_Z(U,this.length-8);let Q=Z*16777216+this[++U]*65536+this[++U]*256+this[++U],K=this[++U]*16777216+this[++U]*65536+this[++U]*256+X;return(BigInt(Q)<<BigInt(32))+BigInt(K)});W0.prototype.readIntLE=function(U,Z,X){if(U=U>>>0,Z=Z>>>0,!X)x1(U,Z,this.length);let Q=this[U],K=1,H=0;while(++H<Z&&(K*=256))Q+=this[U+H]*K;if(K*=128,Q>=K)Q-=Math.pow(2,8*Z);return Q};W0.prototype.readIntBE=function(U,Z,X){if(U=U>>>0,Z=Z>>>0,!X)x1(U,Z,this.length);let Q=Z,K=1,H=this[U+--Q];while(Q>0&&(K*=256))H+=this[U+--Q]*K;if(K*=128,H>=K)H-=Math.pow(2,8*Z);return H};W0.prototype.readInt8=function(U,Z){if(U=U>>>0,!Z)x1(U,1,this.length);if(!(this[U]&128))return this[U];return(255-this[U]+1)*-1};W0.prototype.readInt16LE=function(U,Z){if(U=U>>>0,!Z)x1(U,2,this.length);let X=this[U]|this[U+1]<<8;return X&32768?X|4294901760:X};W0.prototype.readInt16BE=function(U,Z){if(U=U>>>0,!Z)x1(U,2,this.length);let X=this[U+1]|this[U]<<8;return X&32768?X|4294901760:X};W0.prototype.readInt32LE=function(U,Z){if(U=U>>>0,!Z)x1(U,4,this.length);return this[U]|this[U+1]<<8|this[U+2]<<16|this[U+3]<<24};W0.prototype.readInt32BE=function(U,Z){if(U=U>>>0,!Z)x1(U,4,this.length);return this[U]<<24|this[U+1]<<16|this[U+2]<<8|this[U+3]};W0.prototype.readBigInt64LE=fU(function(U){U=U>>>0,OZ(U,"offset");let Z=this[U],X=this[U+7];if(Z===void 0||X===void 0)_Z(U,this.length-8);let Q=this[U+4]+this[U+5]*256+this[U+6]*65536+(X<<24);return(BigInt(Q)<<BigInt(32))+BigInt(Z+this[++U]*256+this[++U]*65536+this[++U]*16777216)});W0.prototype.readBigInt64BE=fU(function(U){U=U>>>0,OZ(U,"offset");let Z=this[U],X=this[U+7];if(Z===void 0||X===void 0)_Z(U,this.length-8);let Q=(Z<<24)+this[++U]*65536+this[++U]*256+this[++U];return(BigInt(Q)<<BigInt(32))+BigInt(this[++U]*16777216+this[++U]*65536+this[++U]*256+X)});W0.prototype.readFloatLE=function(U,Z){if(U=U>>>0,!Z)x1(U,4,this.length);return zX(this,U,!0,23,4)};W0.prototype.readFloatBE=function(U,Z){if(U=U>>>0,!Z)x1(U,4,this.length);return zX(this,U,!1,23,4)};W0.prototype.readDoubleLE=function(U,Z){if(U=U>>>0,!Z)x1(U,8,this.length);return zX(this,U,!0,52,8)};W0.prototype.readDoubleBE=function(U,Z){if(U=U>>>0,!Z)x1(U,8,this.length);return zX(this,U,!1,52,8)};W0.prototype.writeUintLE=W0.prototype.writeUIntLE=function(U,Z,X,Q){if(U=+U,Z=Z>>>0,X=X>>>0,!Q){let $=Math.pow(2,8*X)-1;t1(this,U,Z,X,$,0)}let K=1,H=0;this[Z]=U&255;while(++H<X&&(K*=256))this[Z+H]=U/K&255;return Z+X};W0.prototype.writeUintBE=W0.prototype.writeUIntBE=function(U,Z,X,Q){if(U=+U,Z=Z>>>0,X=X>>>0,!Q){let $=Math.pow(2,8*X)-1;t1(this,U,Z,X,$,0)}let K=X-1,H=1;this[Z+K]=U&255;while(--K>=0&&(H*=256))this[Z+K]=U/H&255;return Z+X};W0.prototype.writeUint8=W0.prototype.writeUInt8=function(U,Z,X){if(U=+U,Z=Z>>>0,!X)t1(this,U,Z,1,255,0);return this[Z]=U&255,Z+1};W0.prototype.writeUint16LE=W0.prototype.writeUInt16LE=function(U,Z,X){if(U=+U,Z=Z>>>0,!X)t1(this,U,Z,2,65535,0);return this[Z]=U&255,this[Z+1]=U>>>8,Z+2};W0.prototype.writeUint16BE=W0.prototype.writeUInt16BE=function(U,Z,X){if(U=+U,Z=Z>>>0,!X)t1(this,U,Z,2,65535,0);return this[Z]=U>>>8,this[Z+1]=U&255,Z+2};W0.prototype.writeUint32LE=W0.prototype.writeUInt32LE=function(U,Z,X){if(U=+U,Z=Z>>>0,!X)t1(this,U,Z,4,4294967295,0);return this[Z+3]=U>>>24,this[Z+2]=U>>>16,this[Z+1]=U>>>8,this[Z]=U&255,Z+4};W0.prototype.writeUint32BE=W0.prototype.writeUInt32BE=function(U,Z,X){if(U=+U,Z=Z>>>0,!X)t1(this,U,Z,4,4294967295,0);return this[Z]=U>>>24,this[Z+1]=U>>>16,this[Z+2]=U>>>8,this[Z+3]=U&255,Z+4};W0.prototype.writeBigUInt64LE=fU(function(U,Z=0){return eQ(this,U,Z,BigInt(0),BigInt("0xffffffffffffffff"))});W0.prototype.writeBigUInt64BE=fU(function(U,Z=0){return UG(this,U,Z,BigInt(0),BigInt("0xffffffffffffffff"))});W0.prototype.writeIntLE=function(U,Z,X,Q){if(U=+U,Z=Z>>>0,!Q){let M=Math.pow(2,8*X-1);t1(this,U,Z,X,M-1,-M)}let K=0,H=1,$=0;this[Z]=U&255;while(++K<X&&(H*=256)){if(U<0&&$===0&&this[Z+K-1]!==0)$=1;this[Z+K]=(U/H>>0)-$&255}return Z+X};W0.prototype.writeIntBE=function(U,Z,X,Q){if(U=+U,Z=Z>>>0,!Q){let M=Math.pow(2,8*X-1);t1(this,U,Z,X,M-1,-M)}let K=X-1,H=1,$=0;this[Z+K]=U&255;while(--K>=0&&(H*=256)){if(U<0&&$===0&&this[Z+K+1]!==0)$=1;this[Z+K]=(U/H>>0)-$&255}return Z+X};W0.prototype.writeInt8=function(U,Z,X){if(U=+U,Z=Z>>>0,!X)t1(this,U,Z,1,127,-128);if(U<0)U=255+U+1;return this[Z]=U&255,Z+1};W0.prototype.writeInt16LE=function(U,Z,X){if(U=+U,Z=Z>>>0,!X)t1(this,U,Z,2,32767,-32768);return this[Z]=U&255,this[Z+1]=U>>>8,Z+2};W0.prototype.writeInt16BE=function(U,Z,X){if(U=+U,Z=Z>>>0,!X)t1(this,U,Z,2,32767,-32768);return this[Z]=U>>>8,this[Z+1]=U&255,Z+2};W0.prototype.writeInt32LE=function(U,Z,X){if(U=+U,Z=Z>>>0,!X)t1(this,U,Z,4,2147483647,-2147483648);return this[Z]=U&255,this[Z+1]=U>>>8,this[Z+2]=U>>>16,this[Z+3]=U>>>24,Z+4};W0.prototype.writeInt32BE=function(U,Z,X){if(U=+U,Z=Z>>>0,!X)t1(this,U,Z,4,2147483647,-2147483648);if(U<0)U=4294967295+U+1;return this[Z]=U>>>24,this[Z+1]=U>>>16,this[Z+2]=U>>>8,this[Z+3]=U&255,Z+4};W0.prototype.writeBigInt64LE=fU(function(U,Z=0){return eQ(this,U,Z,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});W0.prototype.writeBigInt64BE=fU(function(U,Z=0){return UG(this,U,Z,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});W0.prototype.writeFloatLE=function(U,Z,X){return XG(this,U,Z,!0,X)};W0.prototype.writeFloatBE=function(U,Z,X){return XG(this,U,Z,!1,X)};W0.prototype.writeDoubleLE=function(U,Z,X){return YG(this,U,Z,!0,X)};W0.prototype.writeDoubleBE=function(U,Z,X){return YG(this,U,Z,!1,X)};W0.prototype.copy=function(U,Z,X,Q){if(!W0.isBuffer(U))throw TypeError("argument should be a Buffer");if(!X)X=0;if(!Q&&Q!==0)Q=this.length;if(Z>=U.length)Z=U.length;if(!Z)Z=0;if(Q>0&&Q<X)Q=X;if(Q===X)return 0;if(U.length===0||this.length===0)return 0;if(Z<0)throw RangeError("targetStart out of bounds");if(X<0||X>=this.length)throw RangeError("Index out of range");if(Q<0)throw RangeError("sourceEnd out of bounds");if(Q>this.length)Q=this.length;if(U.length-Z<Q-X)Q=U.length-Z+X;let K=Q-X;if(this===U&&typeof Uint8Array.prototype.copyWithin==="function")this.copyWithin(Z,X,Q);else Uint8Array.prototype.set.call(U,this.subarray(X,Q),Z);return K};W0.prototype.fill=function(U,Z,X,Q){if(typeof U==="string"){if(typeof Z==="string")Q=Z,Z=0,X=this.length;else if(typeof X==="string")Q=X,X=this.length;if(Q!==void 0&&typeof Q!=="string")throw TypeError("encoding must be a string");if(typeof Q==="string"&&!W0.isEncoding(Q))throw TypeError("Unknown encoding: "+Q);if(U.length===1){let H=U.charCodeAt(0);if(Q==="utf8"&&H<128||Q==="latin1")U=H}}else if(typeof U==="number")U=U&255;else if(typeof U==="boolean")U=Number(U);if(Z<0||this.length<Z||this.length<X)throw RangeError("Out of range index");if(X<=Z)return this;if(Z=Z>>>0,X=X===void 0?this.length:X>>>0,!U)U=0;let K;if(typeof U==="number")for(K=Z;K<X;++K)this[K]=U;else{let H=W0.isBuffer(U)?U:W0.from(U,Q),$=H.length;if($===0)throw TypeError('The value "'+U+'" is invalid for argument "value"');for(K=0;K<X-Z;++K)this[K+Z]=H[K%$]}return this};fW=/[^+/0-9A-Za-z-_]/g;pW=function(){let U=Array(256);for(let Z=0;Z<16;++Z){let X=Z*16;for(let Q=0;Q<16;++Q)U[X+Q]="0123456789abcdef"[Z]+"0123456789abcdef"[Q]}return U}();uW=BY("resolveObjectURL"),bW=BY("isUtf8"),lW=BY("transcode"),oW=W0});var CG={};WZ(CG,{types:()=>ZI,promisify:()=>IG,log:()=>$G,isUndefined:()=>CZ,isSymbol:()=>YI,isString:()=>EX,isRegExp:()=>MX,isPrimitive:()=>JI,isObject:()=>AZ,isNumber:()=>VG,isNullOrUndefined:()=>XI,isNull:()=>RX,isFunction:()=>LX,isError:()=>qX,isDate:()=>fY,isBuffer:()=>QI,isBoolean:()=>yY,isArray:()=>GG,inspect:()=>rU,inherits:()=>KG,format:()=>wY,deprecate:()=>mW,default:()=>$I,debuglog:()=>sW,callbackifyOnRejected:()=>hY,callbackify:()=>HG,_extend:()=>pY,TextEncoder:()=>FG,TextDecoder:()=>OG});function wY(U,...Z){if(!EX(U)){var X=[U];for(var Q=0;Q<Z.length;Q++)X.push(rU(Z[Q]));return X.join(" ")}var Q=0,K=Z.length,H=String(U).replace(nW,function(M){if(M==="%%")return"%";if(Q>=K)return M;switch(M){case"%s":return String(Z[Q++]);case"%d":return Number(Z[Q++]);case"%j":try{return JSON.stringify(Z[Q++])}catch(q){return"[Circular]"}default:return M}});for(var $=Z[Q];Q<K;$=Z[++Q])if(RX($)||!AZ($))H+=" "+$;else H+=" "+rU($);return H}function mW(U,Z){if(typeof process>"u"||process?.noDeprecation===!0)return U;var X=!1;function Q(...K){if(!X){if(process.throwDeprecation)throw Error(Z);else if(process.traceDeprecation)console.trace(Z);else console.error(Z);X=!0}return U.apply(this,...K)}return Q}function rW(U,Z){var X=rU.styles[Z];if(X)return"\x1B["+rU.colors[X][0]+"m"+U+"\x1B["+rU.colors[X][1]+"m";else return U}function aW(U,Z){return U}function tW(U){var Z={};return U.forEach(function(X,Q){Z[X]=!0}),Z}function TX(U,Z,X){if(U.customInspect&&Z&&LX(Z.inspect)&&Z.inspect!==rU&&!(Z.constructor&&Z.constructor.prototype===Z)){var Q=Z.inspect(X,U);if(!EX(Q))Q=TX(U,Q,X);return Q}var K=iW(U,Z);if(K)return K;var H=Object.keys(Z),$=tW(H);if(U.showHidden)H=Object.getOwnPropertyNames(Z);if(qX(Z)&&(H.indexOf("message")>=0||H.indexOf("description")>=0))return xY(Z);if(H.length===0){if(LX(Z)){var M=Z.name?": "+Z.name:"";return U.stylize("[Function"+M+"]","special")}if(MX(Z))return U.stylize(RegExp.prototype.toString.call(Z),"regexp");if(fY(Z))return U.stylize(Date.prototype.toString.call(Z),"date");if(qX(Z))return xY(Z)}var q="",z=!1,T=["{","}"];if(GG(Z))z=!0,T=["[","]"];if(LX(Z)){var A=Z.name?": "+Z.name:"";q=" [Function"+A+"]"}if(MX(Z))q=" "+RegExp.prototype.toString.call(Z);if(fY(Z))q=" "+Date.prototype.toUTCString.call(Z);if(qX(Z))q=" "+xY(Z);if(H.length===0&&(!z||Z.length==0))return T[0]+q+T[1];if(X<0)if(MX(Z))return U.stylize(RegExp.prototype.toString.call(Z),"regexp");else return U.stylize("[Object]","special");U.seen.push(Z);var L;if(z)L=eW(U,Z,X,$,H);else L=H.map(function(E){return gY(U,Z,X,$,E,z)});return U.seen.pop(),UI(L,q,T)}function iW(U,Z){if(CZ(Z))return U.stylize("undefined","undefined");if(EX(Z)){var X="'"+JSON.stringify(Z).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return U.stylize(X,"string")}if(VG(Z))return U.stylize(""+Z,"number");if(yY(Z))return U.stylize(""+Z,"boolean");if(RX(Z))return U.stylize("null","null")}function xY(U){return"["+Error.prototype.toString.call(U)+"]"}function eW(U,Z,X,Q,K){var H=[];for(var $=0,M=Z.length;$<M;++$)if(WG(Z,String($)))H.push(gY(U,Z,X,Q,String($),!0));else H.push("");return K.forEach(function(q){if(!q.match(/^\d+$/))H.push(gY(U,Z,X,Q,q,!0))}),H}function gY(U,Z,X,Q,K,H){var $,M,q;if(q=Object.getOwnPropertyDescriptor(Z,K)||{value:Z[K]},q.get)if(q.set)M=U.stylize("[Getter/Setter]","special");else M=U.stylize("[Getter]","special");else if(q.set)M=U.stylize("[Setter]","special");if(!WG(Q,K))$="["+K+"]";if(!M)if(U.seen.indexOf(q.value)<0){if(RX(X))M=TX(U,q.value,null);else M=TX(U,q.value,X-1);if(M.indexOf(`
|
|
3
|
-
`)>-1)if(
|
|
1
|
+
var lK=Object.create;var{getPrototypeOf:oK,defineProperty:kZ,getOwnPropertyNames:CQ,getOwnPropertyDescriptor:nK}=Object,AQ=Object.prototype.hasOwnProperty;var jZ=(U,Z,X)=>{X=U!=null?lK(oK(U)):{};let Q=Z||!U||!U.__esModule?kZ(X,"default",{value:U,enumerable:!0}):X;for(let K of CQ(U))if(!AQ.call(Q,K))kZ(Q,K,{get:()=>U[K],enumerable:!0});return Q},OQ=new WeakMap,m0=(U)=>{var Z=OQ.get(U),X;if(Z)return Z;if(Z=kZ({},"__esModule",{value:!0}),U&&typeof U==="object"||typeof U==="function")CQ(U).map((Q)=>!AQ.call(Z,Q)&&kZ(Z,Q,{get:()=>U[Q],enumerable:!(X=nK(U,Q))||X.enumerable}));return OQ.set(U,Z),Z},mK=(U,Z)=>()=>(Z||U((Z={exports:{}}).exports,Z),Z.exports);var WZ=(U,Z)=>{for(var X in Z)kZ(U,X,{get:Z[X],enumerable:!0,configurable:!0,set:(Q)=>Z[X]=()=>Q})};var IZ=(U,Z)=>()=>(U&&(Z=U(U=0)),Z);var EU=((U)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(U,{get:(Z,X)=>(typeof require<"u"?require:Z)[X]}):U)(function(U){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+U+'" is not supported')});var DY={};WZ(DY,{resolveObject:()=>SQ,resolve:()=>EQ,parse:()=>HZ,format:()=>RQ,default:()=>YW,Url:()=>XU,URLSearchParams:()=>LQ,URL:()=>AY});function zY(U){return typeof U==="string"}function TQ(U){return typeof U==="object"&&U!==null}function CX(U){return U===null}function sK(U){return U==null}function XU(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function HZ(U,Z,X){if(U&&TQ(U)&&U instanceof XU)return U;var Q=new XU;return Q.parse(U,Z,X),Q}function RQ(U){if(zY(U))U=HZ(U);if(!(U instanceof XU))return XU.prototype.format.call(U);return U.format()}function EQ(U,Z){return HZ(U,!1,!0).resolve(Z)}function SQ(U,Z){if(!U)return Z;return HZ(U,!1,!0).resolveObject(Z)}var AY,LQ,rK,aK,tK,iK,eK,HY,DQ,qQ,UW=255,MQ,ZW,XW,OY,FZ,CY,YW;var qY=IZ(()=>{({URL:AY,URLSearchParams:LQ}=globalThis);rK=/^([a-z0-9.+-]+:)/i,aK=/:[0-9]*$/,tK=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,iK=["<",">",'"',"`"," ","\r",`
|
|
2
|
+
`,"\t"],eK=["{","}","|","\\","^","`"].concat(iK),HY=["'"].concat(eK),DQ=["%","/","?",";","#"].concat(HY),qQ=["/","?","#"],MQ=/^[+a-z0-9A-Z_-]{0,63}$/,ZW=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,XW={javascript:!0,"javascript:":!0},OY={javascript:!0,"javascript:":!0},FZ={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},CY={parse(U){var Z=decodeURIComponent;return(U+"").replace(/\+/g," ").split("&").filter(Boolean).reduce(function(X,Q,K){var F=Q.split("="),$=Z(F[0]||""),q=Z(F[1]||""),M=X[$];return X[$]=M===void 0?q:[].concat(M,q),X},{})},stringify(U){var Z=encodeURIComponent;return Object.keys(U||{}).reduce(function(X,Q){return[].concat(U[Q]).forEach(function(K){X.push(Z(Q)+"="+Z(K))}),X},[]).join("&").replace(/\s/g,"+")}};XU.prototype.parse=function(U,Z,X){if(!zY(U))throw TypeError("Parameter 'url' must be a string, not "+typeof U);var Q=U.indexOf("?"),K=Q!==-1&&Q<U.indexOf("#")?"?":"#",F=U.split(K),$=/\\/g;F[0]=F[0].replace($,"/"),U=F.join(K);var q=U;if(q=q.trim(),!X&&U.split("#").length===1){var M=tK.exec(q);if(M){if(this.path=q,this.href=q,this.pathname=M[1],M[2])if(this.search=M[2],Z)this.query=CY.parse(this.search.substr(1));else this.query=this.search.substr(1);else if(Z)this.search="",this.query={};return this}}var z=rK.exec(q);if(z){z=z[0];var T=z.toLowerCase();this.protocol=T,q=q.substr(z.length)}if(X||z||q.match(/^\/\/[^@\/]+@[^@\/]+/)){var A=q.substr(0,2)==="//";if(A&&!(z&&OY[z]))q=q.substr(2),this.slashes=!0}if(!OY[z]&&(A||z&&!FZ[z])){var L=-1;for(var E=0;E<qQ.length;E++){var S=q.indexOf(qQ[E]);if(S!==-1&&(L===-1||S<L))L=S}var j,k;if(L===-1)k=q.lastIndexOf("@");else k=q.lastIndexOf("@",L);if(k!==-1)j=q.slice(0,k),q=q.slice(k+1),this.auth=decodeURIComponent(j);L=-1;for(var E=0;E<DQ.length;E++){var S=q.indexOf(DQ[E]);if(S!==-1&&(L===-1||S<L))L=S}if(L===-1)L=q.length;this.host=q.slice(0,L),q=q.slice(L),this.parseHost(),this.hostname=this.hostname||"";var B=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!B){var v=this.hostname.split(/\./);for(var E=0,x=v.length;E<x;E++){var N=v[E];if(!N)continue;if(!N.match(MQ)){var w="";for(var u=0,Z0=N.length;u<Z0;u++)if(N.charCodeAt(u)>127)w+="x";else w+=N[u];if(!w.match(MQ)){var V0=v.slice(0,E),Y0=v.slice(E+1),b=N.match(ZW);if(b)V0.push(b[1]),Y0.unshift(b[2]);if(Y0.length)q="/"+Y0.join(".")+q;this.hostname=V0.join(".");break}}}}if(this.hostname.length>UW)this.hostname="";else this.hostname=this.hostname.toLowerCase();if(!B)this.hostname=new AY(`https://${this.hostname}`).hostname;var i=this.port?":"+this.port:"",Y=this.hostname||"";if(this.host=Y+i,this.href+=this.host,B){if(this.hostname=this.hostname.substr(1,this.hostname.length-2),q[0]!=="/")q="/"+q}}if(!XW[T])for(var E=0,x=HY.length;E<x;E++){var V=HY[E];if(q.indexOf(V)===-1)continue;var I=encodeURIComponent(V);if(I===V)I=escape(V);q=q.split(V).join(I)}var G=q.indexOf("#");if(G!==-1)this.hash=q.substr(G),q=q.slice(0,G);var W=q.indexOf("?");if(W!==-1){if(this.search=q.substr(W),this.query=q.substr(W+1),Z)this.query=CY.parse(this.query);q=q.slice(0,W)}else if(Z)this.search="",this.query={};if(q)this.pathname=q;if(FZ[T]&&this.hostname&&!this.pathname)this.pathname="/";if(this.pathname||this.search){var i=this.pathname||"",C=this.search||"";this.path=i+C}return this.href=this.format(),this};XU.prototype.format=function(){var U=this.auth||"";if(U)U=encodeURIComponent(U),U=U.replace(/%3A/i,":"),U+="@";var Z=this.protocol||"",X=this.pathname||"",Q=this.hash||"",K=!1,F="";if(this.host)K=U+this.host;else if(this.hostname){if(K=U+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port)K+=":"+this.port}if(this.query&&TQ(this.query)&&Object.keys(this.query).length)F=CY.stringify(this.query);var $=this.search||F&&"?"+F||"";if(Z&&Z.substr(-1)!==":")Z+=":";if(this.slashes||(!Z||FZ[Z])&&K!==!1){if(K="//"+(K||""),X&&X.charAt(0)!=="/")X="/"+X}else if(!K)K="";if(Q&&Q.charAt(0)!=="#")Q="#"+Q;if($&&$.charAt(0)!=="?")$="?"+$;return X=X.replace(/[?#]/g,function(q){return encodeURIComponent(q)}),$=$.replace("#","%23"),Z+K+X+$+Q};XU.prototype.resolve=function(U){return this.resolveObject(HZ(U,!1,!0)).format()};XU.prototype.resolveObject=function(U){if(zY(U)){var Z=new XU;Z.parse(U,!1,!0),U=Z}var X=new XU,Q=Object.keys(this);for(var K=0;K<Q.length;K++){var F=Q[K];X[F]=this[F]}if(X.hash=U.hash,U.href==="")return X.href=X.format(),X;if(U.slashes&&!U.protocol){var $=Object.keys(U);for(var q=0;q<$.length;q++){var M=$[q];if(M!=="protocol")X[M]=U[M]}if(FZ[X.protocol]&&X.hostname&&!X.pathname)X.path=X.pathname="/";return X.href=X.format(),X}if(U.protocol&&U.protocol!==X.protocol){if(!FZ[U.protocol]){var z=Object.keys(U);for(var T=0;T<z.length;T++){var A=z[T];X[A]=U[A]}return X.href=X.format(),X}if(X.protocol=U.protocol,!U.host&&!OY[U.protocol]){var x=(U.pathname||"").split("/");while(x.length&&!(U.host=x.shift()));if(!U.host)U.host="";if(!U.hostname)U.hostname="";if(x[0]!=="")x.unshift("");if(x.length<2)x.unshift("");X.pathname=x.join("/")}else X.pathname=U.pathname;if(X.search=U.search,X.query=U.query,X.host=U.host||"",X.auth=U.auth,X.hostname=U.hostname||U.host,X.port=U.port,X.pathname||X.search){var L=X.pathname||"",E=X.search||"";X.path=L+E}return X.slashes=X.slashes||U.slashes,X.href=X.format(),X}var S=X.pathname&&X.pathname.charAt(0)==="/",j=U.host||U.pathname&&U.pathname.charAt(0)==="/",k=j||S||X.host&&U.pathname,B=k,v=X.pathname&&X.pathname.split("/")||[],x=U.pathname&&U.pathname.split("/")||[],N=X.protocol&&!FZ[X.protocol];if(N){if(X.hostname="",X.port=null,X.host)if(v[0]==="")v[0]=X.host;else v.unshift(X.host);if(X.host="",U.protocol){if(U.hostname=null,U.port=null,U.host)if(x[0]==="")x[0]=U.host;else x.unshift(U.host);U.host=null}k=k&&(x[0]===""||v[0]==="")}if(j)X.host=U.host||U.host===""?U.host:X.host,X.hostname=U.hostname||U.hostname===""?U.hostname:X.hostname,X.search=U.search,X.query=U.query,v=x;else if(x.length){if(!v)v=[];v.pop(),v=v.concat(x),X.search=U.search,X.query=U.query}else if(!sK(U.search)){if(N){X.hostname=X.host=v.shift();var w=X.host&&X.host.indexOf("@")>0?X.host.split("@"):!1;if(w)X.auth=w.shift(),X.host=X.hostname=w.shift()}if(X.search=U.search,X.query=U.query,!CX(X.pathname)||!CX(X.search))X.path=(X.pathname?X.pathname:"")+(X.search?X.search:"");return X.href=X.format(),X}if(!v.length){if(X.pathname=null,X.search)X.path="/"+X.search;else X.path=null;return X.href=X.format(),X}var u=v.slice(-1)[0],Z0=(X.host||U.host||v.length>1)&&(u==="."||u==="..")||u==="",V0=0;for(var Y0=v.length;Y0>=0;Y0--)if(u=v[Y0],u===".")v.splice(Y0,1);else if(u==="..")v.splice(Y0,1),V0++;else if(V0)v.splice(Y0,1),V0--;if(!k&&!B)for(;V0--;V0)v.unshift("..");if(k&&v[0]!==""&&(!v[0]||v[0].charAt(0)!=="/"))v.unshift("");if(Z0&&v.join("/").substr(-1)!=="/")v.push("");var b=v[0]===""||v[0]&&v[0].charAt(0)==="/";if(N){X.hostname=X.host=b?"":v.length?v.shift():"";var w=X.host&&X.host.indexOf("@")>0?X.host.split("@"):!1;if(w)X.auth=w.shift(),X.host=X.hostname=w.shift()}if(k=k||X.host&&v.length,k&&!b)v.unshift("");if(!v.length)X.pathname=null,X.path=null;else X.pathname=v.join("/");if(!CX(X.pathname)||!CX(X.search))X.path=(X.pathname?X.pathname:"")+(X.search?X.search:"");return X.auth=U.auth||X.auth,X.slashes=X.slashes||U.slashes,X.href=X.format(),X};XU.prototype.parseHost=function(){var U=this.host,Z=aK.exec(U);if(Z){if(Z=Z[0],Z!==":")this.port=Z.substr(1);U=U.substr(0,U.length-Z.length)}if(U)this.hostname=U};YW={parse:HZ,resolve:EQ,resolveObject:SQ,format:RQ,Url:XU,URL:AY,URLSearchParams:LQ}});var LY={};WZ(LY,{sep:()=>wQ,resolve:()=>AX,relative:()=>vQ,posix:()=>cQ,parse:()=>fQ,normalize:()=>MY,join:()=>jQ,isAbsolute:()=>kQ,format:()=>gQ,extname:()=>NQ,dirname:()=>BQ,delimiter:()=>yQ,default:()=>QW,basename:()=>xQ,_makeLong:()=>_Q});function CU(U){if(typeof U!=="string")throw TypeError("Path must be a string. Received "+JSON.stringify(U))}function PQ(U,Z){var X="",Q=0,K=-1,F=0,$;for(var q=0;q<=U.length;++q){if(q<U.length)$=U.charCodeAt(q);else if($===47)break;else $=47;if($===47){if(K===q-1||F===1);else if(K!==q-1&&F===2){if(X.length<2||Q!==2||X.charCodeAt(X.length-1)!==46||X.charCodeAt(X.length-2)!==46){if(X.length>2){var M=X.lastIndexOf("/");if(M!==X.length-1){if(M===-1)X="",Q=0;else X=X.slice(0,M),Q=X.length-1-X.lastIndexOf("/");K=q,F=0;continue}}else if(X.length===2||X.length===1){X="",Q=0,K=q,F=0;continue}}if(Z){if(X.length>0)X+="/..";else X="..";Q=2}}else{if(X.length>0)X+="/"+U.slice(K+1,q);else X=U.slice(K+1,q);Q=q-K-1}K=q,F=0}else if($===46&&F!==-1)++F;else F=-1}return X}function JW(U,Z){var X=Z.dir||Z.root,Q=Z.base||(Z.name||"")+(Z.ext||"");if(!X)return Q;if(X===Z.root)return X+Q;return X+U+Q}function AX(){var U="",Z=!1,X;for(var Q=arguments.length-1;Q>=-1&&!Z;Q--){var K;if(Q>=0)K=arguments[Q];else{if(X===void 0)X=process.cwd();K=X}if(CU(K),K.length===0)continue;U=K+"/"+U,Z=K.charCodeAt(0)===47}if(U=PQ(U,!Z),Z)if(U.length>0)return"/"+U;else return"/";else if(U.length>0)return U;else return"."}function MY(U){if(CU(U),U.length===0)return".";var Z=U.charCodeAt(0)===47,X=U.charCodeAt(U.length-1)===47;if(U=PQ(U,!Z),U.length===0&&!Z)U=".";if(U.length>0&&X)U+="/";if(Z)return"/"+U;return U}function kQ(U){return CU(U),U.length>0&&U.charCodeAt(0)===47}function jQ(){if(arguments.length===0)return".";var U;for(var Z=0;Z<arguments.length;++Z){var X=arguments[Z];if(CU(X),X.length>0)if(U===void 0)U=X;else U+="/"+X}if(U===void 0)return".";return MY(U)}function vQ(U,Z){if(CU(U),CU(Z),U===Z)return"";if(U=AX(U),Z=AX(Z),U===Z)return"";var X=1;for(;X<U.length;++X)if(U.charCodeAt(X)!==47)break;var Q=U.length,K=Q-X,F=1;for(;F<Z.length;++F)if(Z.charCodeAt(F)!==47)break;var $=Z.length,q=$-F,M=K<q?K:q,z=-1,T=0;for(;T<=M;++T){if(T===M){if(q>M){if(Z.charCodeAt(F+T)===47)return Z.slice(F+T+1);else if(T===0)return Z.slice(F+T)}else if(K>M){if(U.charCodeAt(X+T)===47)z=T;else if(T===0)z=0}break}var A=U.charCodeAt(X+T),L=Z.charCodeAt(F+T);if(A!==L)break;else if(A===47)z=T}var E="";for(T=X+z+1;T<=Q;++T)if(T===Q||U.charCodeAt(T)===47)if(E.length===0)E+="..";else E+="/..";if(E.length>0)return E+Z.slice(F+z);else{if(F+=z,Z.charCodeAt(F)===47)++F;return Z.slice(F)}}function _Q(U){return U}function BQ(U){if(CU(U),U.length===0)return".";var Z=U.charCodeAt(0),X=Z===47,Q=-1,K=!0;for(var F=U.length-1;F>=1;--F)if(Z=U.charCodeAt(F),Z===47){if(!K){Q=F;break}}else K=!1;if(Q===-1)return X?"/":".";if(X&&Q===1)return"//";return U.slice(0,Q)}function xQ(U,Z){if(Z!==void 0&&typeof Z!=="string")throw TypeError('"ext" argument must be a string');CU(U);var X=0,Q=-1,K=!0,F;if(Z!==void 0&&Z.length>0&&Z.length<=U.length){if(Z.length===U.length&&Z===U)return"";var $=Z.length-1,q=-1;for(F=U.length-1;F>=0;--F){var M=U.charCodeAt(F);if(M===47){if(!K){X=F+1;break}}else{if(q===-1)K=!1,q=F+1;if($>=0)if(M===Z.charCodeAt($)){if(--$===-1)Q=F}else $=-1,Q=q}}if(X===Q)Q=q;else if(Q===-1)Q=U.length;return U.slice(X,Q)}else{for(F=U.length-1;F>=0;--F)if(U.charCodeAt(F)===47){if(!K){X=F+1;break}}else if(Q===-1)K=!1,Q=F+1;if(Q===-1)return"";return U.slice(X,Q)}}function NQ(U){CU(U);var Z=-1,X=0,Q=-1,K=!0,F=0;for(var $=U.length-1;$>=0;--$){var q=U.charCodeAt($);if(q===47){if(!K){X=$+1;break}continue}if(Q===-1)K=!1,Q=$+1;if(q===46){if(Z===-1)Z=$;else if(F!==1)F=1}else if(Z!==-1)F=-1}if(Z===-1||Q===-1||F===0||F===1&&Z===Q-1&&Z===X+1)return"";return U.slice(Z,Q)}function gQ(U){if(U===null||typeof U!=="object")throw TypeError('The "pathObject" argument must be of type Object. Received type '+typeof U);return JW("/",U)}function fQ(U){CU(U);var Z={root:"",dir:"",base:"",ext:"",name:""};if(U.length===0)return Z;var X=U.charCodeAt(0),Q=X===47,K;if(Q)Z.root="/",K=1;else K=0;var F=-1,$=0,q=-1,M=!0,z=U.length-1,T=0;for(;z>=K;--z){if(X=U.charCodeAt(z),X===47){if(!M){$=z+1;break}continue}if(q===-1)M=!1,q=z+1;if(X===46){if(F===-1)F=z;else if(T!==1)T=1}else if(F!==-1)T=-1}if(F===-1||q===-1||T===0||T===1&&F===q-1&&F===$+1){if(q!==-1)if($===0&&Q)Z.base=Z.name=U.slice(1,q);else Z.base=Z.name=U.slice($,q)}else{if($===0&&Q)Z.name=U.slice(1,F),Z.base=U.slice(1,q);else Z.name=U.slice($,F),Z.base=U.slice($,q);Z.ext=U.slice(F,q)}if($>0)Z.dir=U.slice(0,$-1);else if(Q)Z.dir="/";return Z}var wQ="/",yQ=":",cQ,QW;var TY=IZ(()=>{cQ=((U)=>(U.posix=U,U))({resolve:AX,normalize:MY,isAbsolute:kQ,join:jQ,relative:vQ,_makeLong:_Q,dirname:BQ,basename:xQ,extname:NQ,format:gQ,parse:fQ,sep:wQ,delimiter:yQ,win32:null,posix:null}),QW=cQ});var N1={};WZ(N1,{transcode:()=>lW,resolveObjectURL:()=>uW,kStringMaxLength:()=>mQ,kMaxLength:()=>vZ,isUtf8:()=>bW,isAscii:()=>dW,default:()=>oW,constants:()=>CW,btoa:()=>IW,atob:()=>FW,INSPECT_MAX_BYTES:()=>nQ,File:()=>HW,Buffer:()=>W0,Blob:()=>OW});function GW(U){var Z=U.length;if(Z%4>0)throw Error("Invalid string. Length must be a multiple of 4");var X=U.indexOf("=");if(X===-1)X=Z;var Q=X===Z?0:4-X%4;return[X,Q]}function VW(U,Z){return(U+Z)*3/4-Z}function $W(U){var Z,X=GW(U),Q=X[0],K=X[1],F=new Uint8Array(VW(Q,K)),$=0,q=K>0?Q-4:Q,M;for(M=0;M<q;M+=4)Z=KU[U.charCodeAt(M)]<<18|KU[U.charCodeAt(M+1)]<<12|KU[U.charCodeAt(M+2)]<<6|KU[U.charCodeAt(M+3)],F[$++]=Z>>16&255,F[$++]=Z>>8&255,F[$++]=Z&255;if(K===2)Z=KU[U.charCodeAt(M)]<<2|KU[U.charCodeAt(M+1)]>>4,F[$++]=Z&255;if(K===1)Z=KU[U.charCodeAt(M)]<<10|KU[U.charCodeAt(M+1)]<<4|KU[U.charCodeAt(M+2)]>>2,F[$++]=Z>>8&255,F[$++]=Z&255;return F}function KW(U){return AU[U>>18&63]+AU[U>>12&63]+AU[U>>6&63]+AU[U&63]}function WW(U,Z,X){var Q,K=[];for(var F=Z;F<X;F+=3)Q=(U[F]<<16&16711680)+(U[F+1]<<8&65280)+(U[F+2]&255),K.push(KW(Q));return K.join("")}function hQ(U){var Z,X=U.length,Q=X%3,K=[],F=16383;for(var $=0,q=X-Q;$<q;$+=F)K.push(WW(U,$,$+F>q?q:$+F));if(Q===1)Z=U[X-1],K.push(AU[Z>>2]+AU[Z<<4&63]+"==");else if(Q===2)Z=(U[X-2]<<8)+U[X-1],K.push(AU[Z>>10]+AU[Z>>4&63]+AU[Z<<2&63]+"=");return K.join("")}function zX(U,Z,X,Q,K){var F,$,q=K*8-Q-1,M=(1<<q)-1,z=M>>1,T=-7,A=X?K-1:0,L=X?-1:1,E=U[Z+A];A+=L,F=E&(1<<-T)-1,E>>=-T,T+=q;for(;T>0;F=F*256+U[Z+A],A+=L,T-=8);$=F&(1<<-T)-1,F>>=-T,T+=Q;for(;T>0;$=$*256+U[Z+A],A+=L,T-=8);if(F===0)F=1-z;else if(F===M)return $?NaN:(E?-1:1)*(1/0);else $=$+Math.pow(2,Q),F=F-z;return(E?-1:1)*$*Math.pow(2,F-Q)}function oQ(U,Z,X,Q,K,F){var $,q,M,z=F*8-K-1,T=(1<<z)-1,A=T>>1,L=K===23?Math.pow(2,-24)-Math.pow(2,-77):0,E=Q?0:F-1,S=Q?1:-1,j=Z<0||Z===0&&1/Z<0?1:0;if(Z=Math.abs(Z),isNaN(Z)||Z===1/0)q=isNaN(Z)?1:0,$=T;else{if($=Math.floor(Math.log(Z)/Math.LN2),Z*(M=Math.pow(2,-$))<1)$--,M*=2;if($+A>=1)Z+=L/M;else Z+=L*Math.pow(2,1-A);if(Z*M>=2)$++,M/=2;if($+A>=T)q=0,$=T;else if($+A>=1)q=(Z*M-1)*Math.pow(2,K),$=$+A;else q=Z*Math.pow(2,A-1)*Math.pow(2,K),$=0}for(;K>=8;U[X+E]=q&255,E+=S,q/=256,K-=8);$=$<<K|q,z+=K;for(;z>0;U[X+E]=$&255,E+=S,$/=256,z-=8);U[X+E-S]|=j*128}function SU(U){if(U>vZ)throw RangeError('The value "'+U+'" is invalid for option "size"');let Z=new Uint8Array(U);return Object.setPrototypeOf(Z,W0.prototype),Z}function jY(U,Z,X){return class extends X{constructor(){super();Object.defineProperty(this,"message",{value:Z.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${U}]`,this.stack,delete this.name}get code(){return U}set code(Q){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:Q,writable:!0})}toString(){return`${this.name} [${U}]: ${this.message}`}}}function W0(U,Z,X){if(typeof U==="number"){if(typeof Z==="string")throw TypeError('The "string" argument must be of type string. Received type number');return vY(U)}return sQ(U,Z,X)}function sQ(U,Z,X){if(typeof U==="string")return qW(U,Z);if(ArrayBuffer.isView(U))return MW(U);if(U==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof U);if(zU(U,ArrayBuffer)||U&&zU(U.buffer,ArrayBuffer))return PY(U,Z,X);if(typeof SharedArrayBuffer<"u"&&(zU(U,SharedArrayBuffer)||U&&zU(U.buffer,SharedArrayBuffer)))return PY(U,Z,X);if(typeof U==="number")throw TypeError('The "value" argument must not be of type number. Received type number');let Q=U.valueOf&&U.valueOf();if(Q!=null&&Q!==U)return W0.from(Q,Z,X);let K=LW(U);if(K)return K;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof U[Symbol.toPrimitive]==="function")return W0.from(U[Symbol.toPrimitive]("string"),Z,X);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof U)}function rQ(U){if(typeof U!=="number")throw TypeError('"size" argument must be of type number');else if(U<0)throw RangeError('The value "'+U+'" is invalid for option "size"')}function DW(U,Z,X){if(rQ(U),U<=0)return SU(U);if(Z!==void 0)return typeof X==="string"?SU(U).fill(Z,X):SU(U).fill(Z);return SU(U)}function vY(U){return rQ(U),SU(U<0?0:_Y(U)|0)}function qW(U,Z){if(typeof Z!=="string"||Z==="")Z="utf8";if(!W0.isEncoding(Z))throw TypeError("Unknown encoding: "+Z);let X=aQ(U,Z)|0,Q=SU(X),K=Q.write(U,Z);if(K!==X)Q=Q.slice(0,K);return Q}function SY(U){let Z=U.length<0?0:_Y(U.length)|0,X=SU(Z);for(let Q=0;Q<Z;Q+=1)X[Q]=U[Q]&255;return X}function MW(U){if(zU(U,Uint8Array)){let Z=new Uint8Array(U);return PY(Z.buffer,Z.byteOffset,Z.byteLength)}return SY(U)}function PY(U,Z,X){if(Z<0||U.byteLength<Z)throw RangeError('"offset" is outside of buffer bounds');if(U.byteLength<Z+(X||0))throw RangeError('"length" is outside of buffer bounds');let Q;if(Z===void 0&&X===void 0)Q=new Uint8Array(U);else if(X===void 0)Q=new Uint8Array(U,Z);else Q=new Uint8Array(U,Z,X);return Object.setPrototypeOf(Q,W0.prototype),Q}function LW(U){if(W0.isBuffer(U)){let Z=_Y(U.length)|0,X=SU(Z);if(X.length===0)return X;return U.copy(X,0,0,Z),X}if(U.length!==void 0){if(typeof U.length!=="number"||Number.isNaN(U.length))return SU(0);return SY(U)}if(U.type==="Buffer"&&Array.isArray(U.data))return SY(U.data)}function _Y(U){if(U>=vZ)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+vZ.toString(16)+" bytes");return U|0}function aQ(U,Z){if(W0.isBuffer(U))return U.length;if(ArrayBuffer.isView(U)||zU(U,ArrayBuffer))return U.byteLength;if(typeof U!=="string")throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof U);let X=U.length,Q=arguments.length>2&&arguments[2]===!0;if(!Q&&X===0)return 0;let K=!1;for(;;)switch(Z){case"ascii":case"latin1":case"binary":return X;case"utf8":case"utf-8":return kY(U).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return X*2;case"hex":return X>>>1;case"base64":return QG(U).length;default:if(K)return Q?-1:kY(U).length;Z=(""+Z).toLowerCase(),K=!0}}function TW(U,Z,X){let Q=!1;if(Z===void 0||Z<0)Z=0;if(Z>this.length)return"";if(X===void 0||X>this.length)X=this.length;if(X<=0)return"";if(X>>>=0,Z>>>=0,X<=Z)return"";if(!U)U="utf8";while(!0)switch(U){case"hex":return xW(this,Z,X);case"utf8":case"utf-8":return iQ(this,Z,X);case"ascii":return _W(this,Z,X);case"latin1":case"binary":return BW(this,Z,X);case"base64":return jW(this,Z,X);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return NW(this,Z,X);default:if(Q)throw TypeError("Unknown encoding: "+U);U=(U+"").toLowerCase(),Q=!0}}function sU(U,Z,X){let Q=U[Z];U[Z]=U[X],U[X]=Q}function tQ(U,Z,X,Q,K){if(U.length===0)return-1;if(typeof X==="string")Q=X,X=0;else if(X>2147483647)X=2147483647;else if(X<-2147483648)X=-2147483648;if(X=+X,Number.isNaN(X))X=K?0:U.length-1;if(X<0)X=U.length+X;if(X>=U.length)if(K)return-1;else X=U.length-1;else if(X<0)if(K)X=0;else return-1;if(typeof Z==="string")Z=W0.from(Z,Q);if(W0.isBuffer(Z)){if(Z.length===0)return-1;return bQ(U,Z,X,Q,K)}else if(typeof Z==="number"){if(Z=Z&255,typeof Uint8Array.prototype.indexOf==="function")if(K)return Uint8Array.prototype.indexOf.call(U,Z,X);else return Uint8Array.prototype.lastIndexOf.call(U,Z,X);return bQ(U,[Z],X,Q,K)}throw TypeError("val must be string, number or Buffer")}function bQ(U,Z,X,Q,K){let F=1,$=U.length,q=Z.length;if(Q!==void 0){if(Q=String(Q).toLowerCase(),Q==="ucs2"||Q==="ucs-2"||Q==="utf16le"||Q==="utf-16le"){if(U.length<2||Z.length<2)return-1;F=2,$/=2,q/=2,X/=2}}function M(T,A){if(F===1)return T[A];else return T.readUInt16BE(A*F)}let z;if(K){let T=-1;for(z=X;z<$;z++)if(M(U,z)===M(Z,T===-1?0:z-T)){if(T===-1)T=z;if(z-T+1===q)return T*F}else{if(T!==-1)z-=z-T;T=-1}}else{if(X+q>$)X=$-q;for(z=X;z>=0;z--){let T=!0;for(let A=0;A<q;A++)if(M(U,z+A)!==M(Z,A)){T=!1;break}if(T)return z}}return-1}function RW(U,Z,X,Q){X=Number(X)||0;let K=U.length-X;if(!Q)Q=K;else if(Q=Number(Q),Q>K)Q=K;let F=Z.length;if(Q>F/2)Q=F/2;let $;for($=0;$<Q;++$){let q=parseInt(Z.substr($*2,2),16);if(Number.isNaN(q))return $;U[X+$]=q}return $}function EW(U,Z,X,Q){return DX(kY(Z,U.length-X),U,X,Q)}function SW(U,Z,X,Q){return DX(yW(Z),U,X,Q)}function PW(U,Z,X,Q){return DX(QG(Z),U,X,Q)}function kW(U,Z,X,Q){return DX(cW(Z,U.length-X),U,X,Q)}function jW(U,Z,X){if(Z===0&&X===U.length)return hQ(U);else return hQ(U.slice(Z,X))}function iQ(U,Z,X){X=Math.min(U.length,X);let Q=[],K=Z;while(K<X){let F=U[K],$=null,q=F>239?4:F>223?3:F>191?2:1;if(K+q<=X){let M,z,T,A;switch(q){case 1:if(F<128)$=F;break;case 2:if(M=U[K+1],(M&192)===128){if(A=(F&31)<<6|M&63,A>127)$=A}break;case 3:if(M=U[K+1],z=U[K+2],(M&192)===128&&(z&192)===128){if(A=(F&15)<<12|(M&63)<<6|z&63,A>2047&&(A<55296||A>57343))$=A}break;case 4:if(M=U[K+1],z=U[K+2],T=U[K+3],(M&192)===128&&(z&192)===128&&(T&192)===128){if(A=(F&15)<<18|(M&63)<<12|(z&63)<<6|T&63,A>65535&&A<1114112)$=A}}}if($===null)$=65533,q=1;else if($>65535)$-=65536,Q.push($>>>10&1023|55296),$=56320|$&1023;Q.push($),K+=q}return vW(Q)}function vW(U){let Z=U.length;if(Z<=dQ)return String.fromCharCode.apply(String,U);let X="",Q=0;while(Q<Z)X+=String.fromCharCode.apply(String,U.slice(Q,Q+=dQ));return X}function _W(U,Z,X){let Q="";X=Math.min(U.length,X);for(let K=Z;K<X;++K)Q+=String.fromCharCode(U[K]&127);return Q}function BW(U,Z,X){let Q="";X=Math.min(U.length,X);for(let K=Z;K<X;++K)Q+=String.fromCharCode(U[K]);return Q}function xW(U,Z,X){let Q=U.length;if(!Z||Z<0)Z=0;if(!X||X<0||X>Q)X=Q;let K="";for(let F=Z;F<X;++F)K+=pW[U[F]];return K}function NW(U,Z,X){let Q=U.slice(Z,X),K="";for(let F=0;F<Q.length-1;F+=2)K+=String.fromCharCode(Q[F]+Q[F+1]*256);return K}function x1(U,Z,X){if(U%1!==0||U<0)throw RangeError("offset is not uint");if(U+Z>X)throw RangeError("Trying to access beyond buffer length")}function t1(U,Z,X,Q,K,F){if(!W0.isBuffer(U))throw TypeError('"buffer" argument must be a Buffer instance');if(Z>K||Z<F)throw RangeError('"value" argument is out of bounds');if(X+Q>U.length)throw RangeError("Index out of range")}function eQ(U,Z,X,Q,K){JG(Z,Q,K,U,X,7);let F=Number(Z&BigInt(4294967295));U[X++]=F,F=F>>8,U[X++]=F,F=F>>8,U[X++]=F,F=F>>8,U[X++]=F;let $=Number(Z>>BigInt(32)&BigInt(4294967295));return U[X++]=$,$=$>>8,U[X++]=$,$=$>>8,U[X++]=$,$=$>>8,U[X++]=$,X}function UG(U,Z,X,Q,K){JG(Z,Q,K,U,X,7);let F=Number(Z&BigInt(4294967295));U[X+7]=F,F=F>>8,U[X+6]=F,F=F>>8,U[X+5]=F,F=F>>8,U[X+4]=F;let $=Number(Z>>BigInt(32)&BigInt(4294967295));return U[X+3]=$,$=$>>8,U[X+2]=$,$=$>>8,U[X+1]=$,$=$>>8,U[X]=$,X+8}function ZG(U,Z,X,Q,K,F){if(X+Q>U.length)throw RangeError("Index out of range");if(X<0)throw RangeError("Index out of range")}function XG(U,Z,X,Q,K){if(Z=+Z,X=X>>>0,!K)ZG(U,Z,X,4,340282346638528860000000000000000000000,-340282346638528860000000000000000000000);return oQ(U,Z,X,Q,23,4),X+4}function YG(U,Z,X,Q,K){if(Z=+Z,X=X>>>0,!K)ZG(U,Z,X,8,179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);return oQ(U,Z,X,Q,52,8),X+8}function lQ(U){let Z="",X=U.length,Q=U[0]==="-"?1:0;for(;X>=Q+4;X-=3)Z=`_${U.slice(X-3,X)}${Z}`;return`${U.slice(0,X)}${Z}`}function gW(U,Z,X){if(OZ(Z,"offset"),U[Z]===void 0||U[Z+X]===void 0)_Z(Z,U.length-(X+1))}function JG(U,Z,X,Q,K,F){if(U>X||U<Z){let $=typeof Z==="bigint"?"n":"",q;if(F>3)if(Z===0||Z===BigInt(0))q=`>= 0${$} and < 2${$} ** ${(F+1)*8}${$}`;else q=`>= -(2${$} ** ${(F+1)*8-1}${$}) and < 2 ** ${(F+1)*8-1}${$}`;else q=`>= ${Z}${$} and <= ${X}${$}`;throw new EY("value",q,U)}gW(Q,K,F)}function OZ(U,Z){if(typeof U!=="number")throw new zW(Z,"number",U)}function _Z(U,Z,X){if(Math.floor(U)!==U)throw OZ(U,X),new EY(X||"offset","an integer",U);if(Z<0)throw new AW;throw new EY(X||"offset",`>= ${X?1:0} and <= ${Z}`,U)}function wW(U){if(U=U.split("=")[0],U=U.trim().replace(fW,""),U.length<2)return"";while(U.length%4!==0)U=U+"=";return U}function kY(U,Z){Z=Z||1/0;let X,Q=U.length,K=null,F=[];for(let $=0;$<Q;++$){if(X=U.charCodeAt($),X>55295&&X<57344){if(!K){if(X>56319){if((Z-=3)>-1)F.push(239,191,189);continue}else if($+1===Q){if((Z-=3)>-1)F.push(239,191,189);continue}K=X;continue}if(X<56320){if((Z-=3)>-1)F.push(239,191,189);K=X;continue}X=(K-55296<<10|X-56320)+65536}else if(K){if((Z-=3)>-1)F.push(239,191,189)}if(K=null,X<128){if((Z-=1)<0)break;F.push(X)}else if(X<2048){if((Z-=2)<0)break;F.push(X>>6|192,X&63|128)}else if(X<65536){if((Z-=3)<0)break;F.push(X>>12|224,X>>6&63|128,X&63|128)}else if(X<1114112){if((Z-=4)<0)break;F.push(X>>18|240,X>>12&63|128,X>>6&63|128,X&63|128)}else throw Error("Invalid code point")}return F}function yW(U){let Z=[];for(let X=0;X<U.length;++X)Z.push(U.charCodeAt(X)&255);return Z}function cW(U,Z){let X,Q,K,F=[];for(let $=0;$<U.length;++$){if((Z-=2)<0)break;X=U.charCodeAt($),Q=X>>8,K=X%256,F.push(K),F.push(Q)}return F}function QG(U){return $W(wW(U))}function DX(U,Z,X,Q){let K;for(K=0;K<Q;++K){if(K+X>=Z.length||K>=U.length)break;Z[K+X]=U[K]}return K}function zU(U,Z){return U instanceof Z||U!=null&&U.constructor!=null&&U.constructor.name!=null&&U.constructor.name===Z.name}function fU(U){return typeof BigInt>"u"?hW:U}function hW(){throw Error("BigInt not supported")}function BY(U){return()=>{throw Error(U+" is not implemented for node:buffer browser polyfill")}}var AU,KU,RY="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",mU,pQ,uQ,nQ=50,vZ=2147483647,mQ=536870888,IW,FW,HW,OW,CW,AW,zW,EY,dQ=4096,fW,pW,uW,bW,dW=(U)=>{for(let Z of U)if(Z.charCodeAt(0)>127)return!1;return!0},lW,oW;var g1=IZ(()=>{AU=[],KU=[];for(mU=0,pQ=RY.length;mU<pQ;++mU)AU[mU]=RY[mU],KU[RY.charCodeAt(mU)]=mU;KU[45]=62;KU[95]=63;uQ=typeof Symbol==="function"&&typeof Symbol.for==="function"?Symbol.for("nodejs.util.inspect.custom"):null,IW=globalThis.btoa,FW=globalThis.atob,HW=globalThis.File,OW=globalThis.Blob,CW={MAX_LENGTH:vZ,MAX_STRING_LENGTH:mQ};AW=jY("ERR_BUFFER_OUT_OF_BOUNDS",function(U){if(U)return`${U} is outside of buffer bounds`;return"Attempt to access memory outside buffer bounds"},RangeError),zW=jY("ERR_INVALID_ARG_TYPE",function(U,Z){return`The "${U}" argument must be of type number. Received type ${typeof Z}`},TypeError),EY=jY("ERR_OUT_OF_RANGE",function(U,Z,X){let Q=`The value of "${U}" is out of range.`,K=X;if(Number.isInteger(X)&&Math.abs(X)>4294967296)K=lQ(String(X));else if(typeof X==="bigint"){if(K=String(X),X>BigInt(2)**BigInt(32)||X<-(BigInt(2)**BigInt(32)))K=lQ(K);K+="n"}return Q+=` It must be ${Z}. Received ${K}`,Q},RangeError);Object.defineProperty(W0.prototype,"parent",{enumerable:!0,get:function(){if(!W0.isBuffer(this))return;return this.buffer}});Object.defineProperty(W0.prototype,"offset",{enumerable:!0,get:function(){if(!W0.isBuffer(this))return;return this.byteOffset}});W0.poolSize=8192;W0.from=function(U,Z,X){return sQ(U,Z,X)};Object.setPrototypeOf(W0.prototype,Uint8Array.prototype);Object.setPrototypeOf(W0,Uint8Array);W0.alloc=function(U,Z,X){return DW(U,Z,X)};W0.allocUnsafe=function(U){return vY(U)};W0.allocUnsafeSlow=function(U){return vY(U)};W0.isBuffer=function(U){return U!=null&&U._isBuffer===!0&&U!==W0.prototype};W0.compare=function(U,Z){if(zU(U,Uint8Array))U=W0.from(U,U.offset,U.byteLength);if(zU(Z,Uint8Array))Z=W0.from(Z,Z.offset,Z.byteLength);if(!W0.isBuffer(U)||!W0.isBuffer(Z))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(U===Z)return 0;let X=U.length,Q=Z.length;for(let K=0,F=Math.min(X,Q);K<F;++K)if(U[K]!==Z[K]){X=U[K],Q=Z[K];break}if(X<Q)return-1;if(Q<X)return 1;return 0};W0.isEncoding=function(U){switch(String(U).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}};W0.concat=function(U,Z){if(!Array.isArray(U))throw TypeError('"list" argument must be an Array of Buffers');if(U.length===0)return W0.alloc(0);let X;if(Z===void 0){Z=0;for(X=0;X<U.length;++X)Z+=U[X].length}let Q=W0.allocUnsafe(Z),K=0;for(X=0;X<U.length;++X){let F=U[X];if(zU(F,Uint8Array))if(K+F.length>Q.length){if(!W0.isBuffer(F))F=W0.from(F);F.copy(Q,K)}else Uint8Array.prototype.set.call(Q,F,K);else if(!W0.isBuffer(F))throw TypeError('"list" argument must be an Array of Buffers');else F.copy(Q,K);K+=F.length}return Q};W0.byteLength=aQ;W0.prototype._isBuffer=!0;W0.prototype.swap16=function(){let U=this.length;if(U%2!==0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let Z=0;Z<U;Z+=2)sU(this,Z,Z+1);return this};W0.prototype.swap32=function(){let U=this.length;if(U%4!==0)throw RangeError("Buffer size must be a multiple of 32-bits");for(let Z=0;Z<U;Z+=4)sU(this,Z,Z+3),sU(this,Z+1,Z+2);return this};W0.prototype.swap64=function(){let U=this.length;if(U%8!==0)throw RangeError("Buffer size must be a multiple of 64-bits");for(let Z=0;Z<U;Z+=8)sU(this,Z,Z+7),sU(this,Z+1,Z+6),sU(this,Z+2,Z+5),sU(this,Z+3,Z+4);return this};W0.prototype.toString=function(){let U=this.length;if(U===0)return"";if(arguments.length===0)return iQ(this,0,U);return TW.apply(this,arguments)};W0.prototype.toLocaleString=W0.prototype.toString;W0.prototype.equals=function(U){if(!W0.isBuffer(U))throw TypeError("Argument must be a Buffer");if(this===U)return!0;return W0.compare(this,U)===0};W0.prototype.inspect=function(){let U="",Z=nQ;if(U=this.toString("hex",0,Z).replace(/(.{2})/g,"$1 ").trim(),this.length>Z)U+=" ... ";return"<Buffer "+U+">"};if(uQ)W0.prototype[uQ]=W0.prototype.inspect;W0.prototype.compare=function(U,Z,X,Q,K){if(zU(U,Uint8Array))U=W0.from(U,U.offset,U.byteLength);if(!W0.isBuffer(U))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof U);if(Z===void 0)Z=0;if(X===void 0)X=U?U.length:0;if(Q===void 0)Q=0;if(K===void 0)K=this.length;if(Z<0||X>U.length||Q<0||K>this.length)throw RangeError("out of range index");if(Q>=K&&Z>=X)return 0;if(Q>=K)return-1;if(Z>=X)return 1;if(Z>>>=0,X>>>=0,Q>>>=0,K>>>=0,this===U)return 0;let F=K-Q,$=X-Z,q=Math.min(F,$),M=this.slice(Q,K),z=U.slice(Z,X);for(let T=0;T<q;++T)if(M[T]!==z[T]){F=M[T],$=z[T];break}if(F<$)return-1;if($<F)return 1;return 0};W0.prototype.includes=function(U,Z,X){return this.indexOf(U,Z,X)!==-1};W0.prototype.indexOf=function(U,Z,X){return tQ(this,U,Z,X,!0)};W0.prototype.lastIndexOf=function(U,Z,X){return tQ(this,U,Z,X,!1)};W0.prototype.write=function(U,Z,X,Q){if(Z===void 0)Q="utf8",X=this.length,Z=0;else if(X===void 0&&typeof Z==="string")Q=Z,X=this.length,Z=0;else if(isFinite(Z))if(Z=Z>>>0,isFinite(X)){if(X=X>>>0,Q===void 0)Q="utf8"}else Q=X,X=void 0;else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let K=this.length-Z;if(X===void 0||X>K)X=K;if(U.length>0&&(X<0||Z<0)||Z>this.length)throw RangeError("Attempt to write outside buffer bounds");if(!Q)Q="utf8";let F=!1;for(;;)switch(Q){case"hex":return RW(this,U,Z,X);case"utf8":case"utf-8":return EW(this,U,Z,X);case"ascii":case"latin1":case"binary":return SW(this,U,Z,X);case"base64":return PW(this,U,Z,X);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return kW(this,U,Z,X);default:if(F)throw TypeError("Unknown encoding: "+Q);Q=(""+Q).toLowerCase(),F=!0}};W0.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};W0.prototype.slice=function(U,Z){let X=this.length;if(U=~~U,Z=Z===void 0?X:~~Z,U<0){if(U+=X,U<0)U=0}else if(U>X)U=X;if(Z<0){if(Z+=X,Z<0)Z=0}else if(Z>X)Z=X;if(Z<U)Z=U;let Q=this.subarray(U,Z);return Object.setPrototypeOf(Q,W0.prototype),Q};W0.prototype.readUintLE=W0.prototype.readUIntLE=function(U,Z,X){if(U=U>>>0,Z=Z>>>0,!X)x1(U,Z,this.length);let Q=this[U],K=1,F=0;while(++F<Z&&(K*=256))Q+=this[U+F]*K;return Q};W0.prototype.readUintBE=W0.prototype.readUIntBE=function(U,Z,X){if(U=U>>>0,Z=Z>>>0,!X)x1(U,Z,this.length);let Q=this[U+--Z],K=1;while(Z>0&&(K*=256))Q+=this[U+--Z]*K;return Q};W0.prototype.readUint8=W0.prototype.readUInt8=function(U,Z){if(U=U>>>0,!Z)x1(U,1,this.length);return this[U]};W0.prototype.readUint16LE=W0.prototype.readUInt16LE=function(U,Z){if(U=U>>>0,!Z)x1(U,2,this.length);return this[U]|this[U+1]<<8};W0.prototype.readUint16BE=W0.prototype.readUInt16BE=function(U,Z){if(U=U>>>0,!Z)x1(U,2,this.length);return this[U]<<8|this[U+1]};W0.prototype.readUint32LE=W0.prototype.readUInt32LE=function(U,Z){if(U=U>>>0,!Z)x1(U,4,this.length);return(this[U]|this[U+1]<<8|this[U+2]<<16)+this[U+3]*16777216};W0.prototype.readUint32BE=W0.prototype.readUInt32BE=function(U,Z){if(U=U>>>0,!Z)x1(U,4,this.length);return this[U]*16777216+(this[U+1]<<16|this[U+2]<<8|this[U+3])};W0.prototype.readBigUInt64LE=fU(function(U){U=U>>>0,OZ(U,"offset");let Z=this[U],X=this[U+7];if(Z===void 0||X===void 0)_Z(U,this.length-8);let Q=Z+this[++U]*256+this[++U]*65536+this[++U]*16777216,K=this[++U]+this[++U]*256+this[++U]*65536+X*16777216;return BigInt(Q)+(BigInt(K)<<BigInt(32))});W0.prototype.readBigUInt64BE=fU(function(U){U=U>>>0,OZ(U,"offset");let Z=this[U],X=this[U+7];if(Z===void 0||X===void 0)_Z(U,this.length-8);let Q=Z*16777216+this[++U]*65536+this[++U]*256+this[++U],K=this[++U]*16777216+this[++U]*65536+this[++U]*256+X;return(BigInt(Q)<<BigInt(32))+BigInt(K)});W0.prototype.readIntLE=function(U,Z,X){if(U=U>>>0,Z=Z>>>0,!X)x1(U,Z,this.length);let Q=this[U],K=1,F=0;while(++F<Z&&(K*=256))Q+=this[U+F]*K;if(K*=128,Q>=K)Q-=Math.pow(2,8*Z);return Q};W0.prototype.readIntBE=function(U,Z,X){if(U=U>>>0,Z=Z>>>0,!X)x1(U,Z,this.length);let Q=Z,K=1,F=this[U+--Q];while(Q>0&&(K*=256))F+=this[U+--Q]*K;if(K*=128,F>=K)F-=Math.pow(2,8*Z);return F};W0.prototype.readInt8=function(U,Z){if(U=U>>>0,!Z)x1(U,1,this.length);if(!(this[U]&128))return this[U];return(255-this[U]+1)*-1};W0.prototype.readInt16LE=function(U,Z){if(U=U>>>0,!Z)x1(U,2,this.length);let X=this[U]|this[U+1]<<8;return X&32768?X|4294901760:X};W0.prototype.readInt16BE=function(U,Z){if(U=U>>>0,!Z)x1(U,2,this.length);let X=this[U+1]|this[U]<<8;return X&32768?X|4294901760:X};W0.prototype.readInt32LE=function(U,Z){if(U=U>>>0,!Z)x1(U,4,this.length);return this[U]|this[U+1]<<8|this[U+2]<<16|this[U+3]<<24};W0.prototype.readInt32BE=function(U,Z){if(U=U>>>0,!Z)x1(U,4,this.length);return this[U]<<24|this[U+1]<<16|this[U+2]<<8|this[U+3]};W0.prototype.readBigInt64LE=fU(function(U){U=U>>>0,OZ(U,"offset");let Z=this[U],X=this[U+7];if(Z===void 0||X===void 0)_Z(U,this.length-8);let Q=this[U+4]+this[U+5]*256+this[U+6]*65536+(X<<24);return(BigInt(Q)<<BigInt(32))+BigInt(Z+this[++U]*256+this[++U]*65536+this[++U]*16777216)});W0.prototype.readBigInt64BE=fU(function(U){U=U>>>0,OZ(U,"offset");let Z=this[U],X=this[U+7];if(Z===void 0||X===void 0)_Z(U,this.length-8);let Q=(Z<<24)+this[++U]*65536+this[++U]*256+this[++U];return(BigInt(Q)<<BigInt(32))+BigInt(this[++U]*16777216+this[++U]*65536+this[++U]*256+X)});W0.prototype.readFloatLE=function(U,Z){if(U=U>>>0,!Z)x1(U,4,this.length);return zX(this,U,!0,23,4)};W0.prototype.readFloatBE=function(U,Z){if(U=U>>>0,!Z)x1(U,4,this.length);return zX(this,U,!1,23,4)};W0.prototype.readDoubleLE=function(U,Z){if(U=U>>>0,!Z)x1(U,8,this.length);return zX(this,U,!0,52,8)};W0.prototype.readDoubleBE=function(U,Z){if(U=U>>>0,!Z)x1(U,8,this.length);return zX(this,U,!1,52,8)};W0.prototype.writeUintLE=W0.prototype.writeUIntLE=function(U,Z,X,Q){if(U=+U,Z=Z>>>0,X=X>>>0,!Q){let $=Math.pow(2,8*X)-1;t1(this,U,Z,X,$,0)}let K=1,F=0;this[Z]=U&255;while(++F<X&&(K*=256))this[Z+F]=U/K&255;return Z+X};W0.prototype.writeUintBE=W0.prototype.writeUIntBE=function(U,Z,X,Q){if(U=+U,Z=Z>>>0,X=X>>>0,!Q){let $=Math.pow(2,8*X)-1;t1(this,U,Z,X,$,0)}let K=X-1,F=1;this[Z+K]=U&255;while(--K>=0&&(F*=256))this[Z+K]=U/F&255;return Z+X};W0.prototype.writeUint8=W0.prototype.writeUInt8=function(U,Z,X){if(U=+U,Z=Z>>>0,!X)t1(this,U,Z,1,255,0);return this[Z]=U&255,Z+1};W0.prototype.writeUint16LE=W0.prototype.writeUInt16LE=function(U,Z,X){if(U=+U,Z=Z>>>0,!X)t1(this,U,Z,2,65535,0);return this[Z]=U&255,this[Z+1]=U>>>8,Z+2};W0.prototype.writeUint16BE=W0.prototype.writeUInt16BE=function(U,Z,X){if(U=+U,Z=Z>>>0,!X)t1(this,U,Z,2,65535,0);return this[Z]=U>>>8,this[Z+1]=U&255,Z+2};W0.prototype.writeUint32LE=W0.prototype.writeUInt32LE=function(U,Z,X){if(U=+U,Z=Z>>>0,!X)t1(this,U,Z,4,4294967295,0);return this[Z+3]=U>>>24,this[Z+2]=U>>>16,this[Z+1]=U>>>8,this[Z]=U&255,Z+4};W0.prototype.writeUint32BE=W0.prototype.writeUInt32BE=function(U,Z,X){if(U=+U,Z=Z>>>0,!X)t1(this,U,Z,4,4294967295,0);return this[Z]=U>>>24,this[Z+1]=U>>>16,this[Z+2]=U>>>8,this[Z+3]=U&255,Z+4};W0.prototype.writeBigUInt64LE=fU(function(U,Z=0){return eQ(this,U,Z,BigInt(0),BigInt("0xffffffffffffffff"))});W0.prototype.writeBigUInt64BE=fU(function(U,Z=0){return UG(this,U,Z,BigInt(0),BigInt("0xffffffffffffffff"))});W0.prototype.writeIntLE=function(U,Z,X,Q){if(U=+U,Z=Z>>>0,!Q){let q=Math.pow(2,8*X-1);t1(this,U,Z,X,q-1,-q)}let K=0,F=1,$=0;this[Z]=U&255;while(++K<X&&(F*=256)){if(U<0&&$===0&&this[Z+K-1]!==0)$=1;this[Z+K]=(U/F>>0)-$&255}return Z+X};W0.prototype.writeIntBE=function(U,Z,X,Q){if(U=+U,Z=Z>>>0,!Q){let q=Math.pow(2,8*X-1);t1(this,U,Z,X,q-1,-q)}let K=X-1,F=1,$=0;this[Z+K]=U&255;while(--K>=0&&(F*=256)){if(U<0&&$===0&&this[Z+K+1]!==0)$=1;this[Z+K]=(U/F>>0)-$&255}return Z+X};W0.prototype.writeInt8=function(U,Z,X){if(U=+U,Z=Z>>>0,!X)t1(this,U,Z,1,127,-128);if(U<0)U=255+U+1;return this[Z]=U&255,Z+1};W0.prototype.writeInt16LE=function(U,Z,X){if(U=+U,Z=Z>>>0,!X)t1(this,U,Z,2,32767,-32768);return this[Z]=U&255,this[Z+1]=U>>>8,Z+2};W0.prototype.writeInt16BE=function(U,Z,X){if(U=+U,Z=Z>>>0,!X)t1(this,U,Z,2,32767,-32768);return this[Z]=U>>>8,this[Z+1]=U&255,Z+2};W0.prototype.writeInt32LE=function(U,Z,X){if(U=+U,Z=Z>>>0,!X)t1(this,U,Z,4,2147483647,-2147483648);return this[Z]=U&255,this[Z+1]=U>>>8,this[Z+2]=U>>>16,this[Z+3]=U>>>24,Z+4};W0.prototype.writeInt32BE=function(U,Z,X){if(U=+U,Z=Z>>>0,!X)t1(this,U,Z,4,2147483647,-2147483648);if(U<0)U=4294967295+U+1;return this[Z]=U>>>24,this[Z+1]=U>>>16,this[Z+2]=U>>>8,this[Z+3]=U&255,Z+4};W0.prototype.writeBigInt64LE=fU(function(U,Z=0){return eQ(this,U,Z,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});W0.prototype.writeBigInt64BE=fU(function(U,Z=0){return UG(this,U,Z,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});W0.prototype.writeFloatLE=function(U,Z,X){return XG(this,U,Z,!0,X)};W0.prototype.writeFloatBE=function(U,Z,X){return XG(this,U,Z,!1,X)};W0.prototype.writeDoubleLE=function(U,Z,X){return YG(this,U,Z,!0,X)};W0.prototype.writeDoubleBE=function(U,Z,X){return YG(this,U,Z,!1,X)};W0.prototype.copy=function(U,Z,X,Q){if(!W0.isBuffer(U))throw TypeError("argument should be a Buffer");if(!X)X=0;if(!Q&&Q!==0)Q=this.length;if(Z>=U.length)Z=U.length;if(!Z)Z=0;if(Q>0&&Q<X)Q=X;if(Q===X)return 0;if(U.length===0||this.length===0)return 0;if(Z<0)throw RangeError("targetStart out of bounds");if(X<0||X>=this.length)throw RangeError("Index out of range");if(Q<0)throw RangeError("sourceEnd out of bounds");if(Q>this.length)Q=this.length;if(U.length-Z<Q-X)Q=U.length-Z+X;let K=Q-X;if(this===U&&typeof Uint8Array.prototype.copyWithin==="function")this.copyWithin(Z,X,Q);else Uint8Array.prototype.set.call(U,this.subarray(X,Q),Z);return K};W0.prototype.fill=function(U,Z,X,Q){if(typeof U==="string"){if(typeof Z==="string")Q=Z,Z=0,X=this.length;else if(typeof X==="string")Q=X,X=this.length;if(Q!==void 0&&typeof Q!=="string")throw TypeError("encoding must be a string");if(typeof Q==="string"&&!W0.isEncoding(Q))throw TypeError("Unknown encoding: "+Q);if(U.length===1){let F=U.charCodeAt(0);if(Q==="utf8"&&F<128||Q==="latin1")U=F}}else if(typeof U==="number")U=U&255;else if(typeof U==="boolean")U=Number(U);if(Z<0||this.length<Z||this.length<X)throw RangeError("Out of range index");if(X<=Z)return this;if(Z=Z>>>0,X=X===void 0?this.length:X>>>0,!U)U=0;let K;if(typeof U==="number")for(K=Z;K<X;++K)this[K]=U;else{let F=W0.isBuffer(U)?U:W0.from(U,Q),$=F.length;if($===0)throw TypeError('The value "'+U+'" is invalid for argument "value"');for(K=0;K<X-Z;++K)this[K+Z]=F[K%$]}return this};fW=/[^+/0-9A-Za-z-_]/g;pW=function(){let U=Array(256);for(let Z=0;Z<16;++Z){let X=Z*16;for(let Q=0;Q<16;++Q)U[X+Q]="0123456789abcdef"[Z]+"0123456789abcdef"[Q]}return U}();uW=BY("resolveObjectURL"),bW=BY("isUtf8"),lW=BY("transcode"),oW=W0});var CG={};WZ(CG,{types:()=>ZI,promisify:()=>IG,log:()=>$G,isUndefined:()=>CZ,isSymbol:()=>YI,isString:()=>EX,isRegExp:()=>qX,isPrimitive:()=>JI,isObject:()=>AZ,isNumber:()=>VG,isNullOrUndefined:()=>XI,isNull:()=>RX,isFunction:()=>LX,isError:()=>MX,isDate:()=>fY,isBuffer:()=>QI,isBoolean:()=>yY,isArray:()=>GG,inspect:()=>rU,inherits:()=>KG,format:()=>wY,deprecate:()=>mW,default:()=>$I,debuglog:()=>sW,callbackifyOnRejected:()=>hY,callbackify:()=>FG,_extend:()=>pY,TextEncoder:()=>HG,TextDecoder:()=>OG});function wY(U,...Z){if(!EX(U)){var X=[U];for(var Q=0;Q<Z.length;Q++)X.push(rU(Z[Q]));return X.join(" ")}var Q=0,K=Z.length,F=String(U).replace(nW,function(q){if(q==="%%")return"%";if(Q>=K)return q;switch(q){case"%s":return String(Z[Q++]);case"%d":return Number(Z[Q++]);case"%j":try{return JSON.stringify(Z[Q++])}catch(M){return"[Circular]"}default:return q}});for(var $=Z[Q];Q<K;$=Z[++Q])if(RX($)||!AZ($))F+=" "+$;else F+=" "+rU($);return F}function mW(U,Z){if(typeof process>"u"||process?.noDeprecation===!0)return U;var X=!1;function Q(...K){if(!X){if(process.throwDeprecation)throw Error(Z);else if(process.traceDeprecation)console.trace(Z);else console.error(Z);X=!0}return U.apply(this,...K)}return Q}function rW(U,Z){var X=rU.styles[Z];if(X)return"\x1B["+rU.colors[X][0]+"m"+U+"\x1B["+rU.colors[X][1]+"m";else return U}function aW(U,Z){return U}function tW(U){var Z={};return U.forEach(function(X,Q){Z[X]=!0}),Z}function TX(U,Z,X){if(U.customInspect&&Z&&LX(Z.inspect)&&Z.inspect!==rU&&!(Z.constructor&&Z.constructor.prototype===Z)){var Q=Z.inspect(X,U);if(!EX(Q))Q=TX(U,Q,X);return Q}var K=iW(U,Z);if(K)return K;var F=Object.keys(Z),$=tW(F);if(U.showHidden)F=Object.getOwnPropertyNames(Z);if(MX(Z)&&(F.indexOf("message")>=0||F.indexOf("description")>=0))return xY(Z);if(F.length===0){if(LX(Z)){var q=Z.name?": "+Z.name:"";return U.stylize("[Function"+q+"]","special")}if(qX(Z))return U.stylize(RegExp.prototype.toString.call(Z),"regexp");if(fY(Z))return U.stylize(Date.prototype.toString.call(Z),"date");if(MX(Z))return xY(Z)}var M="",z=!1,T=["{","}"];if(GG(Z))z=!0,T=["[","]"];if(LX(Z)){var A=Z.name?": "+Z.name:"";M=" [Function"+A+"]"}if(qX(Z))M=" "+RegExp.prototype.toString.call(Z);if(fY(Z))M=" "+Date.prototype.toUTCString.call(Z);if(MX(Z))M=" "+xY(Z);if(F.length===0&&(!z||Z.length==0))return T[0]+M+T[1];if(X<0)if(qX(Z))return U.stylize(RegExp.prototype.toString.call(Z),"regexp");else return U.stylize("[Object]","special");U.seen.push(Z);var L;if(z)L=eW(U,Z,X,$,F);else L=F.map(function(E){return gY(U,Z,X,$,E,z)});return U.seen.pop(),UI(L,M,T)}function iW(U,Z){if(CZ(Z))return U.stylize("undefined","undefined");if(EX(Z)){var X="'"+JSON.stringify(Z).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return U.stylize(X,"string")}if(VG(Z))return U.stylize(""+Z,"number");if(yY(Z))return U.stylize(""+Z,"boolean");if(RX(Z))return U.stylize("null","null")}function xY(U){return"["+Error.prototype.toString.call(U)+"]"}function eW(U,Z,X,Q,K){var F=[];for(var $=0,q=Z.length;$<q;++$)if(WG(Z,String($)))F.push(gY(U,Z,X,Q,String($),!0));else F.push("");return K.forEach(function(M){if(!M.match(/^\d+$/))F.push(gY(U,Z,X,Q,M,!0))}),F}function gY(U,Z,X,Q,K,F){var $,q,M;if(M=Object.getOwnPropertyDescriptor(Z,K)||{value:Z[K]},M.get)if(M.set)q=U.stylize("[Getter/Setter]","special");else q=U.stylize("[Getter]","special");else if(M.set)q=U.stylize("[Setter]","special");if(!WG(Q,K))$="["+K+"]";if(!q)if(U.seen.indexOf(M.value)<0){if(RX(X))q=TX(U,M.value,null);else q=TX(U,M.value,X-1);if(q.indexOf(`
|
|
3
|
+
`)>-1)if(F)q=q.split(`
|
|
4
4
|
`).map(function(z){return" "+z}).join(`
|
|
5
|
-
`).slice(2);else
|
|
6
|
-
`+
|
|
5
|
+
`).slice(2);else q=`
|
|
6
|
+
`+q.split(`
|
|
7
7
|
`).map(function(z){return" "+z}).join(`
|
|
8
|
-
`)}else
|
|
9
|
-
`)>=0)Q++;return
|
|
8
|
+
`)}else q=U.stylize("[Circular]","special");if(CZ($)){if(F&&K.match(/^\d+$/))return q;if($=JSON.stringify(""+K),$.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/))$=$.slice(1,-1),$=U.stylize($,"name");else $=$.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),$=U.stylize($,"string")}return $+": "+q}function UI(U,Z,X){var Q=0,K=U.reduce(function(F,$){if(Q++,$.indexOf(`
|
|
9
|
+
`)>=0)Q++;return F+$.replace(/\u001b\[\d\d?m/g,"").length+1},0);if(K>60)return X[0]+(Z===""?"":Z+`
|
|
10
10
|
`)+" "+U.join(`,
|
|
11
|
-
`)+" "+X[1];return X[0]+Z+" "+U.join(", ")+" "+X[1]}function GG(U){return Array.isArray(U)}function yY(U){return typeof U==="boolean"}function RX(U){return U===null}function XI(U){return U==null}function VG(U){return typeof U==="number"}function EX(U){return typeof U==="string"}function YI(U){return typeof U==="symbol"}function CZ(U){return U===void 0}function MX(U){return AZ(U)&&cY(U)==="[object RegExp]"}function AZ(U){return typeof U==="object"&&U!==null}function fY(U){return AZ(U)&&cY(U)==="[object Date]"}function qX(U){return AZ(U)&&(cY(U)==="[object Error]"||U instanceof Error)}function LX(U){return typeof U==="function"}function JI(U){return U===null||typeof U==="boolean"||typeof U==="number"||typeof U==="string"||typeof U==="symbol"||typeof U>"u"}function QI(U){return U instanceof Buffer}function cY(U){return Object.prototype.toString.call(U)}function NY(U){return U<10?"0"+U.toString(10):U.toString(10)}function VI(){var U=new Date,Z=[NY(U.getHours()),NY(U.getMinutes()),NY(U.getSeconds())].join(":");return[U.getDate(),GI[U.getMonth()],Z].join(" ")}function $G(...U){console.log("%s - %s",VI(),wY.apply(null,U))}function KG(U,Z){if(Z)U.super_=Z,U.prototype=Object.create(Z.prototype,{constructor:{value:U,enumerable:!1,writable:!0,configurable:!0}})}function pY(U,Z){if(!Z||!AZ(Z))return U;var X=Object.keys(Z),Q=X.length;while(Q--)U[X[Q]]=Z[X[Q]];return U}function WG(U,Z){return Object.prototype.hasOwnProperty.call(U,Z)}function hY(U,Z){if(!U){var X=Error("Promise was rejected with a falsy value");X.reason=U,U=X}return Z(U)}function HG(U){if(typeof U!=="function")throw TypeError('The "original" argument must be of type Function');function Z(...X){var Q=X.pop();if(typeof Q!=="function")throw TypeError("The last argument must be of type Function");var K=this,H=function(...$){return Q.apply(K,...$)};U.apply(this,X).then(function($){process.nextTick(H.bind(null,null,$))},function($){process.nextTick(hY.bind(null,$,H))})}return Object.setPrototypeOf(Z,Object.getPrototypeOf(U)),Object.defineProperties(Z,Object.getOwnPropertyDescriptors(U)),Z}var nW,sW,rU,ZI=()=>{},GI,IG,FG,OG,$I;var AG=IZ(()=>{nW=/%[sdj%]/g;sW=((U={},Z={},X)=>((X=typeof process<"u"&&!1)&&(X=X.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase()),Z=new RegExp("^"+X+"$","i"),(Q)=>{if(Q=Q.toUpperCase(),!U[Q])if(Z.test(Q))U[Q]=function(...K){console.error("%s: %s",Q,pid,wY.apply(null,...K))};else U[Q]=function(){};return U[Q]}))(),rU=((U)=>(U.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},U.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},U.custom=Symbol.for("nodejs.util.inspect.custom"),U))(function(U,Z,...X){var Q={seen:[],stylize:aW};if(X.length>=1)Q.depth=X[0];if(X.length>=2)Q.colors=X[1];if(yY(Z))Q.showHidden=Z;else if(Z)pY(Q,Z);if(CZ(Q.showHidden))Q.showHidden=!1;if(CZ(Q.depth))Q.depth=2;if(CZ(Q.colors))Q.colors=!1;if(Q.colors)Q.stylize=rW;return TX(Q,U,Q.depth)});GI=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];IG=((U)=>(U.custom=Symbol.for("nodejs.util.promisify.custom"),U))(function(U){if(typeof U!=="function")throw TypeError('The "original" argument must be of type Function');if(kCustomPromisifiedSymbol&&U[kCustomPromisifiedSymbol]){var Z=U[kCustomPromisifiedSymbol];if(typeof Z!=="function")throw TypeError('The "nodejs.util.promisify.custom" argument must be of type Function');return Object.defineProperty(Z,kCustomPromisifiedSymbol,{value:Z,enumerable:!1,writable:!1,configurable:!0}),Z}function Z(...X){var Q,K,H=new Promise(function($,M){Q=$,K=M});X.push(function($,M){if($)K($);else Q(M)});try{U.apply(this,X)}catch($){K($)}return H}if(Object.setPrototypeOf(Z,Object.getPrototypeOf(U)),kCustomPromisifiedSymbol)Object.defineProperty(Z,kCustomPromisifiedSymbol,{value:Z,enumerable:!1,writable:!1,configurable:!0});return Object.defineProperties(Z,Object.getOwnPropertyDescriptors(U))});({TextEncoder:FG,TextDecoder:OG}=globalThis),$I={TextEncoder:FG,TextDecoder:OG,promisify:IG,log:$G,inherits:KG,_extend:pY,callbackifyOnRejected:hY,callbackify:HG}});var xZ={};WZ(xZ,{setMaxListeners:()=>kG,once:()=>SG,listenerCount:()=>jG,init:()=>wU,getMaxListeners:()=>_G,getEventListeners:()=>PG,default:()=>zI,captureRejectionSymbol:()=>LG,addAbortListener:()=>BG,EventEmitter:()=>wU});function TG(U,Z){var{_events:X}=U;if(Z[0]??=Error("Unhandled error."),!X)throw Z[0];var Q=X[qG];if(Q)for(var K of DG.call(Q))K.apply(U,Z);var H=X.error;if(!H)throw Z[0];for(var K of DG.call(H))K.apply(U,Z);return!0}function II(U,Z,X,Q){Z.then(void 0,function(K){queueMicrotask(()=>HI(U,K,X,Q))})}function HI(U,Z,X,Q){if(typeof U[zG]==="function")U[zG](Z,X,...Q);else try{U[aU]=!1,U.emit("error",Z)}finally{U[aU]=!0}}function RG(U,Z,X){X.warned=!0;let Q=Error(`Possible EventEmitter memory leak detected. ${X.length} ${String(Z)} listeners added to [${U.constructor.name}]. Use emitter.setMaxListeners() to increase limit`);Q.name="MaxListenersExceededWarning",Q.emitter=U,Q.type=Z,Q.count=X.length,console.warn(Q)}function EG(U,Z,...X){this.removeListener(U,Z),Z.apply(this,X)}function SG(U,Z,X){var Q=X?.signal;if(vG(Q,"options.signal"),Q?.aborted)throw new uY(void 0,{cause:Q?.reason});let{resolve:K,reject:H,promise:$}=$newPromiseCapability(Promise),M=(T)=>{if(U.removeListener(Z,q),Q!=null)SX(Q,"abort",z);H(T)},q=(...T)=>{if(typeof U.removeListener==="function")U.removeListener("error",M);if(Q!=null)SX(Q,"abort",z);K(T)};if(MG(U,Z,q,{once:!0}),Z!=="error"&&typeof U.once==="function")U.once("error",M);function z(){SX(U,Z,q),SX(U,"error",M),H(new uY(void 0,{cause:Q?.reason}))}if(Q!=null)MG(Q,"abort",z,{once:!0});return $}function PG(U,Z){return U.listeners(Z)}function kG(U,...Z){dY(U,"setMaxListeners",0);var X;if(Z&&(X=Z.length))for(let Q=0;Q<X;Q++)Z[Q].setMaxListeners(U);else tU=U}function jG(U,Z){return U.listenerCount(Z)}function SX(U,Z,X,Q){if(typeof U.removeListener==="function")U.removeListener(Z,X);else U.removeEventListener(Z,X,Q)}function MG(U,Z,X,Q){if(typeof U.on==="function")if(Q.once)U.once(Z,X);else U.on(Z,X);else U.addEventListener(Z,X,Q)}function zZ(U,Z,X){let Q=TypeError(`The "${U}" argument must be of type ${Z}. Received ${X}`);return Q.code="ERR_INVALID_ARG_TYPE",Q}function CI(U,Z,X){let Q=RangeError(`The "${U}" argument is out of range. It must be ${Z}. Received ${X}`);return Q.code="ERR_OUT_OF_RANGE",Q}function vG(U,Z){if(U!==void 0&&(U===null||typeof U!=="object"||!("aborted"in U)))throw zZ(Z,"AbortSignal",U)}function dY(U,Z,X,Q){if(typeof U!=="number")throw zZ(Z,"number",U);if(X!=null&&U<X||Q!=null&&U>Q||(X!=null||Q!=null)&&Number.isNaN(U))throw CI(Z,`${X!=null?`>= ${X}`:""}${X!=null&&Q!=null?" && ":""}${Q!=null?`<= ${Q}`:""}`,U)}function BZ(U){if(typeof U!=="function")throw TypeError("The listener must be a function")}function AI(U,Z){if(typeof U!=="boolean")throw zZ(Z,"boolean",U)}function _G(U){return U?._maxListeners??tU}function BG(U,Z){if(U===void 0)throw zZ("signal","AbortSignal",U);if(vG(U,"signal"),typeof Z!=="function")throw zZ("listener","function",Z);let X;if(U.aborted)queueMicrotask(()=>Z());else U.addEventListener("abort",Z,{__proto__:null,once:!0}),X=()=>{U.removeEventListener("abort",Z)};return{__proto__:null,[Symbol.dispose](){X?.()}}}var bY,aU,qG,KI,WI,zG,LG,DG,tU=10,wU=function(U){if(this._events===void 0||this._events===this.__proto__._events)this._events={__proto__:null},this._eventsCount=0;if(this._maxListeners??=void 0,this[aU]=U?.captureRejections?Boolean(U?.captureRejections):i0[aU])this.emit=OI},i0,FI=function(U,...Z){if(U==="error")return TG(this,Z);var{_events:X}=this;if(X===void 0)return!1;var Q=X[U];if(Q===void 0)return!1;let K=Q.length>1?Q.slice():Q;for(let H=0,{length:$}=K;H<$;H++){let M=K[H];switch(Z.length){case 0:M.call(this);break;case 1:M.call(this,Z[0]);break;case 2:M.call(this,Z[0],Z[1]);break;case 3:M.call(this,Z[0],Z[1],Z[2]);break;default:M.apply(this,Z);break}}return!0},OI=function(U,...Z){if(U==="error")return TG(this,Z);var{_events:X}=this;if(X===void 0)return!1;var Q=X[U];if(Q===void 0)return!1;let K=Q.length>1?Q.slice():Q;for(let H=0,{length:$}=K;H<$;H++){let M=K[H],q;switch(Z.length){case 0:q=M.call(this);break;case 1:q=M.call(this,Z[0]);break;case 2:q=M.call(this,Z[0],Z[1]);break;case 3:q=M.call(this,Z[0],Z[1],Z[2]);break;default:q=M.apply(this,Z);break}if(q!==void 0&&typeof q?.then==="function"&&q.then===Promise.prototype.then)II(this,q,U,Z)}return!0},uY,zI;var NZ=IZ(()=>{bY=Symbol.for,aU=Symbol("kCapture"),qG=bY("events.errorMonitor"),KI=Symbol("events.maxEventTargetListeners"),WI=Symbol("events.maxEventTargetListenersWarned"),zG=bY("nodejs.rejection"),LG=bY("nodejs.rejection"),DG=Array.prototype.slice,i0=wU.prototype={};i0._events=void 0;i0._eventsCount=0;i0._maxListeners=void 0;i0.setMaxListeners=function(U){return dY(U,"setMaxListeners",0),this._maxListeners=U,this};i0.constructor=wU;i0.getMaxListeners=function(){return this?._maxListeners??tU};i0.emit=FI;i0.addListener=function(U,Z){BZ(Z);var X=this._events;if(!X)X=this._events={__proto__:null},this._eventsCount=0;else if(X.newListener)this.emit("newListener",U,Z.listener??Z);var Q=X[U];if(!Q)X[U]=[Z],this._eventsCount++;else{Q.push(Z);var K=this._maxListeners??tU;if(K>0&&Q.length>K&&!Q.warned)RG(this,U,Q)}return this};i0.on=i0.addListener;i0.prependListener=function(U,Z){BZ(Z);var X=this._events;if(!X)X=this._events={__proto__:null},this._eventsCount=0;else if(X.newListener)this.emit("newListener",U,Z.listener??Z);var Q=X[U];if(!Q)X[U]=[Z],this._eventsCount++;else{Q.unshift(Z);var K=this._maxListeners??tU;if(K>0&&Q.length>K&&!Q.warned)RG(this,U,Q)}return this};i0.once=function(U,Z){BZ(Z);let X=EG.bind(this,U,Z);return X.listener=Z,this.addListener(U,X),this};i0.prependOnceListener=function(U,Z){BZ(Z);let X=EG.bind(this,U,Z);return X.listener=Z,this.prependListener(U,X),this};i0.removeListener=function(U,Z){BZ(Z);var{_events:X}=this;if(!X)return this;var Q=X[U];if(!Q)return this;var K=Q.length;let H=-1;for(let $=K-1;$>=0;$--)if(Q[$]===Z||Q[$].listener===Z){H=$;break}if(H<0)return this;if(H===0)Q.shift();else Q.splice(H,1);if(Q.length===0)delete X[U],this._eventsCount--;return this};i0.off=i0.removeListener;i0.removeAllListeners=function(U){var{_events:Z}=this;if(U&&Z){if(Z[U])delete Z[U],this._eventsCount--}else this._events={__proto__:null};return this};i0.listeners=function(U){var{_events:Z}=this;if(!Z)return[];var X=Z[U];if(!X)return[];return X.map((Q)=>Q.listener??Q)};i0.rawListeners=function(U){var{_events:Z}=this;if(!Z)return[];var X=Z[U];if(!X)return[];return X.slice()};i0.listenerCount=function(U){var{_events:Z}=this;if(!Z)return 0;return Z[U]?.length??0};i0.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};i0[aU]=!1;uY=class uY extends Error{constructor(U="The operation was aborted",Z=void 0){if(Z!==void 0&&typeof Z!=="object")throw zZ("options","Object",Z);super(U,Z);this.code="ABORT_ERR",this.name="AbortError"}};Object.defineProperties(wU,{captureRejections:{get(){return i0[aU]},set(U){AI(U,"EventEmitter.captureRejections"),i0[aU]=U},enumerable:!0},defaultMaxListeners:{enumerable:!0,get:()=>{return tU},set:(U)=>{dY(U,"defaultMaxListeners",0),tU=U}},kMaxEventTargetListeners:{value:KI,enumerable:!1,configurable:!1,writable:!1},kMaxEventTargetListenersWarned:{value:WI,enumerable:!1,configurable:!1,writable:!1}});Object.assign(wU,{once:SG,getEventListeners:PG,getMaxListeners:_G,setMaxListeners:kG,EventEmitter:wU,usingDomains:!1,captureRejectionSymbol:LG,errorMonitor:qG,addAbortListener:BG,init:wU,listenerCount:jG});zI=wU});var mY=mK((iC,pG)=>{var s0=(U,Z)=>()=>(Z||U((Z={exports:{}}).exports,Z),Z.exports),Z1=s0((U,Z)=>{class X extends Error{constructor(Q){if(!Array.isArray(Q))throw TypeError(`Expected input to be an Array, got ${typeof Q}`);let K="";for(let H=0;H<Q.length;H++)K+=` ${Q[H].stack}
|
|
12
|
-
`;super(K);this.name="AggregateError",this.errors=Q}}Z.exports={AggregateError:X,ArrayIsArray(Q){return Array.isArray(Q)},ArrayPrototypeIncludes(Q,K){return Q.includes(K)},ArrayPrototypeIndexOf(Q,K){return Q.indexOf(K)},ArrayPrototypeJoin(Q,K){return Q.join(K)},ArrayPrototypeMap(Q,K){return Q.map(K)},ArrayPrototypePop(Q,K){return Q.pop(K)},ArrayPrototypePush(Q,K){return Q.push(K)},ArrayPrototypeSlice(Q,K,H){return Q.slice(K,H)},Error,FunctionPrototypeCall(Q,K,...H){return Q.call(K,...H)},FunctionPrototypeSymbolHasInstance(Q,K){return Function.prototype[Symbol.hasInstance].call(Q,K)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties(Q,K){return Object.defineProperties(Q,K)},ObjectDefineProperty(Q,K,H){return Object.defineProperty(Q,K,H)},ObjectGetOwnPropertyDescriptor(Q,K){return Object.getOwnPropertyDescriptor(Q,K)},ObjectKeys(Q){return Object.keys(Q)},ObjectSetPrototypeOf(Q,K){return Object.setPrototypeOf(Q,K)},Promise,PromisePrototypeCatch(Q,K){return Q.catch(K)},PromisePrototypeThen(Q,K,H){return Q.then(K,H)},PromiseReject(Q){return Promise.reject(Q)},PromiseResolve(Q){return Promise.resolve(Q)},ReflectApply:Reflect.apply,RegExpPrototypeTest(Q,K){return Q.test(K)},SafeSet:Set,String,StringPrototypeSlice(Q,K,H){return Q.slice(K,H)},StringPrototypeToLowerCase(Q){return Q.toLowerCase()},StringPrototypeToUpperCase(Q){return Q.toUpperCase()},StringPrototypeTrim(Q){return Q.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol("Symbol.dispose"),SymbolAsyncDispose:Symbol.asyncDispose||Symbol("Symbol.asyncDispose"),TypedArrayPrototypeSet(Q,K,H){return Q.set(K,H)},Boolean,Uint8Array}}),xG=s0((U,Z)=>{Z.exports={format(X,...Q){return X.replace(/%([sdifj])/g,function(...[K,H]){let $=Q.shift();if(H==="f")return $.toFixed(6);else if(H==="j")return JSON.stringify($);else if(H==="s"&&typeof $==="object")return`${$.constructor!==Object?$.constructor.name:""} {}`.trim();else return $.toString()})},inspect(X){switch(typeof X){case"string":if(X.includes("'")){if(!X.includes('"'))return`"${X}"`;else if(!X.includes("`")&&!X.includes("${"))return`\`${X}\``}return`'${X}'`;case"number":if(isNaN(X))return"NaN";else if(Object.is(X,-0))return String(X);return X;case"bigint":return`${String(X)}n`;case"boolean":case"undefined":return String(X);case"object":return"{}"}}}}),n1=s0((U,Z)=>{var{format:X,inspect:Q}=xG(),{AggregateError:K}=Z1(),H=globalThis.AggregateError||K,$=Symbol("kIsNodeError"),M=["string","function","number","object","Function","Object","boolean","bigint","symbol"],q=/^([A-Z][a-z0-9]*)+$/,z={};function T(B,v){if(!B)throw new z.ERR_INTERNAL_ASSERTION(v)}function A(B){let v="",x=B.length,N=B[0]==="-"?1:0;for(;x>=N+4;x-=3)v=`_${B.slice(x-3,x)}${v}`;return`${B.slice(0,x)}${v}`}function L(B,v,x){if(typeof v==="function")return T(v.length<=x.length,`Code: ${B}; The provided arguments length (${x.length}) does not match the required ones (${v.length}).`),v(...x);let N=(v.match(/%[dfijoOs]/g)||[]).length;if(T(N===x.length,`Code: ${B}; The provided arguments length (${x.length}) does not match the required ones (${N}).`),x.length===0)return v;return X(v,...x)}function E(B,v,x){if(!x)x=Error;class N extends x{constructor(...w){super(L(B,v,w))}toString(){return`${this.name} [${B}]: ${this.message}`}}Object.defineProperties(N.prototype,{name:{value:x.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${B}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),N.prototype.code=B,N.prototype[$]=!0,z[B]=N}function S(B){let v="__node_internal_"+B.name;return Object.defineProperty(B,"name",{value:v}),B}function j(B,v){if(B&&v&&B!==v){if(Array.isArray(v.errors))return v.errors.push(B),v;let x=new H([v,B],v.message);return x.code=v.code,x}return B||v}class k extends Error{constructor(B="The operation was aborted",v=void 0){if(v!==void 0&&typeof v!=="object")throw new z.ERR_INVALID_ARG_TYPE("options","Object",v);super(B,v);this.code="ABORT_ERR",this.name="AbortError"}}E("ERR_ASSERTION","%s",Error),E("ERR_INVALID_ARG_TYPE",(B,v,x)=>{if(T(typeof B==="string","'name' must be a string"),!Array.isArray(v))v=[v];let N="The ";if(B.endsWith(" argument"))N+=`${B} `;else N+=`"${B}" ${B.includes(".")?"property":"argument"} `;N+="must be ";let w=[],u=[],Z0=[];for(let Y0 of v)if(T(typeof Y0==="string","All expected entries have to be of type string"),M.includes(Y0))w.push(Y0.toLowerCase());else if(q.test(Y0))u.push(Y0);else T(Y0!=="object",'The value "object" should be written as "Object"'),Z0.push(Y0);if(u.length>0){let Y0=w.indexOf("object");if(Y0!==-1)w.splice(w,Y0,1),u.push("Object")}if(w.length>0){switch(w.length){case 1:N+=`of type ${w[0]}`;break;case 2:N+=`one of type ${w[0]} or ${w[1]}`;break;default:{let Y0=w.pop();N+=`one of type ${w.join(", ")}, or ${Y0}`}}if(u.length>0||Z0.length>0)N+=" or "}if(u.length>0){switch(u.length){case 1:N+=`an instance of ${u[0]}`;break;case 2:N+=`an instance of ${u[0]} or ${u[1]}`;break;default:{let Y0=u.pop();N+=`an instance of ${u.join(", ")}, or ${Y0}`}}if(Z0.length>0)N+=" or "}switch(Z0.length){case 0:break;case 1:if(Z0[0].toLowerCase()!==Z0[0])N+="an ";N+=`${Z0[0]}`;break;case 2:N+=`one of ${Z0[0]} or ${Z0[1]}`;break;default:{let Y0=Z0.pop();N+=`one of ${Z0.join(", ")}, or ${Y0}`}}if(x==null)N+=`. Received ${x}`;else if(typeof x==="function"&&x.name)N+=`. Received function ${x.name}`;else if(typeof x==="object"){var V0;if((V0=x.constructor)!==null&&V0!==void 0&&V0.name)N+=`. Received an instance of ${x.constructor.name}`;else{let Y0=Q(x,{depth:-1});N+=`. Received ${Y0}`}}else{let Y0=Q(x,{colors:!1});if(Y0.length>25)Y0=`${Y0.slice(0,25)}...`;N+=`. Received type ${typeof x} (${Y0})`}return N},TypeError),E("ERR_INVALID_ARG_VALUE",(B,v,x="is invalid")=>{let N=Q(v);if(N.length>128)N=N.slice(0,128)+"...";return`The ${B.includes(".")?"property":"argument"} '${B}' ${x}. Received ${N}`},TypeError),E("ERR_INVALID_RETURN_VALUE",(B,v,x)=>{var N;let w=x!==null&&x!==void 0&&(N=x.constructor)!==null&&N!==void 0&&N.name?`instance of ${x.constructor.name}`:`type ${typeof x}`;return`Expected ${B} to be returned from the "${v}" function but got ${w}.`},TypeError),E("ERR_MISSING_ARGS",(...B)=>{T(B.length>0,"At least one arg needs to be specified");let v,x=B.length;switch(B=(Array.isArray(B)?B:[B]).map((N)=>`"${N}"`).join(" or "),x){case 1:v+=`The ${B[0]} argument`;break;case 2:v+=`The ${B[0]} and ${B[1]} arguments`;break;default:{let N=B.pop();v+=`The ${B.join(", ")}, and ${N} arguments`}break}return`${v} must be specified`},TypeError),E("ERR_OUT_OF_RANGE",(B,v,x)=>{T(v,'Missing "range" argument');let N;if(Number.isInteger(x)&&Math.abs(x)>4294967296)N=A(String(x));else if(typeof x==="bigint"){N=String(x);let w=BigInt(2)**BigInt(32);if(x>w||x<-w)N=A(N);N+="n"}else N=Q(x);return`The value of "${B}" is out of range. It must be ${v}. Received ${N}`},RangeError),E("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),E("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),E("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),E("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),E("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),E("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),E("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),E("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),E("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),E("ERR_STREAM_WRITE_AFTER_END","write after end",Error),E("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),Z.exports={AbortError:k,aggregateTwoErrors:S(j),hideStackFrames:S,codes:z}}),DI=s0((U,Z)=>{Object.defineProperty(U,"__esModule",{value:!0});var X=new WeakMap,Q=new WeakMap;function K(b){let i=X.get(b);return console.assert(i!=null,"'this' is expected an Event object, but got",b),i}function H(b){if(b.passiveListener!=null){if(typeof console<"u"&&typeof console.error==="function")console.error("Unable to preventDefault inside passive event listener invocation.",b.passiveListener);return}if(!b.event.cancelable)return;if(b.canceled=!0,typeof b.event.preventDefault==="function")b.event.preventDefault()}function $(b,i){X.set(this,{eventTarget:b,event:i,eventPhase:2,currentTarget:b,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:i.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});let Y=Object.keys(i);for(let V=0;V<Y.length;++V){let I=Y[V];if(!(I in this))Object.defineProperty(this,I,M(I))}}if($.prototype={get type(){return K(this).event.type},get target(){return K(this).eventTarget},get currentTarget(){return K(this).currentTarget},composedPath(){let b=K(this).currentTarget;if(b==null)return[];return[b]},get NONE(){return 0},get CAPTURING_PHASE(){return 1},get AT_TARGET(){return 2},get BUBBLING_PHASE(){return 3},get eventPhase(){return K(this).eventPhase},stopPropagation(){let b=K(this);if(b.stopped=!0,typeof b.event.stopPropagation==="function")b.event.stopPropagation()},stopImmediatePropagation(){let b=K(this);if(b.stopped=!0,b.immediateStopped=!0,typeof b.event.stopImmediatePropagation==="function")b.event.stopImmediatePropagation()},get bubbles(){return Boolean(K(this).event.bubbles)},get cancelable(){return Boolean(K(this).event.cancelable)},preventDefault(){H(K(this))},get defaultPrevented(){return K(this).canceled},get composed(){return Boolean(K(this).event.composed)},get timeStamp(){return K(this).timeStamp},get srcElement(){return K(this).eventTarget},get cancelBubble(){return K(this).stopped},set cancelBubble(b){if(!b)return;let i=K(this);if(i.stopped=!0,typeof i.event.cancelBubble==="boolean")i.event.cancelBubble=!0},get returnValue(){return!K(this).canceled},set returnValue(b){if(!b)H(K(this))},initEvent(){}},Object.defineProperty($.prototype,"constructor",{value:$,configurable:!0,writable:!0}),typeof window<"u"&&typeof window.Event<"u")Object.setPrototypeOf($.prototype,window.Event.prototype),Q.set(window.Event.prototype,$);function M(b){return{get(){return K(this).event[b]},set(i){K(this).event[b]=i},configurable:!0,enumerable:!0}}function q(b){return{value(){let i=K(this).event;return i[b].apply(i,arguments)},configurable:!0,enumerable:!0}}function z(b,i){let Y=Object.keys(i);if(Y.length===0)return b;function V(I,G){b.call(this,I,G)}V.prototype=Object.create(b.prototype,{constructor:{value:V,configurable:!0,writable:!0}});for(let I=0;I<Y.length;++I){let G=Y[I];if(!(G in b.prototype)){let W=typeof Object.getOwnPropertyDescriptor(i,G).value==="function";Object.defineProperty(V.prototype,G,W?q(G):M(G))}}return V}function T(b){if(b==null||b===Object.prototype)return $;let i=Q.get(b);if(i==null)i=z(T(Object.getPrototypeOf(b)),b),Q.set(b,i);return i}function A(b,i){return new(T(Object.getPrototypeOf(i)))(b,i)}function L(b){return K(b).immediateStopped}function E(b,i){K(b).eventPhase=i}function S(b,i){K(b).currentTarget=i}function j(b,i){K(b).passiveListener=i}var k=new WeakMap,B=1,v=2,x=3;function N(b){return b!==null&&typeof b==="object"}function w(b){let i=k.get(b);if(i==null)throw TypeError("'this' is expected an EventTarget object, but got another value.");return i}function u(b){return{get(){let i=w(this).get(b);while(i!=null){if(i.listenerType===x)return i.listener;i=i.next}return null},set(i){if(typeof i!=="function"&&!N(i))i=null;let Y=w(this),V=null,I=Y.get(b);while(I!=null){if(I.listenerType===x)if(V!==null)V.next=I.next;else if(I.next!==null)Y.set(b,I.next);else Y.delete(b);else V=I;I=I.next}if(i!==null){let G={listener:i,listenerType:x,passive:!1,once:!1,next:null};if(V===null)Y.set(b,G);else V.next=G}},configurable:!0,enumerable:!0}}function Z0(b,i){Object.defineProperty(b,`on${i}`,u(i))}function V0(b){function i(){Y0.call(this)}i.prototype=Object.create(Y0.prototype,{constructor:{value:i,configurable:!0,writable:!0}});for(let Y=0;Y<b.length;++Y)Z0(i.prototype,b[Y]);return i}function Y0(){if(this instanceof Y0){k.set(this,new Map);return}if(arguments.length===1&&Array.isArray(arguments[0]))return V0(arguments[0]);if(arguments.length>0){let b=Array(arguments.length);for(let i=0;i<arguments.length;++i)b[i]=arguments[i];return V0(b)}throw TypeError("Cannot call a class as a function")}if(Y0.prototype={addEventListener(b,i,Y){if(i==null)return;if(typeof i!=="function"&&!N(i))throw TypeError("'listener' should be a function or an object.");let V=w(this),I=N(Y),G=(I?Boolean(Y.capture):Boolean(Y))?B:v,W={listener:i,listenerType:G,passive:I&&Boolean(Y.passive),once:I&&Boolean(Y.once),next:null},C=V.get(b);if(C===void 0){V.set(b,W);return}let D=null;while(C!=null){if(C.listener===i&&C.listenerType===G)return;D=C,C=C.next}D.next=W},removeEventListener(b,i,Y){if(i==null)return;let V=w(this),I=(N(Y)?Boolean(Y.capture):Boolean(Y))?B:v,G=null,W=V.get(b);while(W!=null){if(W.listener===i&&W.listenerType===I){if(G!==null)G.next=W.next;else if(W.next!==null)V.set(b,W.next);else V.delete(b);return}G=W,W=W.next}},dispatchEvent(b){if(b==null||typeof b.type!=="string")throw TypeError('"event.type" should be a string.');let i=w(this),Y=b.type,V=i.get(Y);if(V==null)return!0;let I=A(this,b),G=null;while(V!=null){if(V.once)if(G!==null)G.next=V.next;else if(V.next!==null)i.set(Y,V.next);else i.delete(Y);else G=V;if(j(I,V.passive?V.listener:null),typeof V.listener==="function")try{V.listener.call(this,I)}catch(W){if(typeof console<"u"&&typeof console.error==="function")console.error(W)}else if(V.listenerType!==x&&typeof V.listener.handleEvent==="function")V.listener.handleEvent(I);if(L(I))break;V=V.next}return j(I,null),E(I,0),S(I,null),!I.defaultPrevented}},Object.defineProperty(Y0.prototype,"constructor",{value:Y0,configurable:!0,writable:!0}),typeof window<"u"&&typeof window.EventTarget<"u")Object.setPrototypeOf(Y0.prototype,window.EventTarget.prototype);U.defineEventAttribute=Z0,U.EventTarget=Y0,U.default=Y0,Z.exports=Y0,Z.exports.EventTarget=Z.exports.default=Y0,Z.exports.defineEventAttribute=Z0}),gZ=s0((U,Z)=>{Object.defineProperty(U,"__esModule",{value:!0});var X=DI();class Q extends X.EventTarget{constructor(){super();throw TypeError("AbortSignal cannot be constructed directly")}get aborted(){let T=$.get(this);if(typeof T!=="boolean")throw TypeError(`Expected 'this' to be an 'AbortSignal' object, but got ${this===null?"null":typeof this}`);return T}}X.defineEventAttribute(Q.prototype,"abort");function K(){let T=Object.create(Q.prototype);return X.EventTarget.call(T),$.set(T,!1),T}function H(T){if($.get(T)!==!1)return;$.set(T,!0),T.dispatchEvent({type:"abort"})}var $=new WeakMap;if(Object.defineProperties(Q.prototype,{aborted:{enumerable:!0}}),typeof Symbol==="function"&&typeof Symbol.toStringTag==="symbol")Object.defineProperty(Q.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortSignal"});class M{constructor(){q.set(this,K())}get signal(){return z(this)}abort(){H(z(this))}}var q=new WeakMap;function z(T){let A=q.get(T);if(A==null)throw TypeError(`Expected 'this' to be an 'AbortController' object, but got ${T===null?"null":typeof T}`);return A}if(Object.defineProperties(M.prototype,{signal:{enumerable:!0},abort:{enumerable:!0}}),typeof Symbol==="function"&&typeof Symbol.toStringTag==="symbol")Object.defineProperty(M.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortController"});U.AbortController=M,U.AbortSignal=Q,U.default=M,Z.exports=M,Z.exports.AbortController=Z.exports.default=M,Z.exports.AbortSignal=Q}),i1=s0((U,Z)=>{var X=(g1(),m0(N1)),{format:Q,inspect:K}=xG(),{codes:{ERR_INVALID_ARG_TYPE:H}}=n1(),{kResistStopPropagation:$,AggregateError:M,SymbolDispose:q}=Z1(),z=globalThis.AbortSignal||gZ().AbortSignal,T=globalThis.AbortController||gZ().AbortController,A=Object.getPrototypeOf(async function(){}).constructor,L=globalThis.Blob||X.Blob,E=typeof L<"u"?function(k){return k instanceof L}:function(k){return!1},S=(k,B)=>{if(k!==void 0&&(k===null||typeof k!=="object"||!("aborted"in k)))throw new H(B,"AbortSignal",k)},j=(k,B)=>{if(typeof k!=="function")throw new H(B,"Function",k)};Z.exports={AggregateError:M,kEmptyObject:Object.freeze({}),once(k){let B=!1;return function(...v){if(B)return;B=!0,k.apply(this,v)}},createDeferredPromise:function(){let k,B;return{promise:new Promise((v,x)=>{k=v,B=x}),resolve:k,reject:B}},promisify(k){return new Promise((B,v)=>{k((x,...N)=>{if(x)return v(x);return B(...N)})})},debuglog(){return function(){}},format:Q,inspect:K,types:{isAsyncFunction(k){return k instanceof A},isArrayBufferView(k){return ArrayBuffer.isView(k)}},isBlob:E,deprecate(k,B){return k},addAbortListener:(NZ(),m0(xZ)).addAbortListener||function(k,B){if(k===void 0)throw new H("signal","AbortSignal",k);S(k,"signal"),j(B,"listener");let v;if(k.aborted)queueMicrotask(()=>B());else k.addEventListener("abort",B,{__proto__:null,once:!0,[$]:!0}),v=()=>{k.removeEventListener("abort",B)};return{__proto__:null,[q](){var x;(x=v)===null||x===void 0||x()}}},AbortSignalAny:z.any||function(k){if(k.length===1)return k[0];let B=new T,v=()=>B.abort();return k.forEach((x)=>{S(x,"signals"),x.addEventListener("abort",v,{once:!0})}),B.signal.addEventListener("abort",()=>{k.forEach((x)=>x.removeEventListener("abort",v))},{once:!0}),B.signal}},Z.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")}),fZ=s0((U,Z)=>{var{ArrayIsArray:X,ArrayPrototypeIncludes:Q,ArrayPrototypeJoin:K,ArrayPrototypeMap:H,NumberIsInteger:$,NumberIsNaN:M,NumberMAX_SAFE_INTEGER:q,NumberMIN_SAFE_INTEGER:z,NumberParseInt:T,ObjectPrototypeHasOwnProperty:A,RegExpPrototypeExec:L,String:E,StringPrototypeToUpperCase:S,StringPrototypeTrim:j}=Z1(),{hideStackFrames:k,codes:{ERR_SOCKET_BAD_PORT:B,ERR_INVALID_ARG_TYPE:v,ERR_INVALID_ARG_VALUE:x,ERR_OUT_OF_RANGE:N,ERR_UNKNOWN_SIGNAL:w}}=n1(),{normalizeEncoding:u}=i1(),{isAsyncFunction:Z0,isArrayBufferView:V0}=i1().types,Y0={};function b(p){return p===(p|0)}function i(p){return p===p>>>0}var Y=/^[0-7]+$/,V="must be a 32-bit unsigned integer or an octal string";function I(p,m,g0){if(typeof p>"u")p=g0;if(typeof p==="string"){if(L(Y,p)===null)throw new x(m,p,V);p=T(p,8)}return C(p,m),p}var G=k((p,m,g0=z,r=q)=>{if(typeof p!=="number")throw new v(m,"number",p);if(!$(p))throw new N(m,"an integer",p);if(p<g0||p>r)throw new N(m,`>= ${g0} && <= ${r}`,p)}),W=k((p,m,g0=-2147483648,r=2147483647)=>{if(typeof p!=="number")throw new v(m,"number",p);if(!$(p))throw new N(m,"an integer",p);if(p<g0||p>r)throw new N(m,`>= ${g0} && <= ${r}`,p)}),C=k((p,m,g0=!1)=>{if(typeof p!=="number")throw new v(m,"number",p);if(!$(p))throw new N(m,"an integer",p);let r=g0?1:0,J0=4294967295;if(p<r||p>J0)throw new N(m,`>= ${r} && <= ${J0}`,p)});function D(p,m){if(typeof p!=="string")throw new v(m,"string",p)}function F(p,m,g0=void 0,r){if(typeof p!=="number")throw new v(m,"number",p);if(g0!=null&&p<g0||r!=null&&p>r||(g0!=null||r!=null)&&M(p))throw new N(m,`${g0!=null?`>= ${g0}`:""}${g0!=null&&r!=null?" && ":""}${r!=null?`<= ${r}`:""}`,p)}var J=k((p,m,g0)=>{if(!Q(g0,p)){let r="must be one of: "+K(H(g0,(J0)=>typeof J0==="string"?`'${J0}'`:E(J0)),", ");throw new x(m,p,r)}});function O(p,m){if(typeof p!=="boolean")throw new v(m,"boolean",p)}function P(p,m,g0){return p==null||!A(p,m)?g0:p[m]}var R=k((p,m,g0=null)=>{let r=P(g0,"allowArray",!1),J0=P(g0,"allowFunction",!1);if(!P(g0,"nullable",!1)&&p===null||!r&&X(p)||typeof p!=="object"&&(!J0||typeof p!=="function"))throw new v(m,"Object",p)}),_=k((p,m)=>{if(p!=null&&typeof p!=="object"&&typeof p!=="function")throw new v(m,"a dictionary",p)}),f=k((p,m,g0=0)=>{if(!X(p))throw new v(m,"Array",p);if(p.length<g0){let r=`must be longer than ${g0}`;throw new x(m,p,r)}});function c(p,m){f(p,m);for(let g0=0;g0<p.length;g0++)D(p[g0],`${m}[${g0}]`)}function o(p,m){f(p,m);for(let g0=0;g0<p.length;g0++)O(p[g0],`${m}[${g0}]`)}function K0(p,m){f(p,m);for(let g0=0;g0<p.length;g0++){let r=p[g0],J0=`${m}[${g0}]`;if(r==null)throw new v(J0,"AbortSignal",r);s(r,J0)}}function a(p,m="signal"){if(D(p,m),Y0[p]===void 0){if(Y0[S(p)]!==void 0)throw new w(p+" (signals must use all capital letters)");throw new w(p)}}var l=k((p,m="buffer")=>{if(!V0(p))throw new v(m,["Buffer","TypedArray","DataView"],p)});function Q0(p,m){let g0=u(m),r=p.length;if(g0==="hex"&&r%2!==0)throw new x("encoding",m,`is invalid for data of length ${r}`)}function n(p,m="Port",g0=!0){if(typeof p!=="number"&&typeof p!=="string"||typeof p==="string"&&j(p).length===0||+p!==+p>>>0||p>65535||p===0&&!g0)throw new B(m,p,g0);return p|0}var s=k((p,m)=>{if(p!==void 0&&(p===null||typeof p!=="object"||!("aborted"in p)))throw new v(m,"AbortSignal",p)}),f0=k((p,m)=>{if(typeof p!=="function")throw new v(m,"Function",p)}),y=k((p,m)=>{if(typeof p!=="function"||Z0(p))throw new v(m,"Function",p)}),h=k((p,m)=>{if(p!==void 0)throw new v(m,"undefined",p)});function G0(p,m,g0){if(!Q(g0,p))throw new v(m,`('${K(g0,"|")}')`,p)}var t=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function U0(p,m){if(typeof p>"u"||!L(t,p))throw new x(m,p,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function L0(p){if(typeof p==="string")return U0(p,"hints"),p;else if(X(p)){let m=p.length,g0="";if(m===0)return g0;for(let r=0;r<m;r++){let J0=p[r];if(U0(J0,"hints"),g0+=J0,r!==m-1)g0+=", "}return g0}throw new x("hints",p,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}Z.exports={isInt32:b,isUint32:i,parseFileMode:I,validateArray:f,validateStringArray:c,validateBooleanArray:o,validateAbortSignalArray:K0,validateBoolean:O,validateBuffer:l,validateDictionary:_,validateEncoding:Q0,validateFunction:f0,validateInt32:W,validateInteger:G,validateNumber:F,validateObject:R,validateOneOf:J,validatePlainFunction:y,validatePort:n,validateSignalName:a,validateString:D,validateUint32:C,validateUndefined:h,validateUnion:G0,validateAbortSignal:s,validateLinkHeaderValue:L0}}),iU=s0((U,Z)=>{Z.exports=globalThis.process}),kU=s0((U,Z)=>{var{SymbolAsyncIterator:X,SymbolIterator:Q,SymbolFor:K}=Z1(),H=K("nodejs.stream.destroyed"),$=K("nodejs.stream.errored"),M=K("nodejs.stream.readable"),q=K("nodejs.stream.writable"),z=K("nodejs.stream.disturbed"),T=K("nodejs.webstream.isClosedPromise"),A=K("nodejs.webstream.controllerErrorFunction");function L(P,R=!1){var _;return!!(P&&typeof P.pipe==="function"&&typeof P.on==="function"&&(!R||typeof P.pause==="function"&&typeof P.resume==="function")&&(!P._writableState||((_=P._readableState)===null||_===void 0?void 0:_.readable)!==!1)&&(!P._writableState||P._readableState))}function E(P){var R;return!!(P&&typeof P.write==="function"&&typeof P.on==="function"&&(!P._readableState||((R=P._writableState)===null||R===void 0?void 0:R.writable)!==!1))}function S(P){return!!(P&&typeof P.pipe==="function"&&P._readableState&&typeof P.on==="function"&&typeof P.write==="function")}function j(P){return P&&(P._readableState||P._writableState||typeof P.write==="function"&&typeof P.on==="function"||typeof P.pipe==="function"&&typeof P.on==="function")}function k(P){return!!(P&&!j(P)&&typeof P.pipeThrough==="function"&&typeof P.getReader==="function"&&typeof P.cancel==="function")}function B(P){return!!(P&&!j(P)&&typeof P.getWriter==="function"&&typeof P.abort==="function")}function v(P){return!!(P&&!j(P)&&typeof P.readable==="object"&&typeof P.writable==="object")}function x(P){return k(P)||B(P)||v(P)}function N(P,R){if(P==null)return!1;if(R===!0)return typeof P[X]==="function";if(R===!1)return typeof P[Q]==="function";return typeof P[X]==="function"||typeof P[Q]==="function"}function w(P){if(!j(P))return null;let{_writableState:R,_readableState:_}=P,f=R||_;return!!(P.destroyed||P[H]||f!==null&&f!==void 0&&f.destroyed)}function u(P){if(!E(P))return null;if(P.writableEnded===!0)return!0;let R=P._writableState;if(R!==null&&R!==void 0&&R.errored)return!1;if(typeof(R===null||R===void 0?void 0:R.ended)!=="boolean")return null;return R.ended}function Z0(P,R){if(!E(P))return null;if(P.writableFinished===!0)return!0;let _=P._writableState;if(_!==null&&_!==void 0&&_.errored)return!1;if(typeof(_===null||_===void 0?void 0:_.finished)!=="boolean")return null;return!!(_.finished||R===!1&&_.ended===!0&&_.length===0)}function V0(P){if(!L(P))return null;if(P.readableEnded===!0)return!0;let R=P._readableState;if(!R||R.errored)return!1;if(typeof(R===null||R===void 0?void 0:R.ended)!=="boolean")return null;return R.ended}function Y0(P,R){if(!L(P))return null;let _=P._readableState;if(_!==null&&_!==void 0&&_.errored)return!1;if(typeof(_===null||_===void 0?void 0:_.endEmitted)!=="boolean")return null;return!!(_.endEmitted||R===!1&&_.ended===!0&&_.length===0)}function b(P){if(P&&P[M]!=null)return P[M];if(typeof(P===null||P===void 0?void 0:P.readable)!=="boolean")return null;if(w(P))return!1;return L(P)&&P.readable&&!Y0(P)}function i(P){if(P&&P[q]!=null)return P[q];if(typeof(P===null||P===void 0?void 0:P.writable)!=="boolean")return null;if(w(P))return!1;return E(P)&&P.writable&&!u(P)}function Y(P,R){if(!j(P))return null;if(w(P))return!0;if((R===null||R===void 0?void 0:R.readable)!==!1&&b(P))return!1;if((R===null||R===void 0?void 0:R.writable)!==!1&&i(P))return!1;return!0}function V(P){var R,_;if(!j(P))return null;if(P.writableErrored)return P.writableErrored;return(R=(_=P._writableState)===null||_===void 0?void 0:_.errored)!==null&&R!==void 0?R:null}function I(P){var R,_;if(!j(P))return null;if(P.readableErrored)return P.readableErrored;return(R=(_=P._readableState)===null||_===void 0?void 0:_.errored)!==null&&R!==void 0?R:null}function G(P){if(!j(P))return null;if(typeof P.closed==="boolean")return P.closed;let{_writableState:R,_readableState:_}=P;if(typeof(R===null||R===void 0?void 0:R.closed)==="boolean"||typeof(_===null||_===void 0?void 0:_.closed)==="boolean")return(R===null||R===void 0?void 0:R.closed)||(_===null||_===void 0?void 0:_.closed);if(typeof P._closed==="boolean"&&W(P))return P._closed;return null}function W(P){return typeof P._closed==="boolean"&&typeof P._defaultKeepAlive==="boolean"&&typeof P._removedConnection==="boolean"&&typeof P._removedContLen==="boolean"}function C(P){return typeof P._sent100==="boolean"&&W(P)}function D(P){var R;return typeof P._consuming==="boolean"&&typeof P._dumped==="boolean"&&((R=P.req)===null||R===void 0?void 0:R.upgradeOrConnect)===void 0}function F(P){if(!j(P))return null;let{_writableState:R,_readableState:_}=P,f=R||_;return!f&&C(P)||!!(f&&f.autoDestroy&&f.emitClose&&f.closed===!1)}function J(P){var R;return!!(P&&((R=P[z])!==null&&R!==void 0?R:P.readableDidRead||P.readableAborted))}function O(P){var R,_,f,c,o,K0,a,l,Q0,n;return!!(P&&((R=(_=(f=(c=(o=(K0=P[$])!==null&&K0!==void 0?K0:P.readableErrored)!==null&&o!==void 0?o:P.writableErrored)!==null&&c!==void 0?c:(a=P._readableState)===null||a===void 0?void 0:a.errorEmitted)!==null&&f!==void 0?f:(l=P._writableState)===null||l===void 0?void 0:l.errorEmitted)!==null&&_!==void 0?_:(Q0=P._readableState)===null||Q0===void 0?void 0:Q0.errored)!==null&&R!==void 0?R:(n=P._writableState)===null||n===void 0?void 0:n.errored))}Z.exports={isDestroyed:w,kIsDestroyed:H,isDisturbed:J,kIsDisturbed:z,isErrored:O,kIsErrored:$,isReadable:b,kIsReadable:M,kIsClosedPromise:T,kControllerErrorFunction:A,kIsWritable:q,isClosed:G,isDuplexNodeStream:S,isFinished:Y,isIterable:N,isReadableNodeStream:L,isReadableStream:k,isReadableEnded:V0,isReadableFinished:Y0,isReadableErrored:I,isNodeStream:j,isWebStream:x,isWritable:i,isWritableNodeStream:E,isWritableStream:B,isWritableEnded:u,isWritableFinished:Z0,isWritableErrored:V,isServerRequest:D,isServerResponse:C,willEmitClose:F,isTransformStream:v}}),yU=s0((U,Z)=>{var X=iU(),{AbortError:Q,codes:K}=n1(),{ERR_INVALID_ARG_TYPE:H,ERR_STREAM_PREMATURE_CLOSE:$}=K,{kEmptyObject:M,once:q}=i1(),{validateAbortSignal:z,validateFunction:T,validateObject:A,validateBoolean:L}=fZ(),{Promise:E,PromisePrototypeThen:S,SymbolDispose:j}=Z1(),{isClosed:k,isReadable:B,isReadableNodeStream:v,isReadableStream:x,isReadableFinished:N,isReadableErrored:w,isWritable:u,isWritableNodeStream:Z0,isWritableStream:V0,isWritableFinished:Y0,isWritableErrored:b,isNodeStream:i,willEmitClose:Y,kIsClosedPromise:V}=kU(),I;function G(J){return J.setHeader&&typeof J.abort==="function"}var W=()=>{};function C(J,O,P){var R,_;if(arguments.length===2)P=O,O=M;else if(O==null)O=M;else A(O,"options");if(T(P,"callback"),z(O.signal,"options.signal"),P=q(P),x(J)||V0(J))return D(J,O,P);if(!i(J))throw new H("stream",["ReadableStream","WritableStream","Stream"],J);let f=(R=O.readable)!==null&&R!==void 0?R:v(J),c=(_=O.writable)!==null&&_!==void 0?_:Z0(J),o=J._writableState,K0=J._readableState,a=()=>{if(!J.writable)n()},l=Y(J)&&v(J)===f&&Z0(J)===c,Q0=Y0(J,!1),n=()=>{if(Q0=!0,J.destroyed)l=!1;if(l&&(!J.readable||f))return;if(!f||s)P.call(J)},s=N(J,!1),f0=()=>{if(s=!0,J.destroyed)l=!1;if(l&&(!J.writable||c))return;if(!c||Q0)P.call(J)},y=(p)=>{P.call(J,p)},h=k(J),G0=()=>{h=!0;let p=b(J)||w(J);if(p&&typeof p!=="boolean")return P.call(J,p);if(f&&!s&&v(J,!0)){if(!N(J,!1))return P.call(J,new $)}if(c&&!Q0){if(!Y0(J,!1))return P.call(J,new $)}P.call(J)},t=()=>{h=!0;let p=b(J)||w(J);if(p&&typeof p!=="boolean")return P.call(J,p);P.call(J)},U0=()=>{J.req.on("finish",n)};if(G(J)){if(J.on("complete",n),!l)J.on("abort",G0);if(J.req)U0();else J.on("request",U0)}else if(c&&!o)J.on("end",a),J.on("close",a);if(!l&&typeof J.aborted==="boolean")J.on("aborted",G0);if(J.on("end",f0),J.on("finish",n),O.error!==!1)J.on("error",y);if(J.on("close",G0),h)X.nextTick(G0);else if(o!==null&&o!==void 0&&o.errorEmitted||K0!==null&&K0!==void 0&&K0.errorEmitted){if(!l)X.nextTick(t)}else if(!f&&(!l||B(J))&&(Q0||u(J)===!1))X.nextTick(t);else if(!c&&(!l||u(J))&&(s||B(J)===!1))X.nextTick(t);else if(K0&&J.req&&J.aborted)X.nextTick(t);let L0=()=>{if(P=W,J.removeListener("aborted",G0),J.removeListener("complete",n),J.removeListener("abort",G0),J.removeListener("request",U0),J.req)J.req.removeListener("finish",n);J.removeListener("end",a),J.removeListener("close",a),J.removeListener("finish",n),J.removeListener("end",f0),J.removeListener("error",y),J.removeListener("close",G0)};if(O.signal&&!h){let p=()=>{let m=P;L0(),m.call(J,new Q(void 0,{cause:O.signal.reason}))};if(O.signal.aborted)X.nextTick(p);else{I=I||i1().addAbortListener;let m=I(O.signal,p),g0=P;P=q((...r)=>{m[j](),g0.apply(J,r)})}}return L0}function D(J,O,P){let R=!1,_=W;if(O.signal)if(_=()=>{R=!0,P.call(J,new Q(void 0,{cause:O.signal.reason}))},O.signal.aborted)X.nextTick(_);else{I=I||i1().addAbortListener;let c=I(O.signal,_),o=P;P=q((...K0)=>{c[j](),o.apply(J,K0)})}let f=(...c)=>{if(!R)X.nextTick(()=>P.apply(J,c))};return S(J[V].promise,f,f),W}function F(J,O){var P;let R=!1;if(O===null)O=M;if((P=O)!==null&&P!==void 0&&P.cleanup)L(O.cleanup,"cleanup"),R=O.cleanup;return new E((_,f)=>{let c=C(J,O,(o)=>{if(R)c();if(o)f(o);else _()})})}Z.exports=C,Z.exports.finished=F}),DZ=s0((U,Z)=>{var X=iU(),{aggregateTwoErrors:Q,codes:{ERR_MULTIPLE_CALLBACK:K},AbortError:H}=n1(),{Symbol:$}=Z1(),{kIsDestroyed:M,isDestroyed:q,isFinished:z,isServerRequest:T}=kU(),A=$("kDestroy"),L=$("kConstruct");function E(Y,V,I){if(Y){if(Y.stack,V&&!V.errored)V.errored=Y;if(I&&!I.errored)I.errored=Y}}function S(Y,V){let I=this._readableState,G=this._writableState,W=G||I;if(G!==null&&G!==void 0&&G.destroyed||I!==null&&I!==void 0&&I.destroyed){if(typeof V==="function")V();return this}if(E(Y,G,I),G)G.destroyed=!0;if(I)I.destroyed=!0;if(!W.constructed)this.once(A,function(C){j(this,Q(C,Y),V)});else j(this,Y,V);return this}function j(Y,V,I){let G=!1;function W(C){if(G)return;G=!0;let{_readableState:D,_writableState:F}=Y;if(E(C,F,D),F)F.closed=!0;if(D)D.closed=!0;if(typeof I==="function")I(C);if(C)X.nextTick(k,Y,C);else X.nextTick(B,Y)}try{Y._destroy(V||null,W)}catch(C){W(C)}}function k(Y,V){v(Y,V),B(Y)}function B(Y){let{_readableState:V,_writableState:I}=Y;if(I)I.closeEmitted=!0;if(V)V.closeEmitted=!0;if(I!==null&&I!==void 0&&I.emitClose||V!==null&&V!==void 0&&V.emitClose)Y.emit("close")}function v(Y,V){let{_readableState:I,_writableState:G}=Y;if(G!==null&&G!==void 0&&G.errorEmitted||I!==null&&I!==void 0&&I.errorEmitted)return;if(G)G.errorEmitted=!0;if(I)I.errorEmitted=!0;Y.emit("error",V)}function x(){let Y=this._readableState,V=this._writableState;if(Y)Y.constructed=!0,Y.closed=!1,Y.closeEmitted=!1,Y.destroyed=!1,Y.errored=null,Y.errorEmitted=!1,Y.reading=!1,Y.ended=Y.readable===!1,Y.endEmitted=Y.readable===!1;if(V)V.constructed=!0,V.destroyed=!1,V.closed=!1,V.closeEmitted=!1,V.errored=null,V.errorEmitted=!1,V.finalCalled=!1,V.prefinished=!1,V.ended=V.writable===!1,V.ending=V.writable===!1,V.finished=V.writable===!1}function N(Y,V,I){let{_readableState:G,_writableState:W}=Y;if(W!==null&&W!==void 0&&W.destroyed||G!==null&&G!==void 0&&G.destroyed)return this;if(G!==null&&G!==void 0&&G.autoDestroy||W!==null&&W!==void 0&&W.autoDestroy)Y.destroy(V);else if(V){if(V.stack,W&&!W.errored)W.errored=V;if(G&&!G.errored)G.errored=V;if(I)X.nextTick(v,Y,V);else v(Y,V)}}function w(Y,V){if(typeof Y._construct!=="function")return;let{_readableState:I,_writableState:G}=Y;if(I)I.constructed=!1;if(G)G.constructed=!1;if(Y.once(L,V),Y.listenerCount(L)>1)return;X.nextTick(u,Y)}function u(Y){let V=!1;function I(G){if(V){N(Y,G!==null&&G!==void 0?G:new K);return}V=!0;let{_readableState:W,_writableState:C}=Y,D=C||W;if(W)W.constructed=!0;if(C)C.constructed=!0;if(D.destroyed)Y.emit(A,G);else if(G)N(Y,G,!0);else X.nextTick(Z0,Y)}try{Y._construct((G)=>{X.nextTick(I,G)})}catch(G){X.nextTick(I,G)}}function Z0(Y){Y.emit(L)}function V0(Y){return(Y===null||Y===void 0?void 0:Y.setHeader)&&typeof Y.abort==="function"}function Y0(Y){Y.emit("close")}function b(Y,V){Y.emit("error",V),X.nextTick(Y0,Y)}function i(Y,V){if(!Y||q(Y))return;if(!V&&!z(Y))V=new H;if(T(Y))Y.socket=null,Y.destroy(V);else if(V0(Y))Y.abort();else if(V0(Y.req))Y.req.abort();else if(typeof Y.destroy==="function")Y.destroy(V);else if(typeof Y.close==="function")Y.close();else if(V)X.nextTick(b,Y,V);else X.nextTick(Y0,Y);if(!Y.destroyed)Y[M]=!0}Z.exports={construct:w,destroyer:i,destroy:S,undestroy:x,errorOrDestroy:N}}),lY=s0((U,Z)=>{var{ArrayIsArray:X,ObjectSetPrototypeOf:Q}=Z1(),{EventEmitter:K}=(NZ(),m0(xZ));function H(M){K.call(this,M)}Q(H.prototype,K.prototype),Q(H,K),H.prototype.pipe=function(M,q){let z=this;function T(B){if(M.writable&&M.write(B)===!1&&z.pause)z.pause()}z.on("data",T);function A(){if(z.readable&&z.resume)z.resume()}if(M.on("drain",A),!M._isStdio&&(!q||q.end!==!1))z.on("end",E),z.on("close",S);let L=!1;function E(){if(L)return;L=!0,M.end()}function S(){if(L)return;if(L=!0,typeof M.destroy==="function")M.destroy()}function j(B){if(k(),K.listenerCount(this,"error")===0)this.emit("error",B)}$(z,"error",j),$(M,"error",j);function k(){z.removeListener("data",T),M.removeListener("drain",A),z.removeListener("end",E),z.removeListener("close",S),z.removeListener("error",j),M.removeListener("error",j),z.removeListener("end",k),z.removeListener("close",k),M.removeListener("close",k)}return z.on("end",k),z.on("close",k),M.on("close",k),M.emit("pipe",z),M};function $(M,q,z){if(typeof M.prependListener==="function")return M.prependListener(q,z);if(!M._events||!M._events[q])M.on(q,z);else if(X(M._events[q]))M._events[q].unshift(z);else M._events[q]=[z,M._events[q]]}Z.exports={Stream:H,prependListener:$}}),PX=s0((U,Z)=>{var{SymbolDispose:X}=Z1(),{AbortError:Q,codes:K}=n1(),{isNodeStream:H,isWebStream:$,kControllerErrorFunction:M}=kU(),q=yU(),{ERR_INVALID_ARG_TYPE:z}=K,T,A=(L,E)=>{if(typeof L!=="object"||!("aborted"in L))throw new z(E,"AbortSignal",L)};Z.exports.addAbortSignal=function(L,E){if(A(L,"signal"),!H(E)&&!$(E))throw new z("stream",["ReadableStream","WritableStream","Stream"],E);return Z.exports.addAbortSignalNoValidate(L,E)},Z.exports.addAbortSignalNoValidate=function(L,E){if(typeof L!=="object"||!("aborted"in L))return E;let S=H(E)?()=>{E.destroy(new Q(void 0,{cause:L.reason}))}:()=>{E[M](new Q(void 0,{cause:L.reason}))};if(L.aborted)S();else{T=T||i1().addAbortListener;let j=T(L,S);q(E,j[X])}return E}}),MI=s0((U,Z)=>{var{StringPrototypeSlice:X,SymbolIterator:Q,TypedArrayPrototypeSet:K,Uint8Array:H}=Z1(),{Buffer:$}=(g1(),m0(N1)),{inspect:M}=i1();Z.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(q){let z={data:q,next:null};if(this.length>0)this.tail.next=z;else this.head=z;this.tail=z,++this.length}unshift(q){let z={data:q,next:this.head};if(this.length===0)this.tail=z;this.head=z,++this.length}shift(){if(this.length===0)return;let q=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,q}clear(){this.head=this.tail=null,this.length=0}join(q){if(this.length===0)return"";let z=this.head,T=""+z.data;while((z=z.next)!==null)T+=q+z.data;return T}concat(q){if(this.length===0)return $.alloc(0);let z=$.allocUnsafe(q>>>0),T=this.head,A=0;while(T)K(z,T.data,A),A+=T.data.length,T=T.next;return z}consume(q,z){let T=this.head.data;if(q<T.length){let A=T.slice(0,q);return this.head.data=T.slice(q),A}if(q===T.length)return this.shift();return z?this._getString(q):this._getBuffer(q)}first(){return this.head.data}*[Q](){for(let q=this.head;q;q=q.next)yield q.data}_getString(q){let z="",T=this.head,A=0;do{let L=T.data;if(q>L.length)z+=L,q-=L.length;else{if(q===L.length)if(z+=L,++A,T.next)this.head=T.next;else this.head=this.tail=null;else z+=X(L,0,q),this.head=T,T.data=X(L,q);break}++A}while((T=T.next)!==null);return this.length-=A,z}_getBuffer(q){let z=$.allocUnsafe(q),T=q,A=this.head,L=0;do{let E=A.data;if(q>E.length)K(z,E,T-q),q-=E.length;else{if(q===E.length)if(K(z,E,T-q),++L,A.next)this.head=A.next;else this.head=this.tail=null;else K(z,new H(E.buffer,E.byteOffset,q),T-q),this.head=A,A.data=E.slice(q);break}++L}while((A=A.next)!==null);return this.length-=L,z}[Symbol.for("nodejs.util.inspect.custom")](q,z){return M(this,{...z,depth:0,customInspect:!1})}}}),kX=s0((U,Z)=>{var{MathFloor:X,NumberIsInteger:Q}=Z1(),{validateInteger:K}=fZ(),{ERR_INVALID_ARG_VALUE:H}=n1().codes,$=16384,M=16;function q(L,E,S){return L.highWaterMark!=null?L.highWaterMark:E?L[S]:null}function z(L){return L?M:$}function T(L,E){if(K(E,"value",0),L)M=E;else $=E}function A(L,E,S,j){let k=q(E,j,S);if(k!=null){if(!Q(k)||k<0){let B=j?`options.${S}`:"options.highWaterMark";throw new H(B,k)}return X(k)}return z(L.objectMode)}Z.exports={getHighWaterMark:A,getDefaultHighWaterMark:z,setDefaultHighWaterMark:T}}),qI=s0((U,Z)=>{/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var X=(g1(),m0(N1)),Q=X.Buffer;function K($,M){for(var q in $)M[q]=$[q]}if(Q.from&&Q.alloc&&Q.allocUnsafe&&Q.allocUnsafeSlow)Z.exports=X;else K(X,U),U.Buffer=H;function H($,M,q){return Q($,M,q)}H.prototype=Object.create(Q.prototype),K(Q,H),H.from=function($,M,q){if(typeof $==="number")throw TypeError("Argument must not be a number");return Q($,M,q)},H.alloc=function($,M,q){if(typeof $!=="number")throw TypeError("Argument must be a number");var z=Q($);if(M!==void 0)if(typeof q==="string")z.fill(M,q);else z.fill(M);else z.fill(0);return z},H.allocUnsafe=function($){if(typeof $!=="number")throw TypeError("Argument must be a number");return Q($)},H.allocUnsafeSlow=function($){if(typeof $!=="number")throw TypeError("Argument must be a number");return X.SlowBuffer($)}}),LI=s0((U)=>{var Z=qI().Buffer,X=Z.isEncoding||function(v){switch(v=""+v,v&&v.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function Q(v){if(!v)return"utf8";var x;while(!0)switch(v){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return v;default:if(x)return;v=(""+v).toLowerCase(),x=!0}}function K(v){var x=Q(v);if(typeof x!=="string"&&(Z.isEncoding===X||!X(v)))throw Error("Unknown encoding: "+v);return x||v}U.StringDecoder=H;function H(v){this.encoding=K(v);var x;switch(this.encoding){case"utf16le":this.text=L,this.end=E,x=4;break;case"utf8":this.fillLast=z,x=4;break;case"base64":this.text=S,this.end=j,x=3;break;default:this.write=k,this.end=B;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Z.allocUnsafe(x)}H.prototype.write=function(v){if(v.length===0)return"";var x,N;if(this.lastNeed){if(x=this.fillLast(v),x===void 0)return"";N=this.lastNeed,this.lastNeed=0}else N=0;if(N<v.length)return x?x+this.text(v,N):this.text(v,N);return x||""},H.prototype.end=A,H.prototype.text=T,H.prototype.fillLast=function(v){if(this.lastNeed<=v.length)return v.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);v.copy(this.lastChar,this.lastTotal-this.lastNeed,0,v.length),this.lastNeed-=v.length};function $(v){if(v<=127)return 0;else if(v>>5===6)return 2;else if(v>>4===14)return 3;else if(v>>3===30)return 4;return v>>6===2?-1:-2}function M(v,x,N){var w=x.length-1;if(w<N)return 0;var u=$(x[w]);if(u>=0){if(u>0)v.lastNeed=u-1;return u}if(--w<N||u===-2)return 0;if(u=$(x[w]),u>=0){if(u>0)v.lastNeed=u-2;return u}if(--w<N||u===-2)return 0;if(u=$(x[w]),u>=0){if(u>0)if(u===2)u=0;else v.lastNeed=u-3;return u}return 0}function q(v,x,N){if((x[0]&192)!==128)return v.lastNeed=0,"�";if(v.lastNeed>1&&x.length>1){if((x[1]&192)!==128)return v.lastNeed=1,"�";if(v.lastNeed>2&&x.length>2){if((x[2]&192)!==128)return v.lastNeed=2,"�"}}}function z(v){var x=this.lastTotal-this.lastNeed,N=q(this,v,x);if(N!==void 0)return N;if(this.lastNeed<=v.length)return v.copy(this.lastChar,x,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);v.copy(this.lastChar,x,0,v.length),this.lastNeed-=v.length}function T(v,x){var N=M(this,v,x);if(!this.lastNeed)return v.toString("utf8",x);this.lastTotal=N;var w=v.length-(N-this.lastNeed);return v.copy(this.lastChar,0,w),v.toString("utf8",x,w)}function A(v){var x=v&&v.length?this.write(v):"";if(this.lastNeed)return x+"�";return x}function L(v,x){if((v.length-x)%2===0){var N=v.toString("utf16le",x);if(N){var w=N.charCodeAt(N.length-1);if(w>=55296&&w<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=v[v.length-2],this.lastChar[1]=v[v.length-1],N.slice(0,-1)}return N}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=v[v.length-1],v.toString("utf16le",x,v.length-1)}function E(v){var x=v&&v.length?this.write(v):"";if(this.lastNeed){var N=this.lastTotal-this.lastNeed;return x+this.lastChar.toString("utf16le",0,N)}return x}function S(v,x){var N=(v.length-x)%3;if(N===0)return v.toString("base64",x);if(this.lastNeed=3-N,this.lastTotal=3,N===1)this.lastChar[0]=v[v.length-1];else this.lastChar[0]=v[v.length-2],this.lastChar[1]=v[v.length-1];return v.toString("base64",x,v.length-N)}function j(v){var x=v&&v.length?this.write(v):"";if(this.lastNeed)return x+this.lastChar.toString("base64",0,3-this.lastNeed);return x}function k(v){return v.toString(this.encoding)}function B(v){return v&&v.length?this.write(v):""}}),NG=s0((U,Z)=>{var X=iU(),{PromisePrototypeThen:Q,SymbolAsyncIterator:K,SymbolIterator:H}=Z1(),{Buffer:$}=(g1(),m0(N1)),{ERR_INVALID_ARG_TYPE:M,ERR_STREAM_NULL_VALUES:q}=n1().codes;function z(T,A,L){let E;if(typeof A==="string"||A instanceof $)return new T({objectMode:!0,...L,read(){this.push(A),this.push(null)}});let S;if(A&&A[K])S=!0,E=A[K]();else if(A&&A[H])S=!1,E=A[H]();else throw new M("iterable",["Iterable"],A);let j=new T({objectMode:!0,highWaterMark:1,...L}),k=!1;j._read=function(){if(!k)k=!0,v()},j._destroy=function(x,N){Q(B(x),()=>X.nextTick(N,x),(w)=>X.nextTick(N,w||x))};async function B(x){let N=x!==void 0&&x!==null,w=typeof E.throw==="function";if(N&&w){let{value:u,done:Z0}=await E.throw(x);if(await u,Z0)return}if(typeof E.return==="function"){let{value:u}=await E.return();await u}}async function v(){for(;;){try{let{value:x,done:N}=S?await E.next():E.next();if(N)j.push(null);else{let w=x&&typeof x.then==="function"?await x:x;if(w===null)throw k=!1,new q;else if(j.push(w))continue;else k=!1}}catch(x){j.destroy(x)}break}}return j}Z.exports=z}),jX=s0((U,Z)=>{var X=iU(),{ArrayPrototypeIndexOf:Q,NumberIsInteger:K,NumberIsNaN:H,NumberParseInt:$,ObjectDefineProperties:M,ObjectKeys:q,ObjectSetPrototypeOf:z,Promise:T,SafeSet:A,SymbolAsyncDispose:L,SymbolAsyncIterator:E,Symbol:S}=Z1();Z.exports=r,r.ReadableState=g0;var{EventEmitter:j}=(NZ(),m0(xZ)),{Stream:k,prependListener:B}=lY(),{Buffer:v}=(g1(),m0(N1)),{addAbortSignal:x}=PX(),N=yU(),w=i1().debuglog("stream",(g)=>{w=g}),u=MI(),Z0=DZ(),{getHighWaterMark:V0,getDefaultHighWaterMark:Y0}=kX(),{aggregateTwoErrors:b,codes:{ERR_INVALID_ARG_TYPE:i,ERR_METHOD_NOT_IMPLEMENTED:Y,ERR_OUT_OF_RANGE:V,ERR_STREAM_PUSH_AFTER_EOF:I,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:G},AbortError:W}=n1(),{validateObject:C}=fZ(),D=S("kPaused"),{StringDecoder:F}=LI(),J=NG();z(r.prototype,k.prototype),z(r,k);var O=()=>{},{errorOrDestroy:P}=Z0,R=1,_=2,f=4,c=8,o=16,K0=32,a=64,l=128,Q0=256,n=512,s=1024,f0=2048,y=4096,h=8192,G0=16384,t=32768,U0=65536,L0=131072,p=262144;function m(g){return{enumerable:!1,get(){return(this.state&g)!==0},set(d){if(d)this.state|=g;else this.state&=~g}}}M(g0.prototype,{objectMode:m(R),ended:m(_),endEmitted:m(f),reading:m(c),constructed:m(o),sync:m(K0),needReadable:m(a),emittedReadable:m(l),readableListening:m(Q0),resumeScheduled:m(n),errorEmitted:m(s),emitClose:m(f0),autoDestroy:m(y),destroyed:m(h),closed:m(G0),closeEmitted:m(t),multiAwaitDrain:m(U0),readingMore:m(L0),dataEmitted:m(p)});function g0(g,d,e){if(typeof e!=="boolean")e=d instanceof PU();if(this.state=f0|y|o|K0,g&&g.objectMode)this.state|=R;if(e&&g&&g.readableObjectMode)this.state|=R;if(this.highWaterMark=g?V0(this,g,"readableHighWaterMark",e):Y0(!1),this.buffer=new u,this.length=0,this.pipes=[],this.flowing=null,this[D]=null,g&&g.emitClose===!1)this.state&=~f0;if(g&&g.autoDestroy===!1)this.state&=~y;if(this.errored=null,this.defaultEncoding=g&&g.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,g&&g.encoding)this.decoder=new F(g.encoding),this.encoding=g.encoding}function r(g){if(!(this instanceof r))return new r(g);let d=this instanceof PU();if(this._readableState=new g0(g,this,d),g){if(typeof g.read==="function")this._read=g.read;if(typeof g.destroy==="function")this._destroy=g.destroy;if(typeof g.construct==="function")this._construct=g.construct;if(g.signal&&!d)x(g.signal,this)}k.call(this,g),Z0.construct(this,()=>{if(this._readableState.needReadable)M0(this,this._readableState)})}r.prototype.destroy=Z0.destroy,r.prototype._undestroy=Z0.undestroy,r.prototype._destroy=function(g,d){d(g)},r.prototype[j.captureRejectionSymbol]=function(g){this.destroy(g)},r.prototype[L]=function(){let g;if(!this.destroyed)g=this.readableEnded?null:new W,this.destroy(g);return new T((d,e)=>N(this,(X0)=>X0&&X0!==g?e(X0):d(null)))},r.prototype.push=function(g,d){return J0(this,g,d,!1)},r.prototype.unshift=function(g,d){return J0(this,g,d,!0)};function J0(g,d,e,X0){w("readableAddChunk",d);let y0=g._readableState,H0;if((y0.state&R)===0){if(typeof d==="string"){if(e=e||y0.defaultEncoding,y0.encoding!==e)if(X0&&y0.encoding)d=v.from(d,e).toString(y0.encoding);else d=v.from(d,e),e=""}else if(d instanceof v)e="";else if(k._isUint8Array(d))d=k._uint8ArrayToBuffer(d),e="";else if(d!=null)H0=new i("chunk",["string","Buffer","Uint8Array"],d)}if(H0)P(g,H0);else if(d===null)y0.state&=~c,I0(g,y0);else if((y0.state&R)!==0||d&&d.length>0)if(X0)if((y0.state&f)!==0)P(g,new G);else if(y0.destroyed||y0.errored)return!1;else h0(g,y0,d,!0);else if(y0.ended)P(g,new I);else if(y0.destroyed||y0.errored)return!1;else if(y0.state&=~c,y0.decoder&&!e)if(d=y0.decoder.write(d),y0.objectMode||d.length!==0)h0(g,y0,d,!1);else M0(g,y0);else h0(g,y0,d,!1);else if(!X0)y0.state&=~c,M0(g,y0);return!y0.ended&&(y0.length<y0.highWaterMark||y0.length===0)}function h0(g,d,e,X0){if(d.flowing&&d.length===0&&!d.sync&&g.listenerCount("data")>0){if((d.state&U0)!==0)d.awaitDrainWriters.clear();else d.awaitDrainWriters=null;d.dataEmitted=!0,g.emit("data",e)}else{if(d.length+=d.objectMode?1:e.length,X0)d.buffer.unshift(e);else d.buffer.push(e);if((d.state&a)!==0)C0(g)}M0(g,d)}r.prototype.isPaused=function(){let g=this._readableState;return g[D]===!0||g.flowing===!1},r.prototype.setEncoding=function(g){let d=new F(g);this._readableState.decoder=d,this._readableState.encoding=this._readableState.decoder.encoding;let e=this._readableState.buffer,X0="";for(let y0 of e)X0+=d.write(y0);if(e.clear(),X0!=="")e.push(X0);return this._readableState.length=X0.length,this};var F0=1073741824;function O0(g){if(g>F0)throw new V("size","<= 1GiB",g);else g--,g|=g>>>1,g|=g>>>2,g|=g>>>4,g|=g>>>8,g|=g>>>16,g++;return g}function J1(g,d){if(g<=0||d.length===0&&d.ended)return 0;if((d.state&R)!==0)return 1;if(H(g)){if(d.flowing&&d.length)return d.buffer.first().length;return d.length}if(g<=d.length)return g;return d.ended?d.length:0}r.prototype.read=function(g){if(w("read",g),g===void 0)g=NaN;else if(!K(g))g=$(g,10);let d=this._readableState,e=g;if(g>d.highWaterMark)d.highWaterMark=O0(g);if(g!==0)d.state&=~l;if(g===0&&d.needReadable&&((d.highWaterMark!==0?d.length>=d.highWaterMark:d.length>0)||d.ended)){if(w("read: emitReadable",d.length,d.ended),d.length===0&&d.ended)_1(this);else C0(this);return null}if(g=J1(g,d),g===0&&d.ended){if(d.length===0)_1(this);return null}let X0=(d.state&a)!==0;if(w("need readable",X0),d.length===0||d.length-g<d.highWaterMark)X0=!0,w("length less than watermark",X0);if(d.ended||d.reading||d.destroyed||d.errored||!d.constructed)X0=!1,w("reading, ended or constructing",X0);else if(X0){if(w("do read"),d.state|=c|K0,d.length===0)d.state|=a;try{this._read(d.highWaterMark)}catch(H0){P(this,H0)}if(d.state&=~K0,!d.reading)g=J1(e,d)}let y0;if(g>0)y0=E0(g,d);else y0=null;if(y0===null)d.needReadable=d.length<=d.highWaterMark,g=0;else if(d.length-=g,d.multiAwaitDrain)d.awaitDrainWriters.clear();else d.awaitDrainWriters=null;if(d.length===0){if(!d.ended)d.needReadable=!0;if(e!==g&&d.ended)_1(this)}if(y0!==null&&!d.errorEmitted&&!d.closeEmitted)d.dataEmitted=!0,this.emit("data",y0);return y0};function I0(g,d){if(w("onEofChunk"),d.ended)return;if(d.decoder){let e=d.decoder.end();if(e&&e.length)d.buffer.push(e),d.length+=d.objectMode?1:e.length}if(d.ended=!0,d.sync)C0(g);else d.needReadable=!1,d.emittedReadable=!0,K1(g)}function C0(g){let d=g._readableState;if(w("emitReadable",d.needReadable,d.emittedReadable),d.needReadable=!1,!d.emittedReadable)w("emitReadable",d.flowing),d.emittedReadable=!0,X.nextTick(K1,g)}function K1(g){let d=g._readableState;if(w("emitReadable_",d.destroyed,d.length,d.ended),!d.destroyed&&!d.errored&&(d.length||d.ended))g.emit("readable"),d.emittedReadable=!1;d.needReadable=!d.flowing&&!d.ended&&d.length<=d.highWaterMark,R0(g)}function M0(g,d){if(!d.readingMore&&d.constructed)d.readingMore=!0,X.nextTick(z0,g,d)}function z0(g,d){while(!d.reading&&!d.ended&&(d.length<d.highWaterMark||d.flowing&&d.length===0)){let e=d.length;if(w("maybeReadMore read 0"),g.read(0),e===d.length)break}d.readingMore=!1}r.prototype._read=function(g){throw new Y("_read()")},r.prototype.pipe=function(g,d){let e=this,X0=this._readableState;if(X0.pipes.length===1){if(!X0.multiAwaitDrain)X0.multiAwaitDrain=!0,X0.awaitDrainWriters=new A(X0.awaitDrainWriters?[X0.awaitDrainWriters]:[])}X0.pipes.push(g),w("pipe count=%d opts=%j",X0.pipes.length,d);let y0=(!d||d.end!==!1)&&g!==X.stdout&&g!==X.stderr?A0:b0;if(X0.endEmitted)X.nextTick(y0);else e.once("end",y0);g.on("unpipe",H0);function H0(t0,r0){if(w("onunpipe"),t0===e){if(r0&&r0.hasUnpiped===!1)r0.hasUnpiped=!0,N0()}}function A0(){w("onend"),g.end()}let Q1,P0=!1;function N0(){if(w("cleanup"),g.removeListener("close",G1),g.removeListener("finish",l0),Q1)g.removeListener("drain",Q1);if(g.removeListener("error",q0),g.removeListener("unpipe",H0),e.removeListener("end",A0),e.removeListener("end",b0),e.removeListener("data",k0),P0=!0,Q1&&X0.awaitDrainWriters&&(!g._writableState||g._writableState.needDrain))Q1()}function u1(){if(!P0){if(X0.pipes.length===1&&X0.pipes[0]===g)w("false write response, pause",0),X0.awaitDrainWriters=g,X0.multiAwaitDrain=!1;else if(X0.pipes.length>1&&X0.pipes.includes(g))w("false write response, pause",X0.awaitDrainWriters.size),X0.awaitDrainWriters.add(g);e.pause()}if(!Q1)Q1=d1(e,g),g.on("drain",Q1)}e.on("data",k0);function k0(t0){w("ondata");let r0=g.write(t0);if(w("dest.write",r0),r0===!1)u1()}function q0(t0){if(w("onerror",t0),b0(),g.removeListener("error",q0),g.listenerCount("error")===0){let r0=g._writableState||g._readableState;if(r0&&!r0.errorEmitted)P(g,t0);else g.emit("error",t0)}}B(g,"error",q0);function G1(){g.removeListener("finish",l0),b0()}g.once("close",G1);function l0(){w("onfinish"),g.removeListener("close",G1),b0()}g.once("finish",l0);function b0(){w("unpipe"),e.unpipe(g)}if(g.emit("pipe",e),g.writableNeedDrain===!0)u1();else if(!X0.flowing)w("pipe resume"),e.resume();return g};function d1(g,d){return function(){let e=g._readableState;if(e.awaitDrainWriters===d)w("pipeOnDrain",1),e.awaitDrainWriters=null;else if(e.multiAwaitDrain)w("pipeOnDrain",e.awaitDrainWriters.size),e.awaitDrainWriters.delete(d);if((!e.awaitDrainWriters||e.awaitDrainWriters.size===0)&&g.listenerCount("data"))g.resume()}}r.prototype.unpipe=function(g){let d=this._readableState,e={hasUnpiped:!1};if(d.pipes.length===0)return this;if(!g){let y0=d.pipes;d.pipes=[],this.pause();for(let H0=0;H0<y0.length;H0++)y0[H0].emit("unpipe",this,{hasUnpiped:!1});return this}let X0=Q(d.pipes,g);if(X0===-1)return this;if(d.pipes.splice(X0,1),d.pipes.length===0)this.pause();return g.emit("unpipe",this,e),this},r.prototype.on=function(g,d){let e=k.prototype.on.call(this,g,d),X0=this._readableState;if(g==="data"){if(X0.readableListening=this.listenerCount("readable")>0,X0.flowing!==!1)this.resume()}else if(g==="readable"){if(!X0.endEmitted&&!X0.readableListening){if(X0.readableListening=X0.needReadable=!0,X0.flowing=!1,X0.emittedReadable=!1,w("on readable",X0.length,X0.reading),X0.length)C0(this);else if(!X0.reading)X.nextTick(j0,this)}}return e},r.prototype.addListener=r.prototype.on,r.prototype.removeListener=function(g,d){let e=k.prototype.removeListener.call(this,g,d);if(g==="readable")X.nextTick(T0,this);return e},r.prototype.off=r.prototype.removeListener,r.prototype.removeAllListeners=function(g){let d=k.prototype.removeAllListeners.apply(this,arguments);if(g==="readable"||g===void 0)X.nextTick(T0,this);return d};function T0(g){let d=g._readableState;if(d.readableListening=g.listenerCount("readable")>0,d.resumeScheduled&&d[D]===!1)d.flowing=!0;else if(g.listenerCount("data")>0)g.resume();else if(!d.readableListening)d.flowing=null}function j0(g){w("readable nexttick read 0"),g.read(0)}r.prototype.resume=function(){let g=this._readableState;if(!g.flowing)w("resume"),g.flowing=!g.readableListening,l1(this,g);return g[D]=!1,this};function l1(g,d){if(!d.resumeScheduled)d.resumeScheduled=!0,X.nextTick(v0,g,d)}function v0(g,d){if(w("resume",d.reading),!d.reading)g.read(0);if(d.resumeScheduled=!1,g.emit("resume"),R0(g),d.flowing&&!d.reading)g.read(0)}r.prototype.pause=function(){if(w("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1)w("pause"),this._readableState.flowing=!1,this.emit("pause");return this._readableState[D]=!0,this};function R0(g){let d=g._readableState;w("flow",d.flowing);while(d.flowing&&g.read()!==null);}r.prototype.wrap=function(g){let d=!1;g.on("data",(X0)=>{if(!this.push(X0)&&g.pause)d=!0,g.pause()}),g.on("end",()=>{this.push(null)}),g.on("error",(X0)=>{P(this,X0)}),g.on("close",()=>{this.destroy()}),g.on("destroy",()=>{this.destroy()}),this._read=()=>{if(d&&g.resume)d=!1,g.resume()};let e=q(g);for(let X0=1;X0<e.length;X0++){let y0=e[X0];if(this[y0]===void 0&&typeof g[y0]==="function")this[y0]=g[y0].bind(g)}return this},r.prototype[E]=function(){return h1(this)},r.prototype.iterator=function(g){if(g!==void 0)C(g,"options");return h1(this,g)};function h1(g,d){if(typeof g.read!=="function")g=r.wrap(g,{objectMode:!0});let e=_0(g,d);return e.stream=g,e}async function*_0(g,d){let e=O;function X0(A0){if(this===g)e(),e=O;else e=A0}g.on("readable",X0);let y0,H0=N(g,{writable:!1},(A0)=>{y0=A0?b(y0,A0):null,e(),e=O});try{while(!0){let A0=g.destroyed?null:g.read();if(A0!==null)yield A0;else if(y0)throw y0;else if(y0===null)return;else await new T(X0)}}catch(A0){throw y0=b(y0,A0),y0}finally{if((y0||(d===null||d===void 0?void 0:d.destroyOnReturn)!==!1)&&(y0===void 0||g._readableState.autoDestroy))Z0.destroyer(g,null);else g.off("readable",X0),H0()}}M(r.prototype,{readable:{__proto__:null,get(){let g=this._readableState;return!!g&&g.readable!==!1&&!g.destroyed&&!g.errorEmitted&&!g.endEmitted},set(g){if(this._readableState)this._readableState.readable=!!g}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(g){if(this._readableState)this._readableState.flowing=g}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(g){if(!this._readableState)return;this._readableState.destroyed=g}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),M(g0.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[D]!==!1},set(g){this[D]=!!g}}}),r._fromList=E0;function E0(g,d){if(d.length===0)return null;let e;if(d.objectMode)e=d.buffer.shift();else if(!g||g>=d.length){if(d.decoder)e=d.buffer.join("");else if(d.buffer.length===1)e=d.buffer.first();else e=d.buffer.concat(d.length);d.buffer.clear()}else e=d.buffer.consume(g,d.decoder);return e}function _1(g){let d=g._readableState;if(w("endReadable",d.endEmitted),!d.endEmitted)d.ended=!0,X.nextTick(B0,d,g)}function B0(g,d){if(w("endReadableNT",g.endEmitted,g.length),!g.errored&&!g.closeEmitted&&!g.endEmitted&&g.length===0){if(g.endEmitted=!0,d.emit("end"),d.writable&&d.allowHalfOpen===!1)X.nextTick(x0,d);else if(g.autoDestroy){let e=d._writableState;if(!e||e.autoDestroy&&(e.finished||e.writable===!1))d.destroy()}}}function x0(g){if(g.writable&&!g.writableEnded&&!g.destroyed)g.end()}r.from=function(g,d){return J(r,g,d)};var B1;function S0(){if(B1===void 0)B1={};return B1}r.fromWeb=function(g,d){return S0().newStreamReadableFromReadableStream(g,d)},r.toWeb=function(g,d){return S0().newReadableStreamFromStreamReadable(g,d)},r.wrap=function(g,d){var e,X0;return new r({objectMode:(e=(X0=g.readableObjectMode)!==null&&X0!==void 0?X0:g.objectMode)!==null&&e!==void 0?e:!0,...d,destroy(y0,H0){Z0.destroyer(g,y0),H0(y0)}}).wrap(g)}}),oY=s0((U,Z)=>{var X=iU(),{ArrayPrototypeSlice:Q,Error:K,FunctionPrototypeSymbolHasInstance:H,ObjectDefineProperty:$,ObjectDefineProperties:M,ObjectSetPrototypeOf:q,StringPrototypeToLowerCase:z,Symbol:T,SymbolHasInstance:A}=Z1();Z.exports=C,C.WritableState=G;var{EventEmitter:L}=(NZ(),m0(xZ)),E=lY().Stream,{Buffer:S}=(g1(),m0(N1)),j=DZ(),{addAbortSignal:k}=PX(),{getHighWaterMark:B,getDefaultHighWaterMark:v}=kX(),{ERR_INVALID_ARG_TYPE:x,ERR_METHOD_NOT_IMPLEMENTED:N,ERR_MULTIPLE_CALLBACK:w,ERR_STREAM_CANNOT_PIPE:u,ERR_STREAM_DESTROYED:Z0,ERR_STREAM_ALREADY_FINISHED:V0,ERR_STREAM_NULL_VALUES:Y0,ERR_STREAM_WRITE_AFTER_END:b,ERR_UNKNOWN_ENCODING:i}=n1().codes,{errorOrDestroy:Y}=j;q(C.prototype,E.prototype),q(C,E);function V(){}var I=T("kOnFinished");function G(y,h,G0){if(typeof G0!=="boolean")G0=h instanceof PU();if(this.objectMode=!!(y&&y.objectMode),G0)this.objectMode=this.objectMode||!!(y&&y.writableObjectMode);this.highWaterMark=y?B(this,y,"writableHighWaterMark",G0):v(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let t=!!(y&&y.decodeStrings===!1);this.decodeStrings=!t,this.defaultEncoding=y&&y.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=P.bind(void 0,h),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,W(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!y||y.emitClose!==!1,this.autoDestroy=!y||y.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[I]=[]}function W(y){y.buffered=[],y.bufferedIndex=0,y.allBuffers=!0,y.allNoop=!0}G.prototype.getBuffer=function(){return Q(this.buffered,this.bufferedIndex)},$(G.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function C(y){let h=this instanceof PU();if(!h&&!H(C,this))return new C(y);if(this._writableState=new G(y,this,h),y){if(typeof y.write==="function")this._write=y.write;if(typeof y.writev==="function")this._writev=y.writev;if(typeof y.destroy==="function")this._destroy=y.destroy;if(typeof y.final==="function")this._final=y.final;if(typeof y.construct==="function")this._construct=y.construct;if(y.signal)k(y.signal,this)}E.call(this,y),j.construct(this,()=>{let G0=this._writableState;if(!G0.writing)c(this,G0);l(this,G0)})}$(C,A,{__proto__:null,value:function(y){if(H(this,y))return!0;if(this!==C)return!1;return y&&y._writableState instanceof G}}),C.prototype.pipe=function(){Y(this,new u)};function D(y,h,G0,t){let U0=y._writableState;if(typeof G0==="function")t=G0,G0=U0.defaultEncoding;else{if(!G0)G0=U0.defaultEncoding;else if(G0!=="buffer"&&!S.isEncoding(G0))throw new i(G0);if(typeof t!=="function")t=V}if(h===null)throw new Y0;else if(!U0.objectMode)if(typeof h==="string"){if(U0.decodeStrings!==!1)h=S.from(h,G0),G0="buffer"}else if(h instanceof S)G0="buffer";else if(E._isUint8Array(h))h=E._uint8ArrayToBuffer(h),G0="buffer";else throw new x("chunk",["string","Buffer","Uint8Array"],h);let L0;if(U0.ending)L0=new b;else if(U0.destroyed)L0=new Z0("write");if(L0)return X.nextTick(t,L0),Y(y,L0,!0),L0;return U0.pendingcb++,F(y,U0,h,G0,t)}C.prototype.write=function(y,h,G0){return D(this,y,h,G0)===!0},C.prototype.cork=function(){this._writableState.corked++},C.prototype.uncork=function(){let y=this._writableState;if(y.corked){if(y.corked--,!y.writing)c(this,y)}},C.prototype.setDefaultEncoding=function(y){if(typeof y==="string")y=z(y);if(!S.isEncoding(y))throw new i(y);return this._writableState.defaultEncoding=y,this};function F(y,h,G0,t,U0){let L0=h.objectMode?1:G0.length;h.length+=L0;let p=h.length<h.highWaterMark;if(!p)h.needDrain=!0;if(h.writing||h.corked||h.errored||!h.constructed){if(h.buffered.push({chunk:G0,encoding:t,callback:U0}),h.allBuffers&&t!=="buffer")h.allBuffers=!1;if(h.allNoop&&U0!==V)h.allNoop=!1}else h.writelen=L0,h.writecb=U0,h.writing=!0,h.sync=!0,y._write(G0,t,h.onwrite),h.sync=!1;return p&&!h.errored&&!h.destroyed}function J(y,h,G0,t,U0,L0,p){if(h.writelen=t,h.writecb=p,h.writing=!0,h.sync=!0,h.destroyed)h.onwrite(new Z0("write"));else if(G0)y._writev(U0,h.onwrite);else y._write(U0,L0,h.onwrite);h.sync=!1}function O(y,h,G0,t){--h.pendingcb,t(G0),f(h),Y(y,G0)}function P(y,h){let G0=y._writableState,t=G0.sync,U0=G0.writecb;if(typeof U0!=="function"){Y(y,new w);return}if(G0.writing=!1,G0.writecb=null,G0.length-=G0.writelen,G0.writelen=0,h){if(h.stack,!G0.errored)G0.errored=h;if(y._readableState&&!y._readableState.errored)y._readableState.errored=h;if(t)X.nextTick(O,y,G0,h,U0);else O(y,G0,h,U0)}else{if(G0.buffered.length>G0.bufferedIndex)c(y,G0);if(t)if(G0.afterWriteTickInfo!==null&&G0.afterWriteTickInfo.cb===U0)G0.afterWriteTickInfo.count++;else G0.afterWriteTickInfo={count:1,cb:U0,stream:y,state:G0},X.nextTick(R,G0.afterWriteTickInfo);else _(y,G0,1,U0)}}function R({stream:y,state:h,count:G0,cb:t}){return h.afterWriteTickInfo=null,_(y,h,G0,t)}function _(y,h,G0,t){if(!h.ending&&!y.destroyed&&h.length===0&&h.needDrain)h.needDrain=!1,y.emit("drain");while(G0-- >0)h.pendingcb--,t();if(h.destroyed)f(h);l(y,h)}function f(y){if(y.writing)return;for(let U0=y.bufferedIndex;U0<y.buffered.length;++U0){var h;let{chunk:L0,callback:p}=y.buffered[U0],m=y.objectMode?1:L0.length;y.length-=m,p((h=y.errored)!==null&&h!==void 0?h:new Z0("write"))}let G0=y[I].splice(0);for(let U0=0;U0<G0.length;U0++){var t;G0[U0]((t=y.errored)!==null&&t!==void 0?t:new Z0("end"))}W(y)}function c(y,h){if(h.corked||h.bufferProcessing||h.destroyed||!h.constructed)return;let{buffered:G0,bufferedIndex:t,objectMode:U0}=h,L0=G0.length-t;if(!L0)return;let p=t;if(h.bufferProcessing=!0,L0>1&&y._writev){h.pendingcb-=L0-1;let m=h.allNoop?V:(r)=>{for(let J0=p;J0<G0.length;++J0)G0[J0].callback(r)},g0=h.allNoop&&p===0?G0:Q(G0,p);g0.allBuffers=h.allBuffers,J(y,h,!0,h.length,g0,"",m),W(h)}else{do{let{chunk:m,encoding:g0,callback:r}=G0[p];G0[p++]=null;let J0=U0?1:m.length;J(y,h,!1,J0,m,g0,r)}while(p<G0.length&&!h.writing);if(p===G0.length)W(h);else if(p>256)G0.splice(0,p),h.bufferedIndex=0;else h.bufferedIndex=p}h.bufferProcessing=!1}C.prototype._write=function(y,h,G0){if(this._writev)this._writev([{chunk:y,encoding:h}],G0);else throw new N("_write()")},C.prototype._writev=null,C.prototype.end=function(y,h,G0){let t=this._writableState;if(typeof y==="function")G0=y,y=null,h=null;else if(typeof h==="function")G0=h,h=null;let U0;if(y!==null&&y!==void 0){let L0=D(this,y,h);if(L0 instanceof K)U0=L0}if(t.corked)t.corked=1,this.uncork();if(U0);else if(!t.errored&&!t.ending)t.ending=!0,l(this,t,!0),t.ended=!0;else if(t.finished)U0=new V0("end");else if(t.destroyed)U0=new Z0("end");if(typeof G0==="function")if(U0||t.finished)X.nextTick(G0,U0);else t[I].push(G0);return this};function o(y){return y.ending&&!y.destroyed&&y.constructed&&y.length===0&&!y.errored&&y.buffered.length===0&&!y.finished&&!y.writing&&!y.errorEmitted&&!y.closeEmitted}function K0(y,h){let G0=!1;function t(U0){if(G0){Y(y,U0!==null&&U0!==void 0?U0:w());return}if(G0=!0,h.pendingcb--,U0){let L0=h[I].splice(0);for(let p=0;p<L0.length;p++)L0[p](U0);Y(y,U0,h.sync)}else if(o(h))h.prefinished=!0,y.emit("prefinish"),h.pendingcb++,X.nextTick(Q0,y,h)}h.sync=!0,h.pendingcb++;try{y._final(t)}catch(U0){t(U0)}h.sync=!1}function a(y,h){if(!h.prefinished&&!h.finalCalled)if(typeof y._final==="function"&&!h.destroyed)h.finalCalled=!0,K0(y,h);else h.prefinished=!0,y.emit("prefinish")}function l(y,h,G0){if(o(h)){if(a(y,h),h.pendingcb===0){if(G0)h.pendingcb++,X.nextTick((t,U0)=>{if(o(U0))Q0(t,U0);else U0.pendingcb--},y,h);else if(o(h))h.pendingcb++,Q0(y,h)}}}function Q0(y,h){h.pendingcb--,h.finished=!0;let G0=h[I].splice(0);for(let t=0;t<G0.length;t++)G0[t]();if(y.emit("finish"),h.autoDestroy){let t=y._readableState;if(!t||t.autoDestroy&&(t.endEmitted||t.readable===!1))y.destroy()}}M(C.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(y){if(this._writableState)this._writableState.destroyed=y}},writable:{__proto__:null,get(){let y=this._writableState;return!!y&&y.writable!==!1&&!y.destroyed&&!y.errored&&!y.ending&&!y.ended},set(y){if(this._writableState)this._writableState.writable=!!y}},writableFinished:{__proto__:null,get(){return this._writableState?this._writableState.finished:!1}},writableObjectMode:{__proto__:null,get(){return this._writableState?this._writableState.objectMode:!1}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return this._writableState?this._writableState.ending:!1}},writableNeedDrain:{__proto__:null,get(){let y=this._writableState;if(!y)return!1;return!y.destroyed&&!y.ending&&y.needDrain}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._writableState.writable!==!1&&(this._writableState.destroyed||this._writableState.errored)&&!this._writableState.finished)}}});var n=j.destroy;C.prototype.destroy=function(y,h){let G0=this._writableState;if(!G0.destroyed&&(G0.bufferedIndex<G0.buffered.length||G0[I].length))X.nextTick(f,G0);return n.call(this,y,h),this},C.prototype._undestroy=j.undestroy,C.prototype._destroy=function(y,h){h(y)},C.prototype[L.captureRejectionSymbol]=function(y){this.destroy(y)};var s;function f0(){if(s===void 0)s={};return s}C.fromWeb=function(y,h){return f0().newStreamWritableFromWritableStream(y,h)},C.toWeb=function(y){return f0().newWritableStreamFromStreamWritable(y)}}),TI=s0((U,Z)=>{var X=iU(),Q=(g1(),m0(N1)),{isReadable:K,isWritable:H,isIterable:$,isNodeStream:M,isReadableNodeStream:q,isWritableNodeStream:z,isDuplexNodeStream:T,isReadableStream:A,isWritableStream:L}=kU(),E=yU(),{AbortError:S,codes:{ERR_INVALID_ARG_TYPE:j,ERR_INVALID_RETURN_VALUE:k}}=n1(),{destroyer:B}=DZ(),v=PU(),x=jX(),N=oY(),{createDeferredPromise:w}=i1(),u=NG(),Z0=globalThis.Blob||Q.Blob,V0=typeof Z0<"u"?function(I){return I instanceof Z0}:function(I){return!1},Y0=globalThis.AbortController||gZ().AbortController,{FunctionPrototypeCall:b}=Z1();class i extends v{constructor(I){super(I);if((I===null||I===void 0?void 0:I.readable)===!1)this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0;if((I===null||I===void 0?void 0:I.writable)===!1)this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0}}Z.exports=function I(G,W){if(T(G))return G;if(q(G))return V({readable:G});if(z(G))return V({writable:G});if(M(G))return V({writable:!1,readable:!1});if(A(G))return V({readable:x.fromWeb(G)});if(L(G))return V({writable:N.fromWeb(G)});if(typeof G==="function"){let{value:D,write:F,final:J,destroy:O}=Y(G);if($(D))return u(i,D,{objectMode:!0,write:F,final:J,destroy:O});let P=D===null||D===void 0?void 0:D.then;if(typeof P==="function"){let R,_=b(P,D,(f)=>{if(f!=null)throw new k("nully","body",f)},(f)=>{B(R,f)});return R=new i({objectMode:!0,readable:!1,write:F,final(f){J(async()=>{try{await _,X.nextTick(f,null)}catch(c){X.nextTick(f,c)}})},destroy:O})}throw new k("Iterable, AsyncIterable or AsyncFunction",W,D)}if(V0(G))return I(G.arrayBuffer());if($(G))return u(i,G,{objectMode:!0,writable:!1});if(A(G===null||G===void 0?void 0:G.readable)&&L(G===null||G===void 0?void 0:G.writable))return i.fromWeb(G);if(typeof(G===null||G===void 0?void 0:G.writable)==="object"||typeof(G===null||G===void 0?void 0:G.readable)==="object"){let D=G!==null&&G!==void 0&&G.readable?q(G===null||G===void 0?void 0:G.readable)?G===null||G===void 0?void 0:G.readable:I(G.readable):void 0,F=G!==null&&G!==void 0&&G.writable?z(G===null||G===void 0?void 0:G.writable)?G===null||G===void 0?void 0:G.writable:I(G.writable):void 0;return V({readable:D,writable:F})}let C=G===null||G===void 0?void 0:G.then;if(typeof C==="function"){let D;return b(C,G,(F)=>{if(F!=null)D.push(F);D.push(null)},(F)=>{B(D,F)}),D=new i({objectMode:!0,writable:!1,read(){}})}throw new j(W,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],G)};function Y(I){let{promise:G,resolve:W}=w(),C=new Y0,D=C.signal;return{value:I(async function*(){while(!0){let F=G;G=null;let{chunk:J,done:O,cb:P}=await F;if(X.nextTick(P),O)return;if(D.aborted)throw new S(void 0,{cause:D.reason});({promise:G,resolve:W}=w()),yield J}}(),{signal:D}),write(F,J,O){let P=W;W=null,P({chunk:F,done:!1,cb:O})},final(F){let J=W;W=null,J({done:!0,cb:F})},destroy(F,J){C.abort(),J(F)}}}function V(I){let G=I.readable&&typeof I.readable.read!=="function"?x.wrap(I.readable):I.readable,W=I.writable,C=!!K(G),D=!!H(W),F,J,O,P,R;function _(f){let c=P;if(P=null,c)c(f);else if(f)R.destroy(f)}if(R=new i({readableObjectMode:!!(G!==null&&G!==void 0&&G.readableObjectMode),writableObjectMode:!!(W!==null&&W!==void 0&&W.writableObjectMode),readable:C,writable:D}),D)E(W,(f)=>{if(D=!1,f)B(G,f);_(f)}),R._write=function(f,c,o){if(W.write(f,c))o();else F=o},R._final=function(f){W.end(),J=f},W.on("drain",function(){if(F){let f=F;F=null,f()}}),W.on("finish",function(){if(J){let f=J;J=null,f()}});if(C)E(G,(f)=>{if(C=!1,f)B(G,f);_(f)}),G.on("readable",function(){if(O){let f=O;O=null,f()}}),G.on("end",function(){R.push(null)}),R._read=function(){while(!0){let f=G.read();if(f===null){O=R._read;return}if(!R.push(f))return}};return R._destroy=function(f,c){if(!f&&P!==null)f=new S;if(O=null,F=null,J=null,P===null)c(f);else P=c,B(W,f),B(G,f)},R}}),PU=s0((U,Z)=>{var{ObjectDefineProperties:X,ObjectGetOwnPropertyDescriptor:Q,ObjectKeys:K,ObjectSetPrototypeOf:H}=Z1();Z.exports=q;var $=jX(),M=oY();H(q.prototype,$.prototype),H(q,$);{let L=K(M.prototype);for(let E=0;E<L.length;E++){let S=L[E];if(!q.prototype[S])q.prototype[S]=M.prototype[S]}}function q(L){if(!(this instanceof q))return new q(L);if($.call(this,L),M.call(this,L),L){if(this.allowHalfOpen=L.allowHalfOpen!==!1,L.readable===!1)this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0;if(L.writable===!1)this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0}else this.allowHalfOpen=!0}X(q.prototype,{writable:{__proto__:null,...Q(M.prototype,"writable")},writableHighWaterMark:{__proto__:null,...Q(M.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...Q(M.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...Q(M.prototype,"writableBuffer")},writableLength:{__proto__:null,...Q(M.prototype,"writableLength")},writableFinished:{__proto__:null,...Q(M.prototype,"writableFinished")},writableCorked:{__proto__:null,...Q(M.prototype,"writableCorked")},writableEnded:{__proto__:null,...Q(M.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...Q(M.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){if(this._readableState===void 0||this._writableState===void 0)return!1;return this._readableState.destroyed&&this._writableState.destroyed},set(L){if(this._readableState&&this._writableState)this._readableState.destroyed=L,this._writableState.destroyed=L}}});var z;function T(){if(z===void 0)z={};return z}q.fromWeb=function(L,E){return T().newStreamDuplexFromReadableWritablePair(L,E)},q.toWeb=function(L){return T().newReadableWritablePairFromDuplex(L)};var A;q.from=function(L){if(!A)A=TI();return A(L,"body")}}),gG=s0((U,Z)=>{var{ObjectSetPrototypeOf:X,Symbol:Q}=Z1();Z.exports=q;var{ERR_METHOD_NOT_IMPLEMENTED:K}=n1().codes,H=PU(),{getHighWaterMark:$}=kX();X(q.prototype,H.prototype),X(q,H);var M=Q("kCallback");function q(A){if(!(this instanceof q))return new q(A);let L=A?$(this,A,"readableHighWaterMark",!0):null;if(L===0)A={...A,highWaterMark:null,readableHighWaterMark:L,writableHighWaterMark:A.writableHighWaterMark||0};if(H.call(this,A),this._readableState.sync=!1,this[M]=null,A){if(typeof A.transform==="function")this._transform=A.transform;if(typeof A.flush==="function")this._flush=A.flush}this.on("prefinish",T)}function z(A){if(typeof this._flush==="function"&&!this.destroyed)this._flush((L,E)=>{if(L){if(A)A(L);else this.destroy(L);return}if(E!=null)this.push(E);if(this.push(null),A)A()});else if(this.push(null),A)A()}function T(){if(this._final!==z)z.call(this)}q.prototype._final=z,q.prototype._transform=function(A,L,E){throw new K("_transform()")},q.prototype._write=function(A,L,E){let S=this._readableState,j=this._writableState,k=S.length;this._transform(A,L,(B,v)=>{if(B){E(B);return}if(v!=null)this.push(v);if(j.ended||k===S.length||S.length<S.highWaterMark)E();else this[M]=E})},q.prototype._read=function(){if(this[M]){let A=this[M];this[M]=null,A()}}}),fG=s0((U,Z)=>{var{ObjectSetPrototypeOf:X}=Z1();Z.exports=K;var Q=gG();X(K.prototype,Q.prototype),X(K,Q);function K(H){if(!(this instanceof K))return new K(H);Q.call(this,H)}K.prototype._transform=function(H,$,M){M(null,H)}}),nY=s0((U,Z)=>{var X=iU(),{ArrayIsArray:Q,Promise:K,SymbolAsyncIterator:H,SymbolDispose:$}=Z1(),M=yU(),{once:q}=i1(),z=DZ(),T=PU(),{aggregateTwoErrors:A,codes:{ERR_INVALID_ARG_TYPE:L,ERR_INVALID_RETURN_VALUE:E,ERR_MISSING_ARGS:S,ERR_STREAM_DESTROYED:j,ERR_STREAM_PREMATURE_CLOSE:k},AbortError:B}=n1(),{validateFunction:v,validateAbortSignal:x}=fZ(),{isIterable:N,isReadable:w,isReadableNodeStream:u,isNodeStream:Z0,isTransformStream:V0,isWebStream:Y0,isReadableStream:b,isReadableFinished:i}=kU(),Y=globalThis.AbortController||gZ().AbortController,V,I,G;function W(f,c,o){let K0=!1;f.on("close",()=>{K0=!0});let a=M(f,{readable:c,writable:o},(l)=>{K0=!l});return{destroy:(l)=>{if(K0)return;K0=!0,z.destroyer(f,l||new j("pipe"))},cleanup:a}}function C(f){return v(f[f.length-1],"streams[stream.length - 1]"),f.pop()}function D(f){if(N(f))return f;else if(u(f))return F(f);throw new L("val",["Readable","Iterable","AsyncIterable"],f)}async function*F(f){if(!I)I=jX();yield*I.prototype[H].call(f)}async function J(f,c,o,{end:K0}){let a,l=null,Q0=(f0)=>{if(f0)a=f0;if(l){let y=l;l=null,y()}},n=()=>new K((f0,y)=>{if(a)y(a);else l=()=>{if(a)y(a);else f0()}});c.on("drain",Q0);let s=M(c,{readable:!1},Q0);try{if(c.writableNeedDrain)await n();for await(let f0 of f)if(!c.write(f0))await n();if(K0)c.end(),await n();o()}catch(f0){o(a!==f0?A(a,f0):f0)}finally{s(),c.off("drain",Q0)}}async function O(f,c,o,{end:K0}){if(V0(c))c=c.writable;let a=c.getWriter();try{for await(let l of f)await a.ready,a.write(l).catch(()=>{});if(await a.ready,K0)await a.close();o()}catch(l){try{await a.abort(l),o(l)}catch(Q0){o(Q0)}}}function P(...f){return R(f,q(C(f)))}function R(f,c,o){if(f.length===1&&Q(f[0]))f=f[0];if(f.length<2)throw new S("streams");let K0=new Y,a=K0.signal,l=o===null||o===void 0?void 0:o.signal,Q0=[];x(l,"options.signal");function n(){U0(new B)}G=G||i1().addAbortListener;let s;if(l)s=G(l,n);let f0,y,h=[],G0=0;function t(r){U0(r,--G0===0)}function U0(r,J0){var h0;if(r&&(!f0||f0.code==="ERR_STREAM_PREMATURE_CLOSE"))f0=r;if(!f0&&!J0)return;while(h.length)h.shift()(f0);if((h0=s)===null||h0===void 0||h0[$](),K0.abort(),J0){if(!f0)Q0.forEach((F0)=>F0());X.nextTick(c,f0,y)}}let L0;for(let r=0;r<f.length;r++){let J0=f[r],h0=r<f.length-1,F0=r>0,O0=h0||(o===null||o===void 0?void 0:o.end)!==!1,J1=r===f.length-1;if(Z0(J0)){let I0=function(C0){if(C0&&C0.name!=="AbortError"&&C0.code!=="ERR_STREAM_PREMATURE_CLOSE")t(C0)};var p=I0;if(O0){let{destroy:C0,cleanup:K1}=W(J0,h0,F0);if(h.push(C0),w(J0)&&J1)Q0.push(K1)}if(J0.on("error",I0),w(J0)&&J1)Q0.push(()=>{J0.removeListener("error",I0)})}if(r===0)if(typeof J0==="function"){if(L0=J0({signal:a}),!N(L0))throw new E("Iterable, AsyncIterable or Stream","source",L0)}else if(N(J0)||u(J0)||V0(J0))L0=J0;else L0=T.from(J0);else if(typeof J0==="function"){if(V0(L0)){var m;L0=D((m=L0)===null||m===void 0?void 0:m.readable)}else L0=D(L0);if(L0=J0(L0,{signal:a}),h0){if(!N(L0,!0))throw new E("AsyncIterable",`transform[${r-1}]`,L0)}else{var g0;if(!V)V=fG();let I0=new V({objectMode:!0}),C0=(g0=L0)===null||g0===void 0?void 0:g0.then;if(typeof C0==="function")G0++,C0.call(L0,(z0)=>{if(y=z0,z0!=null)I0.write(z0);if(O0)I0.end();X.nextTick(t)},(z0)=>{I0.destroy(z0),X.nextTick(t,z0)});else if(N(L0,!0))G0++,J(L0,I0,t,{end:O0});else if(b(L0)||V0(L0)){let z0=L0.readable||L0;G0++,J(z0,I0,t,{end:O0})}else throw new E("AsyncIterable or Promise","destination",L0);L0=I0;let{destroy:K1,cleanup:M0}=W(L0,!1,!0);if(h.push(K1),J1)Q0.push(M0)}}else if(Z0(J0)){if(u(L0)){G0+=2;let I0=_(L0,J0,t,{end:O0});if(w(J0)&&J1)Q0.push(I0)}else if(V0(L0)||b(L0)){let I0=L0.readable||L0;G0++,J(I0,J0,t,{end:O0})}else if(N(L0))G0++,J(L0,J0,t,{end:O0});else throw new L("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],L0);L0=J0}else if(Y0(J0)){if(u(L0))G0++,O(D(L0),J0,t,{end:O0});else if(b(L0)||N(L0))G0++,O(L0,J0,t,{end:O0});else if(V0(L0))G0++,O(L0.readable,J0,t,{end:O0});else throw new L("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],L0);L0=J0}else L0=T.from(J0)}if(a!==null&&a!==void 0&&a.aborted||l!==null&&l!==void 0&&l.aborted)X.nextTick(n);return L0}function _(f,c,o,{end:K0}){let a=!1;if(c.on("close",()=>{if(!a)o(new k)}),f.pipe(c,{end:!1}),K0){let Q0=function(){a=!0,c.end()};var l=Q0;if(i(f))X.nextTick(Q0);else f.once("end",Q0)}else o();return M(f,{readable:!0,writable:!1},(Q0)=>{let n=f._readableState;if(Q0&&Q0.code==="ERR_STREAM_PREMATURE_CLOSE"&&n&&n.ended&&!n.errored&&!n.errorEmitted)f.once("end",o).once("error",o);else o(Q0)}),M(c,{readable:!1,writable:!0},o)}Z.exports={pipelineImpl:R,pipeline:P}}),wG=s0((U,Z)=>{var{pipeline:X}=nY(),Q=PU(),{destroyer:K}=DZ(),{isNodeStream:H,isReadable:$,isWritable:M,isWebStream:q,isTransformStream:z,isWritableStream:T,isReadableStream:A}=kU(),{AbortError:L,codes:{ERR_INVALID_ARG_VALUE:E,ERR_MISSING_ARGS:S}}=n1(),j=yU();Z.exports=function(...k){if(k.length===0)throw new S("streams");if(k.length===1)return Q.from(k[0]);let B=[...k];if(typeof k[0]==="function")k[0]=Q.from(k[0]);if(typeof k[k.length-1]==="function"){let Y=k.length-1;k[Y]=Q.from(k[Y])}for(let Y=0;Y<k.length;++Y){if(!H(k[Y])&&!q(k[Y]))continue;if(Y<k.length-1&&!($(k[Y])||A(k[Y])||z(k[Y])))throw new E(`streams[${Y}]`,B[Y],"must be readable");if(Y>0&&!(M(k[Y])||T(k[Y])||z(k[Y])))throw new E(`streams[${Y}]`,B[Y],"must be writable")}let v,x,N,w,u;function Z0(Y){let V=w;if(w=null,V)V(Y);else if(Y)u.destroy(Y);else if(!i&&!b)u.destroy()}let V0=k[0],Y0=X(k,Z0),b=!!(M(V0)||T(V0)||z(V0)),i=!!($(Y0)||A(Y0)||z(Y0));if(u=new Q({writableObjectMode:!!(V0!==null&&V0!==void 0&&V0.writableObjectMode),readableObjectMode:!!(Y0!==null&&Y0!==void 0&&Y0.readableObjectMode),writable:b,readable:i}),b){if(H(V0))u._write=function(V,I,G){if(V0.write(V,I))G();else v=G},u._final=function(V){V0.end(),x=V},V0.on("drain",function(){if(v){let V=v;v=null,V()}});else if(q(V0)){let V=(z(V0)?V0.writable:V0).getWriter();u._write=async function(I,G,W){try{await V.ready,V.write(I).catch(()=>{}),W()}catch(C){W(C)}},u._final=async function(I){try{await V.ready,V.close().catch(()=>{}),x=I}catch(G){I(G)}}}let Y=z(Y0)?Y0.readable:Y0;j(Y,()=>{if(x){let V=x;x=null,V()}})}if(i){if(H(Y0))Y0.on("readable",function(){if(N){let Y=N;N=null,Y()}}),Y0.on("end",function(){u.push(null)}),u._read=function(){while(!0){let Y=Y0.read();if(Y===null){N=u._read;return}if(!u.push(Y))return}};else if(q(Y0)){let Y=(z(Y0)?Y0.readable:Y0).getReader();u._read=async function(){while(!0)try{let{value:V,done:I}=await Y.read();if(!u.push(V))return;if(I){u.push(null);return}}catch{return}}}}return u._destroy=function(Y,V){if(!Y&&w!==null)Y=new L;if(N=null,v=null,x=null,w===null)V(Y);else if(w=V,H(Y0))K(Y0,Y)},u}}),RI=s0((U,Z)=>{var X=globalThis.AbortController||gZ().AbortController,{codes:{ERR_INVALID_ARG_VALUE:Q,ERR_INVALID_ARG_TYPE:K,ERR_MISSING_ARGS:H,ERR_OUT_OF_RANGE:$},AbortError:M}=n1(),{validateAbortSignal:q,validateInteger:z,validateObject:T}=fZ(),A=Z1().Symbol("kWeak"),L=Z1().Symbol("kResistStopPropagation"),{finished:E}=yU(),S=wG(),{addAbortSignalNoValidate:j}=PX(),{isWritable:k,isNodeStream:B}=kU(),{deprecate:v}=i1(),{ArrayPrototypePush:x,Boolean:N,MathFloor:w,Number:u,NumberIsNaN:Z0,Promise:V0,PromiseReject:Y0,PromiseResolve:b,PromisePrototypeThen:i,Symbol:Y}=Z1(),V=Y("kEmpty"),I=Y("kEof");function G(l,Q0){if(Q0!=null)T(Q0,"options");if((Q0===null||Q0===void 0?void 0:Q0.signal)!=null)q(Q0.signal,"options.signal");if(B(l)&&!k(l))throw new Q("stream",l,"must be writable");let n=S(this,l);if(Q0!==null&&Q0!==void 0&&Q0.signal)j(Q0.signal,n);return n}function W(l,Q0){if(typeof l!=="function")throw new K("fn",["Function","AsyncFunction"],l);if(Q0!=null)T(Q0,"options");if((Q0===null||Q0===void 0?void 0:Q0.signal)!=null)q(Q0.signal,"options.signal");let n=1;if((Q0===null||Q0===void 0?void 0:Q0.concurrency)!=null)n=w(Q0.concurrency);let s=n-1;if((Q0===null||Q0===void 0?void 0:Q0.highWaterMark)!=null)s=w(Q0.highWaterMark);return z(n,"options.concurrency",1),z(s,"options.highWaterMark",0),s+=n,async function*(){let f0=i1().AbortSignalAny([Q0===null||Q0===void 0?void 0:Q0.signal].filter(N)),y=this,h=[],G0={signal:f0},t,U0,L0=!1,p=0;function m(){L0=!0,g0()}function g0(){p-=1,r()}function r(){if(U0&&!L0&&p<n&&h.length<s)U0(),U0=null}async function J0(){try{for await(let h0 of y){if(L0)return;if(f0.aborted)throw new M;try{if(h0=l(h0,G0),h0===V)continue;h0=b(h0)}catch(F0){h0=Y0(F0)}if(p+=1,i(h0,g0,m),h.push(h0),t)t(),t=null;if(!L0&&(h.length>=s||p>=n))await new V0((F0)=>{U0=F0})}h.push(I)}catch(h0){let F0=Y0(h0);i(F0,g0,m),h.push(F0)}finally{if(L0=!0,t)t(),t=null}}J0();try{while(!0){while(h.length>0){let h0=await h[0];if(h0===I)return;if(f0.aborted)throw new M;if(h0!==V)yield h0;h.shift(),r()}await new V0((h0)=>{t=h0})}}finally{if(L0=!0,U0)U0(),U0=null}}.call(this)}function C(l=void 0){if(l!=null)T(l,"options");if((l===null||l===void 0?void 0:l.signal)!=null)q(l.signal,"options.signal");return async function*(){let Q0=0;for await(let s of this){var n;if(l!==null&&l!==void 0&&(n=l.signal)!==null&&n!==void 0&&n.aborted)throw new M({cause:l.signal.reason});yield[Q0++,s]}}.call(this)}async function D(l,Q0=void 0){for await(let n of P.call(this,l,Q0))return!0;return!1}async function F(l,Q0=void 0){if(typeof l!=="function")throw new K("fn",["Function","AsyncFunction"],l);return!await D.call(this,async(...n)=>{return!await l(...n)},Q0)}async function J(l,Q0){for await(let n of P.call(this,l,Q0))return n;return}async function O(l,Q0){if(typeof l!=="function")throw new K("fn",["Function","AsyncFunction"],l);async function n(s,f0){return await l(s,f0),V}for await(let s of W.call(this,n,Q0));}function P(l,Q0){if(typeof l!=="function")throw new K("fn",["Function","AsyncFunction"],l);async function n(s,f0){if(await l(s,f0))return s;return V}return W.call(this,n,Q0)}class R extends H{constructor(){super("reduce");this.message="Reduce of an empty stream requires an initial value"}}async function _(l,Q0,n){var s;if(typeof l!=="function")throw new K("reducer",["Function","AsyncFunction"],l);if(n!=null)T(n,"options");if((n===null||n===void 0?void 0:n.signal)!=null)q(n.signal,"options.signal");let f0=arguments.length>1;if(n!==null&&n!==void 0&&(s=n.signal)!==null&&s!==void 0&&s.aborted){let U0=new M(void 0,{cause:n.signal.reason});throw this.once("error",()=>{}),await E(this.destroy(U0)),U0}let y=new X,h=y.signal;if(n!==null&&n!==void 0&&n.signal){let U0={once:!0,[A]:this,[L]:!0};n.signal.addEventListener("abort",()=>y.abort(),U0)}let G0=!1;try{for await(let U0 of this){var t;if(G0=!0,n!==null&&n!==void 0&&(t=n.signal)!==null&&t!==void 0&&t.aborted)throw new M;if(!f0)Q0=U0,f0=!0;else Q0=await l(Q0,U0,{signal:h})}if(!G0&&!f0)throw new R}finally{y.abort()}return Q0}async function f(l){if(l!=null)T(l,"options");if((l===null||l===void 0?void 0:l.signal)!=null)q(l.signal,"options.signal");let Q0=[];for await(let s of this){var n;if(l!==null&&l!==void 0&&(n=l.signal)!==null&&n!==void 0&&n.aborted)throw new M(void 0,{cause:l.signal.reason});x(Q0,s)}return Q0}function c(l,Q0){let n=W.call(this,l,Q0);return async function*(){for await(let s of n)yield*s}.call(this)}function o(l){if(l=u(l),Z0(l))return 0;if(l<0)throw new $("number",">= 0",l);return l}function K0(l,Q0=void 0){if(Q0!=null)T(Q0,"options");if((Q0===null||Q0===void 0?void 0:Q0.signal)!=null)q(Q0.signal,"options.signal");return l=o(l),async function*(){var n;if(Q0!==null&&Q0!==void 0&&(n=Q0.signal)!==null&&n!==void 0&&n.aborted)throw new M;for await(let f0 of this){var s;if(Q0!==null&&Q0!==void 0&&(s=Q0.signal)!==null&&s!==void 0&&s.aborted)throw new M;if(l--<=0)yield f0}}.call(this)}function a(l,Q0=void 0){if(Q0!=null)T(Q0,"options");if((Q0===null||Q0===void 0?void 0:Q0.signal)!=null)q(Q0.signal,"options.signal");return l=o(l),async function*(){var n;if(Q0!==null&&Q0!==void 0&&(n=Q0.signal)!==null&&n!==void 0&&n.aborted)throw new M;for await(let f0 of this){var s;if(Q0!==null&&Q0!==void 0&&(s=Q0.signal)!==null&&s!==void 0&&s.aborted)throw new M;if(l-- >0)yield f0;if(l<=0)return}}.call(this)}Z.exports.streamReturningOperators={asIndexedPairs:v(C,"readable.asIndexedPairs will be removed in a future version."),drop:K0,filter:P,flatMap:c,map:W,take:a,compose:G},Z.exports.promiseReturningOperators={every:F,forEach:O,reduce:_,toArray:f,some:D,find:J}}),yG=s0((U,Z)=>{var{ArrayPrototypePop:X,Promise:Q}=Z1(),{isIterable:K,isNodeStream:H,isWebStream:$}=kU(),{pipelineImpl:M}=nY(),{finished:q}=yU();cG();function z(...T){return new Q((A,L)=>{let E,S,j=T[T.length-1];if(j&&typeof j==="object"&&!H(j)&&!K(j)&&!$(j)){let k=X(T);E=k.signal,S=k.end}M(T,(k,B)=>{if(k)L(k);else A(B)},{signal:E,end:S})})}Z.exports={finished:q,pipeline:z}}),cG=s0((U,Z)=>{var{Buffer:X}=(g1(),m0(N1)),{ObjectDefineProperty:Q,ObjectKeys:K,ReflectApply:H}=Z1(),{promisify:{custom:$}}=i1(),{streamReturningOperators:M,promiseReturningOperators:q}=RI(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:z}}=n1(),T=wG(),{setDefaultHighWaterMark:A,getDefaultHighWaterMark:L}=kX(),{pipeline:E}=nY(),{destroyer:S}=DZ(),j=yU(),k=yG(),B=kU(),v=Z.exports=lY().Stream;v.isDestroyed=B.isDestroyed,v.isDisturbed=B.isDisturbed,v.isErrored=B.isErrored,v.isReadable=B.isReadable,v.isWritable=B.isWritable,v.Readable=jX();for(let N of K(M)){let w=function(...Z0){if(new.target)throw z();return v.Readable.from(H(u,this,Z0))},u=M[N];Q(w,"name",{__proto__:null,value:u.name}),Q(w,"length",{__proto__:null,value:u.length}),Q(v.Readable.prototype,N,{__proto__:null,value:w,enumerable:!1,configurable:!0,writable:!0})}for(let N of K(q)){let w=function(...Z0){if(new.target)throw z();return H(u,this,Z0)},u=q[N];Q(w,"name",{__proto__:null,value:u.name}),Q(w,"length",{__proto__:null,value:u.length}),Q(v.Readable.prototype,N,{__proto__:null,value:w,enumerable:!1,configurable:!0,writable:!0})}v.Writable=oY(),v.Duplex=PU(),v.Transform=gG(),v.PassThrough=fG(),v.pipeline=E;var{addAbortSignal:x}=PX();v.addAbortSignal=x,v.finished=j,v.destroy=S,v.compose=T,v.setDefaultHighWaterMark=A,v.getDefaultHighWaterMark=L,Q(v,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return k}}),Q(E,$,{__proto__:null,enumerable:!0,get(){return k.pipeline}}),Q(j,$,{__proto__:null,enumerable:!0,get(){return k.finished}}),v.Stream=v,v._isUint8Array=function(N){return N instanceof Uint8Array},v._uint8ArrayToBuffer=function(N){return X.from(N.buffer,N.byteOffset,N.byteLength)}}),EI=s0((U,Z)=>{var X=mY();{let Q=cG(),K=yG(),H=Q.Readable.destroy;Z.exports=Q.Readable,Z.exports._uint8ArrayToBuffer=Q._uint8ArrayToBuffer,Z.exports._isUint8Array=Q._isUint8Array,Z.exports.isDisturbed=Q.isDisturbed,Z.exports.isErrored=Q.isErrored,Z.exports.isReadable=Q.isReadable,Z.exports.Readable=Q.Readable,Z.exports.Writable=Q.Writable,Z.exports.Duplex=Q.Duplex,Z.exports.Transform=Q.Transform,Z.exports.PassThrough=Q.PassThrough,Z.exports.addAbortSignal=Q.addAbortSignal,Z.exports.finished=Q.finished,Z.exports.destroy=Q.destroy,Z.exports.destroy=H,Z.exports.pipeline=Q.pipeline,Z.exports.compose=Q.compose,Object.defineProperty(Q,"promises",{configurable:!0,enumerable:!0,get(){return K}}),Z.exports.Stream=Q.Stream}Z.exports.default=Z.exports});pG.exports=EI()});var e1={};WZ(e1,{webcrypto:()=>tF,rng:()=>KF,randomUUID:()=>sF,randomFillSync:()=>dF,randomFill:()=>bF,randomBytes:()=>WF,publicEncrypt:()=>cF,publicDecrypt:()=>hF,pseudoRandomBytes:()=>$F,prng:()=>VF,privateEncrypt:()=>pF,privateDecrypt:()=>uF,pbkdf2Sync:()=>zF,pbkdf2:()=>AF,listCiphers:()=>kF,getRandomValues:()=>mF,getHashes:()=>CF,getDiffieHellman:()=>_F,getCurves:()=>aF,getCiphers:()=>PF,default:()=>iF,createVerify:()=>fF,createSign:()=>NF,createHmac:()=>OF,createHash:()=>HF,createECDH:()=>yF,createDiffieHellmanGroup:()=>vF,createDiffieHellman:()=>BF,createDecipheriv:()=>SF,createDecipher:()=>RF,createCredentials:()=>lF,createCipheriv:()=>LF,createCipher:()=>MF,constants:()=>oF,Verify:()=>wF,Sign:()=>gF,Hmac:()=>FF,Hash:()=>IF,DiffieHellmanGroup:()=>jF,DiffieHellman:()=>xF,Decipheriv:()=>EF,Decipher:()=>TF,DEFAULT_ENCODING:()=>nF,Cipheriv:()=>qF,Cipher:()=>DF});function aF(){return rF}var SI,PI,hG,kI,jI,vI=(U,Z,X)=>{X=U!=null?SI(PI(U)):{};let Q=Z||!U||!U.__esModule?hG(X,"default",{value:U,enumerable:!0}):X;for(let K of kI(U))if(!jI.call(Q,K))hG(Q,K,{get:()=>U[K],enumerable:!0});return Q},$0=(U,Z)=>()=>(Z||U((Z={exports:{}}).exports,Z),Z.exports),vX,_X,bG,_I,rY,aY,m1,BI,yZ,dG,xI,NI,gI,fI,lG,wI,yI,cI,pI,hI,uI,bI,dI,lI,oI,cZ,BX,oG,nI,nG,mG,mI,pZ,tY,iY,sI,sG,eY,rI,rG,aI,aG,tG,tI,iI,eI,UH,ZH,XH,YH,JH,QH,GH,VH,$H,KH,WH,UJ,iG,IH,eG,HH,FH,OH,CH,jU,cU,UV,WU,ZV,xX,AH,YU,zH,DH,MH,XV,DU,hZ,YV,qH,JV,LH,QV,TH,RH,EH,SH,ZJ,PH,XJ,kH,jH,vH,_H,BH,xH,NH,gH,fH,wH,yH,cH,pH,hH,uG,uH,wZ,bH,GV,VV,dH,lH,$V,oH,nH,uZ,mH,sH,rH,aH,tH,iH,KV,eH,WV,IV,HV,YJ,FV,UF,OV,ZF,XF,sY,YF,JF,QF,GF,o0,VF,$F,KF,WF,IF,HF,FF,OF,CF,AF,zF,DF,MF,qF,LF,TF,RF,EF,SF,PF,kF,jF,vF,_F,BF,xF,NF,gF,fF,wF,yF,cF,pF,hF,uF,bF,dF,lF,oF,nF="buffer",mF=(U)=>{return crypto.getRandomValues(U)},sF=()=>{return crypto.randomUUID()},rF,tF,iF;var UU=IZ(()=>{SI=Object.create,{getPrototypeOf:PI,defineProperty:hG,getOwnPropertyNames:kI}=Object,jI=Object.prototype.hasOwnProperty,vX=$0((U,Z)=>{Z.exports=(UU(),m0(e1)).randomBytes}),_X=$0((U,Z)=>{Z.exports=(UU(),m0(e1)).createHash}),bG=$0((U,Z)=>{Z.exports=(UU(),m0(e1)).createHmac}),_I=$0((U,Z)=>{Z.exports={sha224WithRSAEncryption:{sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption:{sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption:{sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption:{sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA512":{sign:"ecdsa/rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA1":{sign:"rsa",hash:"sha1",id:"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{sign:"ecdsa",hash:"sha1",id:""},sha256:{sign:"ecdsa",hash:"sha256",id:""},sha224:{sign:"ecdsa",hash:"sha224",id:""},sha384:{sign:"ecdsa",hash:"sha384",id:""},sha512:{sign:"ecdsa",hash:"sha512",id:""},"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA:{sign:"dsa",hash:"sha1",id:""},"DSA-WITH-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-WITH-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-WITH-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-WITH-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-RIPEMD160":{sign:"dsa",hash:"rmd160",id:""},ripemd160WithRSA:{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption:{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}}}),rY=$0((U,Z)=>{var X=isFinite,Q=Math.pow(2,30)-1;Z.exports=function(K,H){if(typeof K!=="number")throw TypeError("Iterations not a number");if(K<0||!X(K))throw TypeError("Bad iterations");if(typeof H!=="number")throw TypeError("Key length not a number");if(H<0||H>Q||H!==H)throw TypeError("Bad key length")}}),aY=$0((U,Z)=>{var X;if(globalThis.process&&globalThis.process.browser)X="utf-8";else if(globalThis.process&&globalThis.process.version)Q=parseInt(process.version.split(".")[0].slice(1),10),X=Q>=6?"utf-8":"binary";else X="utf-8";var Q;Z.exports=X}),m1=$0((U,Z)=>{/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var X=(g1(),m0(N1)),Q=X.Buffer;function K($,M){for(var q in $)M[q]=$[q]}if(Q.from&&Q.alloc&&Q.allocUnsafe&&Q.allocUnsafeSlow)Z.exports=X;else K(X,U),U.Buffer=H;function H($,M,q){return Q($,M,q)}H.prototype=Object.create(Q.prototype),K(Q,H),H.from=function($,M,q){if(typeof $==="number")throw TypeError("Argument must not be a number");return Q($,M,q)},H.alloc=function($,M,q){if(typeof $!=="number")throw TypeError("Argument must be a number");var z=Q($);if(M!==void 0)if(typeof q==="string")z.fill(M,q);else z.fill(M);else z.fill(0);return z},H.allocUnsafe=function($){if(typeof $!=="number")throw TypeError("Argument must be a number");return Q($)},H.allocUnsafeSlow=function($){if(typeof $!=="number")throw TypeError("Argument must be a number");return X.SlowBuffer($)}}),BI=$0((U,Z)=>{var X={}.toString;Z.exports=Array.isArray||function(Q){return X.call(Q)=="[object Array]"}}),yZ=$0((U,Z)=>{Z.exports=TypeError}),dG=$0((U,Z)=>{Z.exports=Object}),xI=$0((U,Z)=>{Z.exports=Error}),NI=$0((U,Z)=>{Z.exports=EvalError}),gI=$0((U,Z)=>{Z.exports=RangeError}),fI=$0((U,Z)=>{Z.exports=ReferenceError}),lG=$0((U,Z)=>{Z.exports=SyntaxError}),wI=$0((U,Z)=>{Z.exports=URIError}),yI=$0((U,Z)=>{Z.exports=Math.abs}),cI=$0((U,Z)=>{Z.exports=Math.floor}),pI=$0((U,Z)=>{Z.exports=Math.max}),hI=$0((U,Z)=>{Z.exports=Math.min}),uI=$0((U,Z)=>{Z.exports=Math.pow}),bI=$0((U,Z)=>{Z.exports=Math.round}),dI=$0((U,Z)=>{Z.exports=Number.isNaN||function(X){return X!==X}}),lI=$0((U,Z)=>{var X=dI();Z.exports=function(Q){if(X(Q)||Q===0)return Q;return Q<0?-1:1}}),oI=$0((U,Z)=>{Z.exports=Object.getOwnPropertyDescriptor}),cZ=$0((U,Z)=>{var X=oI();if(X)try{X([],"length")}catch(Q){X=null}Z.exports=X}),BX=$0((U,Z)=>{var X=Object.defineProperty||!1;if(X)try{X({},"a",{value:1})}catch(Q){X=!1}Z.exports=X}),oG=$0((U,Z)=>{Z.exports=function(){if(typeof Symbol!=="function"||typeof Object.getOwnPropertySymbols!=="function")return!1;if(typeof Symbol.iterator==="symbol")return!0;var X={},Q=Symbol("test"),K=Object(Q);if(typeof Q==="string")return!1;if(Object.prototype.toString.call(Q)!=="[object Symbol]")return!1;if(Object.prototype.toString.call(K)!=="[object Symbol]")return!1;var H=42;X[Q]=H;for(var $ in X)return!1;if(typeof Object.keys==="function"&&Object.keys(X).length!==0)return!1;if(typeof Object.getOwnPropertyNames==="function"&&Object.getOwnPropertyNames(X).length!==0)return!1;var M=Object.getOwnPropertySymbols(X);if(M.length!==1||M[0]!==Q)return!1;if(!Object.prototype.propertyIsEnumerable.call(X,Q))return!1;if(typeof Object.getOwnPropertyDescriptor==="function"){var q=Object.getOwnPropertyDescriptor(X,Q);if(q.value!==H||q.enumerable!==!0)return!1}return!0}}),nI=$0((U,Z)=>{var X=typeof Symbol<"u"&&Symbol,Q=oG();Z.exports=function(){if(typeof X!=="function")return!1;if(typeof Symbol!=="function")return!1;if(typeof X("foo")!=="symbol")return!1;if(typeof Symbol("bar")!=="symbol")return!1;return Q()}}),nG=$0((U,Z)=>{Z.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null}),mG=$0((U,Z)=>{var X=dG();Z.exports=X.getPrototypeOf||null}),mI=$0((U,Z)=>{var X="Function.prototype.bind called on incompatible ",Q=Object.prototype.toString,K=Math.max,H="[object Function]",$=function(z,T){var A=[];for(var L=0;L<z.length;L+=1)A[L]=z[L];for(var E=0;E<T.length;E+=1)A[E+z.length]=T[E];return A},M=function(z,T){var A=[];for(var L=T||0,E=0;L<z.length;L+=1,E+=1)A[E]=z[L];return A},q=function(z,T){var A="";for(var L=0;L<z.length;L+=1)if(A+=z[L],L+1<z.length)A+=T;return A};Z.exports=function(z){var T=this;if(typeof T!=="function"||Q.apply(T)!==H)throw TypeError(X+T);var A=M(arguments,1),L,E=function(){if(this instanceof L){var v=T.apply(this,$(A,arguments));if(Object(v)===v)return v;return this}return T.apply(z,$(A,arguments))},S=K(0,T.length-A.length),j=[];for(var k=0;k<S;k++)j[k]="$"+k;if(L=Function("binder","return function ("+q(j,",")+"){ return binder.apply(this,arguments); }")(E),T.prototype){var B=function(){};B.prototype=T.prototype,L.prototype=new B,B.prototype=null}return L}}),pZ=$0((U,Z)=>{var X=mI();Z.exports=Function.prototype.bind||X}),tY=$0((U,Z)=>{Z.exports=Function.prototype.call}),iY=$0((U,Z)=>{Z.exports=Function.prototype.apply}),sI=$0((U,Z)=>{Z.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply}),sG=$0((U,Z)=>{var X=pZ(),Q=iY(),K=tY(),H=sI();Z.exports=H||X.call(K,Q)}),eY=$0((U,Z)=>{var X=pZ(),Q=yZ(),K=tY(),H=sG();Z.exports=function($){if($.length<1||typeof $[0]!=="function")throw new Q("a function is required");return H(X,K,$)}}),rI=$0((U,Z)=>{var X=eY(),Q=cZ(),K;try{K=[].__proto__===Array.prototype}catch(q){if(!q||typeof q!=="object"||!("code"in q)||q.code!=="ERR_PROTO_ACCESS")throw q}var H=!!K&&Q&&Q(Object.prototype,"__proto__"),$=Object,M=$.getPrototypeOf;Z.exports=H&&typeof H.get==="function"?X([H.get]):typeof M==="function"?function(q){return M(q==null?q:$(q))}:!1}),rG=$0((U,Z)=>{var X=nG(),Q=mG(),K=rI();Z.exports=X?function(H){return X(H)}:Q?function(H){if(!H||typeof H!=="object"&&typeof H!=="function")throw TypeError("getProto: not an object");return Q(H)}:K?function(H){return K(H)}:null}),aI=$0((U,Z)=>{var X=Function.prototype.call,Q=Object.prototype.hasOwnProperty,K=pZ();Z.exports=K.call(X,Q)}),aG=$0((U,Z)=>{var X,Q=dG(),K=xI(),H=NI(),$=gI(),M=fI(),q=lG(),z=yZ(),T=wI(),A=yI(),L=cI(),E=pI(),S=hI(),j=uI(),k=bI(),B=lI(),v=Function,x=function(Q0){try{return v('"use strict"; return ('+Q0+").constructor;")()}catch(n){}},N=cZ(),w=BX(),u=function(){throw new z},Z0=N?function(){try{return arguments.callee,u}catch(Q0){try{return N(arguments,"callee").get}catch(n){return u}}}():u,V0=nI()(),Y0=rG(),b=mG(),i=nG(),Y=iY(),V=tY(),I={},G=typeof Uint8Array>"u"||!Y0?X:Y0(Uint8Array),W={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?X:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?X:ArrayBuffer,"%ArrayIteratorPrototype%":V0&&Y0?Y0([][Symbol.iterator]()):X,"%AsyncFromSyncIteratorPrototype%":X,"%AsyncFunction%":I,"%AsyncGenerator%":I,"%AsyncGeneratorFunction%":I,"%AsyncIteratorPrototype%":I,"%Atomics%":typeof Atomics>"u"?X:Atomics,"%BigInt%":typeof BigInt>"u"?X:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?X:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?X:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?X:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":K,"%eval%":eval,"%EvalError%":H,"%Float16Array%":typeof Float16Array>"u"?X:Float16Array,"%Float32Array%":typeof Float32Array>"u"?X:Float32Array,"%Float64Array%":typeof Float64Array>"u"?X:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?X:FinalizationRegistry,"%Function%":v,"%GeneratorFunction%":I,"%Int8Array%":typeof Int8Array>"u"?X:Int8Array,"%Int16Array%":typeof Int16Array>"u"?X:Int16Array,"%Int32Array%":typeof Int32Array>"u"?X:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":V0&&Y0?Y0(Y0([][Symbol.iterator]())):X,"%JSON%":typeof JSON==="object"?JSON:X,"%Map%":typeof Map>"u"?X:Map,"%MapIteratorPrototype%":typeof Map>"u"||!V0||!Y0?X:Y0(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Q,"%Object.getOwnPropertyDescriptor%":N,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?X:Promise,"%Proxy%":typeof Proxy>"u"?X:Proxy,"%RangeError%":$,"%ReferenceError%":M,"%Reflect%":typeof Reflect>"u"?X:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?X:Set,"%SetIteratorPrototype%":typeof Set>"u"||!V0||!Y0?X:Y0(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?X:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":V0&&Y0?Y0(""[Symbol.iterator]()):X,"%Symbol%":V0?Symbol:X,"%SyntaxError%":q,"%ThrowTypeError%":Z0,"%TypedArray%":G,"%TypeError%":z,"%Uint8Array%":typeof Uint8Array>"u"?X:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?X:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?X:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?X:Uint32Array,"%URIError%":T,"%WeakMap%":typeof WeakMap>"u"?X:WeakMap,"%WeakRef%":typeof WeakRef>"u"?X:WeakRef,"%WeakSet%":typeof WeakSet>"u"?X:WeakSet,"%Function.prototype.call%":V,"%Function.prototype.apply%":Y,"%Object.defineProperty%":w,"%Object.getPrototypeOf%":b,"%Math.abs%":A,"%Math.floor%":L,"%Math.max%":E,"%Math.min%":S,"%Math.pow%":j,"%Math.round%":k,"%Math.sign%":B,"%Reflect.getPrototypeOf%":i};if(Y0)try{null.error}catch(Q0){C=Y0(Y0(Q0)),W["%Error.prototype%"]=C}var C,D=function Q0(n){var s;if(n==="%AsyncFunction%")s=x("async function () {}");else if(n==="%GeneratorFunction%")s=x("function* () {}");else if(n==="%AsyncGeneratorFunction%")s=x("async function* () {}");else if(n==="%AsyncGenerator%"){var f0=Q0("%AsyncGeneratorFunction%");if(f0)s=f0.prototype}else if(n==="%AsyncIteratorPrototype%"){var y=Q0("%AsyncGenerator%");if(y&&Y0)s=Y0(y.prototype)}return W[n]=s,s},F={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},J=pZ(),O=aI(),P=J.call(V,Array.prototype.concat),R=J.call(Y,Array.prototype.splice),_=J.call(V,String.prototype.replace),f=J.call(V,String.prototype.slice),c=J.call(V,RegExp.prototype.exec),o=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,K0=/\\(\\)?/g,a=function(Q0){var n=f(Q0,0,1),s=f(Q0,-1);if(n==="%"&&s!=="%")throw new q("invalid intrinsic syntax, expected closing `%`");else if(s==="%"&&n!=="%")throw new q("invalid intrinsic syntax, expected opening `%`");var f0=[];return _(Q0,o,function(y,h,G0,t){f0[f0.length]=G0?_(t,K0,"$1"):h||y}),f0},l=function(Q0,n){var s=Q0,f0;if(O(F,s))f0=F[s],s="%"+f0[0]+"%";if(O(W,s)){var y=W[s];if(y===I)y=D(s);if(typeof y>"u"&&!n)throw new z("intrinsic "+Q0+" exists, but is not available. Please file an issue!");return{alias:f0,name:s,value:y}}throw new q("intrinsic "+Q0+" does not exist!")};Z.exports=function(Q0,n){if(typeof Q0!=="string"||Q0.length===0)throw new z("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof n!=="boolean")throw new z('"allowMissing" argument must be a boolean');if(c(/^%?[^%]*%?$/,Q0)===null)throw new q("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var s=a(Q0),f0=s.length>0?s[0]:"",y=l("%"+f0+"%",n),h=y.name,G0=y.value,t=!1,U0=y.alias;if(U0)f0=U0[0],R(s,P([0,1],U0));for(var L0=1,p=!0;L0<s.length;L0+=1){var m=s[L0],g0=f(m,0,1),r=f(m,-1);if((g0==='"'||g0==="'"||g0==="`"||(r==='"'||r==="'"||r==="`"))&&g0!==r)throw new q("property names with quotes must have matching quotes");if(m==="constructor"||!p)t=!0;if(f0+="."+m,h="%"+f0+"%",O(W,h))G0=W[h];else if(G0!=null){if(!(m in G0)){if(!n)throw new z("base intrinsic for "+Q0+" exists, but the property is not available.");return}if(N&&L0+1>=s.length){var J0=N(G0,m);if(p=!!J0,p&&"get"in J0&&!("originalValue"in J0.get))G0=J0.get;else G0=G0[m]}else p=O(G0,m),G0=G0[m];if(p&&!t)W[h]=G0}}return G0}}),tG=$0((U,Z)=>{var X=aG(),Q=eY(),K=Q([X("%String.prototype.indexOf%")]);Z.exports=function(H,$){var M=X(H,!!$);if(typeof M==="function"&&K(H,".prototype.")>-1)return Q([M]);return M}}),tI=$0((U,Z)=>{var X=Function.prototype.toString,Q=typeof Reflect==="object"&&Reflect!==null&&Reflect.apply,K,H;if(typeof Q==="function"&&typeof Object.defineProperty==="function")try{K=Object.defineProperty({},"length",{get:function(){throw H}}),H={},Q(function(){throw 42},null,K)}catch(N){if(N!==H)Q=null}else Q=null;var $=/^\s*class\b/,M=function(N){try{var w=X.call(N);return $.test(w)}catch(u){return!1}},q=function(N){try{if(M(N))return!1;return X.call(N),!0}catch(w){return!1}},z=Object.prototype.toString,T="[object Object]",A="[object Function]",L="[object GeneratorFunction]",E="[object HTMLAllCollection]",S="[object HTML document.all class]",j="[object HTMLCollection]",k=typeof Symbol==="function"&&!!Symbol.toStringTag,B=!(0 in[,]),v=function(){return!1};if(typeof document==="object"){if(x=document.all,z.call(x)===z.call(document.all))v=function(N){if((B||!N)&&(typeof N>"u"||typeof N==="object"))try{var w=z.call(N);return(w===E||w===S||w===j||w===T)&&N("")==null}catch(u){}return!1}}var x;Z.exports=Q?function(N){if(v(N))return!0;if(!N)return!1;if(typeof N!=="function"&&typeof N!=="object")return!1;try{Q(N,null,K)}catch(w){if(w!==H)return!1}return!M(N)&&q(N)}:function(N){if(v(N))return!0;if(!N)return!1;if(typeof N!=="function"&&typeof N!=="object")return!1;if(k)return q(N);if(M(N))return!1;var w=z.call(N);if(w!==A&&w!==L&&!/^\[object HTML/.test(w))return!1;return q(N)}}),iI=$0((U,Z)=>{var X=tI(),Q=Object.prototype.toString,K=Object.prototype.hasOwnProperty,H=function(z,T,A){for(var L=0,E=z.length;L<E;L++)if(K.call(z,L))if(A==null)T(z[L],L,z);else T.call(A,z[L],L,z)},$=function(z,T,A){for(var L=0,E=z.length;L<E;L++)if(A==null)T(z.charAt(L),L,z);else T.call(A,z.charAt(L),L,z)},M=function(z,T,A){for(var L in z)if(K.call(z,L))if(A==null)T(z[L],L,z);else T.call(A,z[L],L,z)};function q(z){return Q.call(z)==="[object Array]"}Z.exports=function(z,T,A){if(!X(T))throw TypeError("iterator must be a function");var L;if(arguments.length>=3)L=A;if(q(z))H(z,T,L);else if(typeof z==="string")$(z,T,L);else M(z,T,L)}}),eI=$0((U,Z)=>{Z.exports=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]}),UH=$0((U,Z)=>{var X=eI(),Q=typeof globalThis>"u"?globalThis:globalThis;Z.exports=function(){var K=[];for(var H=0;H<X.length;H++)if(typeof Q[X[H]]==="function")K[K.length]=X[H];return K}}),ZH=$0((U,Z)=>{var X=BX(),Q=lG(),K=yZ(),H=cZ();Z.exports=function($,M,q){if(!$||typeof $!=="object"&&typeof $!=="function")throw new K("`obj` must be an object or a function`");if(typeof M!=="string"&&typeof M!=="symbol")throw new K("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!=="boolean"&&arguments[3]!==null)throw new K("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!=="boolean"&&arguments[4]!==null)throw new K("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!=="boolean"&&arguments[5]!==null)throw new K("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!=="boolean")throw new K("`loose`, if provided, must be a boolean");var z=arguments.length>3?arguments[3]:null,T=arguments.length>4?arguments[4]:null,A=arguments.length>5?arguments[5]:null,L=arguments.length>6?arguments[6]:!1,E=!!H&&H($,M);if(X)X($,M,{configurable:A===null&&E?E.configurable:!A,enumerable:z===null&&E?E.enumerable:!z,value:q,writable:T===null&&E?E.writable:!T});else if(L||!z&&!T&&!A)$[M]=q;else throw new Q("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}}),XH=$0((U,Z)=>{var X=BX(),Q=function(){return!!X};Q.hasArrayLengthDefineBug=function(){if(!X)return null;try{return X([],"length",{value:1}).length!==1}catch(K){return!0}},Z.exports=Q}),YH=$0((U,Z)=>{var X=aG(),Q=ZH(),K=XH()(),H=cZ(),$=yZ(),M=X("%Math.floor%");Z.exports=function(q,z){if(typeof q!=="function")throw new $("`fn` is not a function");if(typeof z!=="number"||z<0||z>4294967295||M(z)!==z)throw new $("`length` must be a positive 32-bit integer");var T=arguments.length>2&&!!arguments[2],A=!0,L=!0;if("length"in q&&H){var E=H(q,"length");if(E&&!E.configurable)A=!1;if(E&&!E.writable)L=!1}if(A||L||!T)if(K)Q(q,"length",z,!0,!0);else Q(q,"length",z);return q}}),JH=$0((U,Z)=>{var X=pZ(),Q=iY(),K=sG();Z.exports=function(){return K(X,Q,arguments)}}),QH=$0((U,Z)=>{var X=YH(),Q=BX(),K=eY(),H=JH();if(Z.exports=function($){var M=K(arguments),q=$.length-(arguments.length-1);return X(M,1+(q>0?q:0),!0)},Q)Q(Z.exports,"apply",{value:H});else Z.exports.apply=H}),GH=$0((U,Z)=>{var X=oG();Z.exports=function(){return X()&&!!Symbol.toStringTag}}),VH=$0((U,Z)=>{var X=iI(),Q=UH(),K=QH(),H=tG(),$=cZ(),M=rG(),q=H("Object.prototype.toString"),z=GH()(),T=typeof globalThis>"u"?globalThis:globalThis,A=Q(),L=H("String.prototype.slice"),E=H("Array.prototype.indexOf",!0)||function(B,v){for(var x=0;x<B.length;x+=1)if(B[x]===v)return x;return-1},S={__proto__:null};if(z&&$&&M)X(A,function(B){var v=new T[B];if(Symbol.toStringTag in v&&M){var x=M(v),N=$(x,Symbol.toStringTag);if(!N&&x){var w=M(x);N=$(w,Symbol.toStringTag)}S["$"+B]=K(N.get)}});else X(A,function(B){var v=new T[B],x=v.slice||v.set;if(x)S["$"+B]=K(x)});var j=function(B){var v=!1;return X(S,function(x,N){if(!v)try{if("$"+x(B)===N)v=L(N,1)}catch(w){}}),v},k=function(B){var v=!1;return X(S,function(x,N){if(!v)try{x(B),v=L(N,1)}catch(w){}}),v};Z.exports=function(B){if(!B||typeof B!=="object")return!1;if(!z){var v=L(q(B),8,-1);if(E(A,v)>-1)return v;if(v!=="Object")return!1;return k(B)}if(!$)return null;return j(B)}}),$H=$0((U,Z)=>{var X=VH();Z.exports=function(Q){return!!X(Q)}}),KH=$0((U,Z)=>{var X=yZ(),Q=tG(),K=Q("TypedArray.prototype.buffer",!0),H=$H();Z.exports=K||function($){if(!H($))throw new X("Not a Typed Array");return $.buffer}}),WH=$0((U,Z)=>{var X=m1().Buffer,Q=BI(),K=KH(),H=ArrayBuffer.isView||function(z){try{return K(z),!0}catch(T){return!1}},$=typeof Uint8Array<"u",M=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",q=M&&(X.prototype instanceof Uint8Array||X.TYPED_ARRAY_SUPPORT);Z.exports=function(z,T){if(X.isBuffer(z)){if(z.constructor&&!("isBuffer"in z))return X.from(z);return z}if(typeof z==="string")return X.from(z,T);if(M&&H(z)){if(z.byteLength===0)return X.alloc(0);if(q){var A=X.from(z.buffer,z.byteOffset,z.byteLength);if(A.byteLength===z.byteLength)return A}var L=z instanceof Uint8Array?z:new Uint8Array(z.buffer,z.byteOffset,z.byteLength),E=X.from(L);if(E.length===z.byteLength)return E}if($&&z instanceof Uint8Array)return X.from(z);var S=Q(z);if(S)for(var j=0;j<z.length;j+=1){var k=z[j];if(typeof k!=="number"||k<0||k>255||~~k!==k)throw RangeError("Array items must be numbers in the range 0-255.")}if(S||X.isBuffer(z)&&z.constructor&&typeof z.constructor.isBuffer==="function"&&z.constructor.isBuffer(z))return X.from(z);throw TypeError('The "data" argument must be a string, an Array, a Buffer, a Uint8Array, or a DataView.')}}),UJ=$0((U,Z)=>{var X=m1().Buffer,Q=WH(),K=typeof Uint8Array<"u",H=K&&typeof ArrayBuffer<"u",$=H&&ArrayBuffer.isView;Z.exports=function(M,q,z){if(typeof M==="string"||X.isBuffer(M)||K&&M instanceof Uint8Array||$&&$(M))return Q(M,q);throw TypeError(z+" must be a string, a Buffer, a Uint8Array, or a DataView")}}),iG=$0((U,Z)=>{var X={__proto__:null,md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,"sha512-256":32,rmd160:20,ripemd160:20},Q={__proto__:null,"sha-1":"sha1","sha-224":"sha224","sha-256":"sha256","sha-384":"sha384","sha-512":"sha512","ripemd-160":"ripemd160"},K=bG(),H=m1().Buffer,$=rY(),M=aY(),q=UJ();function z(T,A,L,E,S){$(L,E),T=q(T,M,"Password"),A=q(A,M,"Salt");var j=(S||"sha1").toLowerCase(),k=Q[j]||j,B=X[k];if(typeof B!=="number"||!B)throw TypeError("Digest algorithm not supported: "+S);var v=H.allocUnsafe(E),x=H.allocUnsafe(A.length+4);A.copy(x,0,0,A.length);var N=0,w=B,u=Math.ceil(E/w);for(var Z0=1;Z0<=u;Z0++){x.writeUInt32BE(Z0,A.length);var V0=K(k,T).update(x).digest(),Y0=V0;for(var b=1;b<L;b++){Y0=K(k,T).update(Y0).digest();for(var i=0;i<w;i++)V0[i]^=Y0[i]}V0.copy(v,N),N+=w}return v}Z.exports=z}),IH=$0((U,Z)=>{var X=m1().Buffer,Q=rY(),K=aY(),H=iG(),$=UJ(),M,q=globalThis.crypto&&globalThis.crypto.subtle,z={sha:"SHA-1","sha-1":"SHA-1",sha1:"SHA-1",sha256:"SHA-256","sha-256":"SHA-256",sha384:"SHA-384","sha-384":"SHA-384","sha-512":"SHA-512",sha512:"SHA-512"},T=[],A;function L(){if(A)return A;if(globalThis.process&&globalThis.process.nextTick)A=globalThis.process.nextTick;else if(globalThis.queueMicrotask)A=globalThis.queueMicrotask;else if(globalThis.setImmediate)A=globalThis.setImmediate;else A=globalThis.setTimeout;return A}function E(k,B,v,x,N){return q.importKey("raw",k,{name:"PBKDF2"},!1,["deriveBits"]).then(function(w){return q.deriveBits({name:"PBKDF2",salt:B,iterations:v,hash:{name:N}},w,x<<3)}).then(function(w){return X.from(w)})}function S(k){if(globalThis.process&&!globalThis.process.browser)return Promise.resolve(!1);if(!q||!q.importKey||!q.deriveBits)return Promise.resolve(!1);if(T[k]!==void 0)return T[k];M=M||X.alloc(8);var B=E(M,M,10,128,k).then(function(){return!0},function(){return!1});return T[k]=B,B}function j(k,B){k.then(function(v){L()(function(){B(null,v)})},function(v){L()(function(){B(v)})})}Z.exports=function(k,B,v,x,N,w){if(typeof N==="function")w=N,N=void 0;if(Q(v,x),k=$(k,K,"Password"),B=$(B,K,"Salt"),typeof w!=="function")throw Error("No callback provided to pbkdf2");N=N||"sha1";var u=z[N.toLowerCase()];if(!u||typeof globalThis.Promise!=="function"){L()(function(){var Z0;try{Z0=H(k,B,v,x,N)}catch(V0){w(V0);return}w(null,Z0)});return}j(S(u).then(function(Z0){if(Z0)return E(k,B,v,x,u);return H(k,B,v,x,N)}),w)}}),eG=$0((U)=>{var Z=(UU(),m0(e1)),X=rY(),Q=aY(),K=UJ();function H(M,q,z,T,A,L){if(X(z,T),M=K(M,Q,"Password"),q=K(q,Q,"Salt"),typeof A==="function")L=A,A="sha1";if(typeof L!=="function")throw Error("No callback provided to pbkdf2");return Z.pbkdf2(M,q,z,T,A,L)}function $(M,q,z,T,A){return X(z,T),M=K(M,Q,"Password"),q=K(q,Q,"Salt"),A=A||"sha1",Z.pbkdf2Sync(M,q,z,T,A)}if(!Z.pbkdf2Sync||Z.pbkdf2Sync.toString().indexOf("keylen, digest")===-1)U.pbkdf2Sync=iG(),U.pbkdf2=IH();else U.pbkdf2Sync=$,U.pbkdf2=H}),HH=$0((U)=>{var Z=(UU(),m0(e1));U.createCipher=U.Cipher=Z.createCipher,U.createCipheriv=U.Cipheriv=Z.createCipheriv,U.createDecipher=U.Decipher=Z.createDecipher,U.createDecipheriv=U.Decipheriv=Z.createDecipheriv,U.listCiphers=U.getCiphers=Z.getCiphers}),FH=$0((U)=>{var Z=(UU(),m0(e1));U.DiffieHellmanGroup=Z.DiffieHellmanGroup,U.createDiffieHellmanGroup=Z.createDiffieHellmanGroup,U.getDiffieHellman=Z.getDiffieHellman,U.createDiffieHellman=Z.createDiffieHellman,U.DiffieHellman=Z.DiffieHellman}),OH=$0((U)=>{var Z=(UU(),m0(e1));U.createSign=Z.createSign,U.Sign=Z.Sign,U.createVerify=Z.createVerify,U.Verify=Z.Verify}),CH=$0((U,Z)=>{Z.exports={name:"elliptic",version:"6.6.1",description:"EC cryptography",main:"lib/elliptic.js",files:["lib"],scripts:{lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository:{type:"git",url:"git@github.com:indutny/elliptic"},keywords:["EC","Elliptic","curve","Cryptography"],author:"Fedor Indutny <fedor@indutny.com>",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}}}),jU=$0((U,Z)=>{(function(X,Q){function K(Y,V){if(!Y)throw Error(V||"Assertion failed")}function H(Y,V){Y.super_=V;var I=function(){};I.prototype=V.prototype,Y.prototype=new I,Y.prototype.constructor=Y}function $(Y,V,I){if($.isBN(Y))return Y;if(this.negative=0,this.words=null,this.length=0,this.red=null,Y!==null){if(V==="le"||V==="be")I=V,V=10;this._init(Y||0,V||10,I||"be")}}if(typeof X==="object")X.exports=$;else Q.BN=$;$.BN=$,$.wordSize=26;var M;try{if(typeof window<"u"&&typeof window.Buffer<"u")M=window.Buffer;else M=(g1(),m0(N1)).Buffer}catch(Y){}$.isBN=function(Y){if(Y instanceof $)return!0;return Y!==null&&typeof Y==="object"&&Y.constructor.wordSize===$.wordSize&&Array.isArray(Y.words)},$.max=function(Y,V){if(Y.cmp(V)>0)return Y;return V},$.min=function(Y,V){if(Y.cmp(V)<0)return Y;return V},$.prototype._init=function(Y,V,I){if(typeof Y==="number")return this._initNumber(Y,V,I);if(typeof Y==="object")return this._initArray(Y,V,I);if(V==="hex")V=16;K(V===(V|0)&&V>=2&&V<=36),Y=Y.toString().replace(/\s+/g,"");var G=0;if(Y[0]==="-")G++,this.negative=1;if(G<Y.length){if(V===16)this._parseHex(Y,G,I);else if(this._parseBase(Y,V,G),I==="le")this._initArray(this.toArray(),V,I)}},$.prototype._initNumber=function(Y,V,I){if(Y<0)this.negative=1,Y=-Y;if(Y<67108864)this.words=[Y&67108863],this.length=1;else if(Y<4503599627370496)this.words=[Y&67108863,Y/67108864&67108863],this.length=2;else K(Y<9007199254740992),this.words=[Y&67108863,Y/67108864&67108863,1],this.length=3;if(I!=="le")return;this._initArray(this.toArray(),V,I)},$.prototype._initArray=function(Y,V,I){if(K(typeof Y.length==="number"),Y.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(Y.length/3),this.words=Array(this.length);for(var G=0;G<this.length;G++)this.words[G]=0;var W,C,D=0;if(I==="be"){for(G=Y.length-1,W=0;G>=0;G-=3)if(C=Y[G]|Y[G-1]<<8|Y[G-2]<<16,this.words[W]|=C<<D&67108863,this.words[W+1]=C>>>26-D&67108863,D+=24,D>=26)D-=26,W++}else if(I==="le"){for(G=0,W=0;G<Y.length;G+=3)if(C=Y[G]|Y[G+1]<<8|Y[G+2]<<16,this.words[W]|=C<<D&67108863,this.words[W+1]=C>>>26-D&67108863,D+=24,D>=26)D-=26,W++}return this.strip()};function q(Y,V){var I=Y.charCodeAt(V);if(I>=65&&I<=70)return I-55;else if(I>=97&&I<=102)return I-87;else return I-48&15}function z(Y,V,I){var G=q(Y,I);if(I-1>=V)G|=q(Y,I-1)<<4;return G}$.prototype._parseHex=function(Y,V,I){this.length=Math.ceil((Y.length-V)/6),this.words=Array(this.length);for(var G=0;G<this.length;G++)this.words[G]=0;var W=0,C=0,D;if(I==="be")for(G=Y.length-1;G>=V;G-=2)if(D=z(Y,V,G)<<W,this.words[C]|=D&67108863,W>=18)W-=18,C+=1,this.words[C]|=D>>>26;else W+=8;else{var F=Y.length-V;for(G=F%2===0?V+1:V;G<Y.length;G+=2)if(D=z(Y,V,G)<<W,this.words[C]|=D&67108863,W>=18)W-=18,C+=1,this.words[C]|=D>>>26;else W+=8}this.strip()};function T(Y,V,I,G){var W=0,C=Math.min(Y.length,I);for(var D=V;D<C;D++){var F=Y.charCodeAt(D)-48;if(W*=G,F>=49)W+=F-49+10;else if(F>=17)W+=F-17+10;else W+=F}return W}$.prototype._parseBase=function(Y,V,I){this.words=[0],this.length=1;for(var G=0,W=1;W<=67108863;W*=V)G++;G--,W=W/V|0;var C=Y.length-I,D=C%G,F=Math.min(C,C-D)+I,J=0;for(var O=I;O<F;O+=G)if(J=T(Y,O,O+G,V),this.imuln(W),this.words[0]+J<67108864)this.words[0]+=J;else this._iaddn(J);if(D!==0){var P=1;J=T(Y,O,Y.length,V);for(O=0;O<D;O++)P*=V;if(this.imuln(P),this.words[0]+J<67108864)this.words[0]+=J;else this._iaddn(J)}this.strip()},$.prototype.copy=function(Y){Y.words=Array(this.length);for(var V=0;V<this.length;V++)Y.words[V]=this.words[V];Y.length=this.length,Y.negative=this.negative,Y.red=this.red},$.prototype.clone=function(){var Y=new $(null);return this.copy(Y),Y},$.prototype._expand=function(Y){while(this.length<Y)this.words[this.length++]=0;return this},$.prototype.strip=function(){while(this.length>1&&this.words[this.length-1]===0)this.length--;return this._normSign()},$.prototype._normSign=function(){if(this.length===1&&this.words[0]===0)this.negative=0;return this},$.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var A=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],L=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],E=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64000000,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,24300000,28629151,33554432,39135393,45435424,52521875,60466176];if($.prototype.toString=function(Y,V){Y=Y||10,V=V|0||1;var I;if(Y===16||Y==="hex"){I="";var G=0,W=0;for(var C=0;C<this.length;C++){var D=this.words[C],F=((D<<G|W)&16777215).toString(16);if(W=D>>>24-G&16777215,G+=2,G>=26)G-=26,C--;if(W!==0||C!==this.length-1)I=A[6-F.length]+F+I;else I=F+I}if(W!==0)I=W.toString(16)+I;while(I.length%V!==0)I="0"+I;if(this.negative!==0)I="-"+I;return I}if(Y===(Y|0)&&Y>=2&&Y<=36){var J=L[Y],O=E[Y];I="";var P=this.clone();P.negative=0;while(!P.isZero()){var R=P.modn(O).toString(Y);if(P=P.idivn(O),!P.isZero())I=A[J-R.length]+R+I;else I=R+I}if(this.isZero())I="0"+I;while(I.length%V!==0)I="0"+I;if(this.negative!==0)I="-"+I;return I}K(!1,"Base should be between 2 and 36")},$.prototype.toNumber=function(){var Y=this.words[0];if(this.length===2)Y+=this.words[1]*67108864;else if(this.length===3&&this.words[2]===1)Y+=4503599627370496+this.words[1]*67108864;else if(this.length>2)K(!1,"Number can only safely store up to 53 bits");return this.negative!==0?-Y:Y},$.prototype.toJSON=function(){return this.toString(16)},$.prototype.toBuffer=function(Y,V){return K(typeof M<"u"),this.toArrayLike(M,Y,V)},$.prototype.toArray=function(Y,V){return this.toArrayLike(Array,Y,V)},$.prototype.toArrayLike=function(Y,V,I){var G=this.byteLength(),W=I||Math.max(1,G);K(G<=W,"byte array longer than desired length"),K(W>0,"Requested array length <= 0"),this.strip();var C=V==="le",D=new Y(W),F,J,O=this.clone();if(!C){for(J=0;J<W-G;J++)D[J]=0;for(J=0;!O.isZero();J++)F=O.andln(255),O.iushrn(8),D[W-J-1]=F}else{for(J=0;!O.isZero();J++)F=O.andln(255),O.iushrn(8),D[J]=F;for(;J<W;J++)D[J]=0}return D},Math.clz32)$.prototype._countBits=function(Y){return 32-Math.clz32(Y)};else $.prototype._countBits=function(Y){var V=Y,I=0;if(V>=4096)I+=13,V>>>=13;if(V>=64)I+=7,V>>>=7;if(V>=8)I+=4,V>>>=4;if(V>=2)I+=2,V>>>=2;return I+V};$.prototype._zeroBits=function(Y){if(Y===0)return 26;var V=Y,I=0;if((V&8191)===0)I+=13,V>>>=13;if((V&127)===0)I+=7,V>>>=7;if((V&15)===0)I+=4,V>>>=4;if((V&3)===0)I+=2,V>>>=2;if((V&1)===0)I++;return I},$.prototype.bitLength=function(){var Y=this.words[this.length-1],V=this._countBits(Y);return(this.length-1)*26+V};function S(Y){var V=Array(Y.bitLength());for(var I=0;I<V.length;I++){var G=I/26|0,W=I%26;V[I]=(Y.words[G]&1<<W)>>>W}return V}$.prototype.zeroBits=function(){if(this.isZero())return 0;var Y=0;for(var V=0;V<this.length;V++){var I=this._zeroBits(this.words[V]);if(Y+=I,I!==26)break}return Y},$.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},$.prototype.toTwos=function(Y){if(this.negative!==0)return this.abs().inotn(Y).iaddn(1);return this.clone()},$.prototype.fromTwos=function(Y){if(this.testn(Y-1))return this.notn(Y).iaddn(1).ineg();return this.clone()},$.prototype.isNeg=function(){return this.negative!==0},$.prototype.neg=function(){return this.clone().ineg()},$.prototype.ineg=function(){if(!this.isZero())this.negative^=1;return this},$.prototype.iuor=function(Y){while(this.length<Y.length)this.words[this.length++]=0;for(var V=0;V<Y.length;V++)this.words[V]=this.words[V]|Y.words[V];return this.strip()},$.prototype.ior=function(Y){return K((this.negative|Y.negative)===0),this.iuor(Y)},$.prototype.or=function(Y){if(this.length>Y.length)return this.clone().ior(Y);return Y.clone().ior(this)},$.prototype.uor=function(Y){if(this.length>Y.length)return this.clone().iuor(Y);return Y.clone().iuor(this)},$.prototype.iuand=function(Y){var V;if(this.length>Y.length)V=Y;else V=this;for(var I=0;I<V.length;I++)this.words[I]=this.words[I]&Y.words[I];return this.length=V.length,this.strip()},$.prototype.iand=function(Y){return K((this.negative|Y.negative)===0),this.iuand(Y)},$.prototype.and=function(Y){if(this.length>Y.length)return this.clone().iand(Y);return Y.clone().iand(this)},$.prototype.uand=function(Y){if(this.length>Y.length)return this.clone().iuand(Y);return Y.clone().iuand(this)},$.prototype.iuxor=function(Y){var V,I;if(this.length>Y.length)V=this,I=Y;else V=Y,I=this;for(var G=0;G<I.length;G++)this.words[G]=V.words[G]^I.words[G];if(this!==V)for(;G<V.length;G++)this.words[G]=V.words[G];return this.length=V.length,this.strip()},$.prototype.ixor=function(Y){return K((this.negative|Y.negative)===0),this.iuxor(Y)},$.prototype.xor=function(Y){if(this.length>Y.length)return this.clone().ixor(Y);return Y.clone().ixor(this)},$.prototype.uxor=function(Y){if(this.length>Y.length)return this.clone().iuxor(Y);return Y.clone().iuxor(this)},$.prototype.inotn=function(Y){K(typeof Y==="number"&&Y>=0);var V=Math.ceil(Y/26)|0,I=Y%26;if(this._expand(V),I>0)V--;for(var G=0;G<V;G++)this.words[G]=~this.words[G]&67108863;if(I>0)this.words[G]=~this.words[G]&67108863>>26-I;return this.strip()},$.prototype.notn=function(Y){return this.clone().inotn(Y)},$.prototype.setn=function(Y,V){K(typeof Y==="number"&&Y>=0);var I=Y/26|0,G=Y%26;if(this._expand(I+1),V)this.words[I]=this.words[I]|1<<G;else this.words[I]=this.words[I]&~(1<<G);return this.strip()},$.prototype.iadd=function(Y){var V;if(this.negative!==0&&Y.negative===0)return this.negative=0,V=this.isub(Y),this.negative^=1,this._normSign();else if(this.negative===0&&Y.negative!==0)return Y.negative=0,V=this.isub(Y),Y.negative=1,V._normSign();var I,G;if(this.length>Y.length)I=this,G=Y;else I=Y,G=this;var W=0;for(var C=0;C<G.length;C++)V=(I.words[C]|0)+(G.words[C]|0)+W,this.words[C]=V&67108863,W=V>>>26;for(;W!==0&&C<I.length;C++)V=(I.words[C]|0)+W,this.words[C]=V&67108863,W=V>>>26;if(this.length=I.length,W!==0)this.words[this.length]=W,this.length++;else if(I!==this)for(;C<I.length;C++)this.words[C]=I.words[C];return this},$.prototype.add=function(Y){var V;if(Y.negative!==0&&this.negative===0)return Y.negative=0,V=this.sub(Y),Y.negative^=1,V;else if(Y.negative===0&&this.negative!==0)return this.negative=0,V=Y.sub(this),this.negative=1,V;if(this.length>Y.length)return this.clone().iadd(Y);return Y.clone().iadd(this)},$.prototype.isub=function(Y){if(Y.negative!==0){Y.negative=0;var V=this.iadd(Y);return Y.negative=1,V._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(Y),this.negative=1,this._normSign();var I=this.cmp(Y);if(I===0)return this.negative=0,this.length=1,this.words[0]=0,this;var G,W;if(I>0)G=this,W=Y;else G=Y,W=this;var C=0;for(var D=0;D<W.length;D++)V=(G.words[D]|0)-(W.words[D]|0)+C,C=V>>26,this.words[D]=V&67108863;for(;C!==0&&D<G.length;D++)V=(G.words[D]|0)+C,C=V>>26,this.words[D]=V&67108863;if(C===0&&D<G.length&&G!==this)for(;D<G.length;D++)this.words[D]=G.words[D];if(this.length=Math.max(this.length,D),G!==this)this.negative=1;return this.strip()},$.prototype.sub=function(Y){return this.clone().isub(Y)};function j(Y,V,I){I.negative=V.negative^Y.negative;var G=Y.length+V.length|0;I.length=G,G=G-1|0;var W=Y.words[0]|0,C=V.words[0]|0,D=W*C,F=D&67108863,J=D/67108864|0;I.words[0]=F;for(var O=1;O<G;O++){var P=J>>>26,R=J&67108863,_=Math.min(O,V.length-1);for(var f=Math.max(0,O-Y.length+1);f<=_;f++){var c=O-f|0;W=Y.words[c]|0,C=V.words[f]|0,D=W*C+R,P+=D/67108864|0,R=D&67108863}I.words[O]=R|0,J=P|0}if(J!==0)I.words[O]=J|0;else I.length--;return I.strip()}var k=function(Y,V,I){var G=Y.words,W=V.words,C=I.words,D=0,F,J,O,P=G[0]|0,R=P&8191,_=P>>>13,f=G[1]|0,c=f&8191,o=f>>>13,K0=G[2]|0,a=K0&8191,l=K0>>>13,Q0=G[3]|0,n=Q0&8191,s=Q0>>>13,f0=G[4]|0,y=f0&8191,h=f0>>>13,G0=G[5]|0,t=G0&8191,U0=G0>>>13,L0=G[6]|0,p=L0&8191,m=L0>>>13,g0=G[7]|0,r=g0&8191,J0=g0>>>13,h0=G[8]|0,F0=h0&8191,O0=h0>>>13,J1=G[9]|0,I0=J1&8191,C0=J1>>>13,K1=W[0]|0,M0=K1&8191,z0=K1>>>13,d1=W[1]|0,T0=d1&8191,j0=d1>>>13,l1=W[2]|0,v0=l1&8191,R0=l1>>>13,h1=W[3]|0,_0=h1&8191,E0=h1>>>13,_1=W[4]|0,B0=_1&8191,x0=_1>>>13,B1=W[5]|0,S0=B1&8191,g=B1>>>13,d=W[6]|0,e=d&8191,X0=d>>>13,y0=W[7]|0,H0=y0&8191,A0=y0>>>13,Q1=W[8]|0,P0=Q1&8191,N0=Q1>>>13,u1=W[9]|0,k0=u1&8191,q0=u1>>>13;I.negative=Y.negative^V.negative,I.length=19,F=Math.imul(R,M0),J=Math.imul(R,z0),J=J+Math.imul(_,M0)|0,O=Math.imul(_,z0);var G1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(G1>>>26)|0,G1&=67108863,F=Math.imul(c,M0),J=Math.imul(c,z0),J=J+Math.imul(o,M0)|0,O=Math.imul(o,z0),F=F+Math.imul(R,T0)|0,J=J+Math.imul(R,j0)|0,J=J+Math.imul(_,T0)|0,O=O+Math.imul(_,j0)|0;var l0=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(l0>>>26)|0,l0&=67108863,F=Math.imul(a,M0),J=Math.imul(a,z0),J=J+Math.imul(l,M0)|0,O=Math.imul(l,z0),F=F+Math.imul(c,T0)|0,J=J+Math.imul(c,j0)|0,J=J+Math.imul(o,T0)|0,O=O+Math.imul(o,j0)|0,F=F+Math.imul(R,v0)|0,J=J+Math.imul(R,R0)|0,J=J+Math.imul(_,v0)|0,O=O+Math.imul(_,R0)|0;var b0=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(b0>>>26)|0,b0&=67108863,F=Math.imul(n,M0),J=Math.imul(n,z0),J=J+Math.imul(s,M0)|0,O=Math.imul(s,z0),F=F+Math.imul(a,T0)|0,J=J+Math.imul(a,j0)|0,J=J+Math.imul(l,T0)|0,O=O+Math.imul(l,j0)|0,F=F+Math.imul(c,v0)|0,J=J+Math.imul(c,R0)|0,J=J+Math.imul(o,v0)|0,O=O+Math.imul(o,R0)|0,F=F+Math.imul(R,_0)|0,J=J+Math.imul(R,E0)|0,J=J+Math.imul(_,_0)|0,O=O+Math.imul(_,E0)|0;var t0=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(t0>>>26)|0,t0&=67108863,F=Math.imul(y,M0),J=Math.imul(y,z0),J=J+Math.imul(h,M0)|0,O=Math.imul(h,z0),F=F+Math.imul(n,T0)|0,J=J+Math.imul(n,j0)|0,J=J+Math.imul(s,T0)|0,O=O+Math.imul(s,j0)|0,F=F+Math.imul(a,v0)|0,J=J+Math.imul(a,R0)|0,J=J+Math.imul(l,v0)|0,O=O+Math.imul(l,R0)|0,F=F+Math.imul(c,_0)|0,J=J+Math.imul(c,E0)|0,J=J+Math.imul(o,_0)|0,O=O+Math.imul(o,E0)|0,F=F+Math.imul(R,B0)|0,J=J+Math.imul(R,x0)|0,J=J+Math.imul(_,B0)|0,O=O+Math.imul(_,x0)|0;var r0=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(r0>>>26)|0,r0&=67108863,F=Math.imul(t,M0),J=Math.imul(t,z0),J=J+Math.imul(U0,M0)|0,O=Math.imul(U0,z0),F=F+Math.imul(y,T0)|0,J=J+Math.imul(y,j0)|0,J=J+Math.imul(h,T0)|0,O=O+Math.imul(h,j0)|0,F=F+Math.imul(n,v0)|0,J=J+Math.imul(n,R0)|0,J=J+Math.imul(s,v0)|0,O=O+Math.imul(s,R0)|0,F=F+Math.imul(a,_0)|0,J=J+Math.imul(a,E0)|0,J=J+Math.imul(l,_0)|0,O=O+Math.imul(l,E0)|0,F=F+Math.imul(c,B0)|0,J=J+Math.imul(c,x0)|0,J=J+Math.imul(o,B0)|0,O=O+Math.imul(o,x0)|0,F=F+Math.imul(R,S0)|0,J=J+Math.imul(R,g)|0,J=J+Math.imul(_,S0)|0,O=O+Math.imul(_,g)|0;var F1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(F1>>>26)|0,F1&=67108863,F=Math.imul(p,M0),J=Math.imul(p,z0),J=J+Math.imul(m,M0)|0,O=Math.imul(m,z0),F=F+Math.imul(t,T0)|0,J=J+Math.imul(t,j0)|0,J=J+Math.imul(U0,T0)|0,O=O+Math.imul(U0,j0)|0,F=F+Math.imul(y,v0)|0,J=J+Math.imul(y,R0)|0,J=J+Math.imul(h,v0)|0,O=O+Math.imul(h,R0)|0,F=F+Math.imul(n,_0)|0,J=J+Math.imul(n,E0)|0,J=J+Math.imul(s,_0)|0,O=O+Math.imul(s,E0)|0,F=F+Math.imul(a,B0)|0,J=J+Math.imul(a,x0)|0,J=J+Math.imul(l,B0)|0,O=O+Math.imul(l,x0)|0,F=F+Math.imul(c,S0)|0,J=J+Math.imul(c,g)|0,J=J+Math.imul(o,S0)|0,O=O+Math.imul(o,g)|0,F=F+Math.imul(R,e)|0,J=J+Math.imul(R,X0)|0,J=J+Math.imul(_,e)|0,O=O+Math.imul(_,X0)|0;var O1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(O1>>>26)|0,O1&=67108863,F=Math.imul(r,M0),J=Math.imul(r,z0),J=J+Math.imul(J0,M0)|0,O=Math.imul(J0,z0),F=F+Math.imul(p,T0)|0,J=J+Math.imul(p,j0)|0,J=J+Math.imul(m,T0)|0,O=O+Math.imul(m,j0)|0,F=F+Math.imul(t,v0)|0,J=J+Math.imul(t,R0)|0,J=J+Math.imul(U0,v0)|0,O=O+Math.imul(U0,R0)|0,F=F+Math.imul(y,_0)|0,J=J+Math.imul(y,E0)|0,J=J+Math.imul(h,_0)|0,O=O+Math.imul(h,E0)|0,F=F+Math.imul(n,B0)|0,J=J+Math.imul(n,x0)|0,J=J+Math.imul(s,B0)|0,O=O+Math.imul(s,x0)|0,F=F+Math.imul(a,S0)|0,J=J+Math.imul(a,g)|0,J=J+Math.imul(l,S0)|0,O=O+Math.imul(l,g)|0,F=F+Math.imul(c,e)|0,J=J+Math.imul(c,X0)|0,J=J+Math.imul(o,e)|0,O=O+Math.imul(o,X0)|0,F=F+Math.imul(R,H0)|0,J=J+Math.imul(R,A0)|0,J=J+Math.imul(_,H0)|0,O=O+Math.imul(_,A0)|0;var C1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(C1>>>26)|0,C1&=67108863,F=Math.imul(F0,M0),J=Math.imul(F0,z0),J=J+Math.imul(O0,M0)|0,O=Math.imul(O0,z0),F=F+Math.imul(r,T0)|0,J=J+Math.imul(r,j0)|0,J=J+Math.imul(J0,T0)|0,O=O+Math.imul(J0,j0)|0,F=F+Math.imul(p,v0)|0,J=J+Math.imul(p,R0)|0,J=J+Math.imul(m,v0)|0,O=O+Math.imul(m,R0)|0,F=F+Math.imul(t,_0)|0,J=J+Math.imul(t,E0)|0,J=J+Math.imul(U0,_0)|0,O=O+Math.imul(U0,E0)|0,F=F+Math.imul(y,B0)|0,J=J+Math.imul(y,x0)|0,J=J+Math.imul(h,B0)|0,O=O+Math.imul(h,x0)|0,F=F+Math.imul(n,S0)|0,J=J+Math.imul(n,g)|0,J=J+Math.imul(s,S0)|0,O=O+Math.imul(s,g)|0,F=F+Math.imul(a,e)|0,J=J+Math.imul(a,X0)|0,J=J+Math.imul(l,e)|0,O=O+Math.imul(l,X0)|0,F=F+Math.imul(c,H0)|0,J=J+Math.imul(c,A0)|0,J=J+Math.imul(o,H0)|0,O=O+Math.imul(o,A0)|0,F=F+Math.imul(R,P0)|0,J=J+Math.imul(R,N0)|0,J=J+Math.imul(_,P0)|0,O=O+Math.imul(_,N0)|0;var A1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(A1>>>26)|0,A1&=67108863,F=Math.imul(I0,M0),J=Math.imul(I0,z0),J=J+Math.imul(C0,M0)|0,O=Math.imul(C0,z0),F=F+Math.imul(F0,T0)|0,J=J+Math.imul(F0,j0)|0,J=J+Math.imul(O0,T0)|0,O=O+Math.imul(O0,j0)|0,F=F+Math.imul(r,v0)|0,J=J+Math.imul(r,R0)|0,J=J+Math.imul(J0,v0)|0,O=O+Math.imul(J0,R0)|0,F=F+Math.imul(p,_0)|0,J=J+Math.imul(p,E0)|0,J=J+Math.imul(m,_0)|0,O=O+Math.imul(m,E0)|0,F=F+Math.imul(t,B0)|0,J=J+Math.imul(t,x0)|0,J=J+Math.imul(U0,B0)|0,O=O+Math.imul(U0,x0)|0,F=F+Math.imul(y,S0)|0,J=J+Math.imul(y,g)|0,J=J+Math.imul(h,S0)|0,O=O+Math.imul(h,g)|0,F=F+Math.imul(n,e)|0,J=J+Math.imul(n,X0)|0,J=J+Math.imul(s,e)|0,O=O+Math.imul(s,X0)|0,F=F+Math.imul(a,H0)|0,J=J+Math.imul(a,A0)|0,J=J+Math.imul(l,H0)|0,O=O+Math.imul(l,A0)|0,F=F+Math.imul(c,P0)|0,J=J+Math.imul(c,N0)|0,J=J+Math.imul(o,P0)|0,O=O+Math.imul(o,N0)|0,F=F+Math.imul(R,k0)|0,J=J+Math.imul(R,q0)|0,J=J+Math.imul(_,k0)|0,O=O+Math.imul(_,q0)|0;var z1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(z1>>>26)|0,z1&=67108863,F=Math.imul(I0,T0),J=Math.imul(I0,j0),J=J+Math.imul(C0,T0)|0,O=Math.imul(C0,j0),F=F+Math.imul(F0,v0)|0,J=J+Math.imul(F0,R0)|0,J=J+Math.imul(O0,v0)|0,O=O+Math.imul(O0,R0)|0,F=F+Math.imul(r,_0)|0,J=J+Math.imul(r,E0)|0,J=J+Math.imul(J0,_0)|0,O=O+Math.imul(J0,E0)|0,F=F+Math.imul(p,B0)|0,J=J+Math.imul(p,x0)|0,J=J+Math.imul(m,B0)|0,O=O+Math.imul(m,x0)|0,F=F+Math.imul(t,S0)|0,J=J+Math.imul(t,g)|0,J=J+Math.imul(U0,S0)|0,O=O+Math.imul(U0,g)|0,F=F+Math.imul(y,e)|0,J=J+Math.imul(y,X0)|0,J=J+Math.imul(h,e)|0,O=O+Math.imul(h,X0)|0,F=F+Math.imul(n,H0)|0,J=J+Math.imul(n,A0)|0,J=J+Math.imul(s,H0)|0,O=O+Math.imul(s,A0)|0,F=F+Math.imul(a,P0)|0,J=J+Math.imul(a,N0)|0,J=J+Math.imul(l,P0)|0,O=O+Math.imul(l,N0)|0,F=F+Math.imul(c,k0)|0,J=J+Math.imul(c,q0)|0,J=J+Math.imul(o,k0)|0,O=O+Math.imul(o,q0)|0;var D1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(D1>>>26)|0,D1&=67108863,F=Math.imul(I0,v0),J=Math.imul(I0,R0),J=J+Math.imul(C0,v0)|0,O=Math.imul(C0,R0),F=F+Math.imul(F0,_0)|0,J=J+Math.imul(F0,E0)|0,J=J+Math.imul(O0,_0)|0,O=O+Math.imul(O0,E0)|0,F=F+Math.imul(r,B0)|0,J=J+Math.imul(r,x0)|0,J=J+Math.imul(J0,B0)|0,O=O+Math.imul(J0,x0)|0,F=F+Math.imul(p,S0)|0,J=J+Math.imul(p,g)|0,J=J+Math.imul(m,S0)|0,O=O+Math.imul(m,g)|0,F=F+Math.imul(t,e)|0,J=J+Math.imul(t,X0)|0,J=J+Math.imul(U0,e)|0,O=O+Math.imul(U0,X0)|0,F=F+Math.imul(y,H0)|0,J=J+Math.imul(y,A0)|0,J=J+Math.imul(h,H0)|0,O=O+Math.imul(h,A0)|0,F=F+Math.imul(n,P0)|0,J=J+Math.imul(n,N0)|0,J=J+Math.imul(s,P0)|0,O=O+Math.imul(s,N0)|0,F=F+Math.imul(a,k0)|0,J=J+Math.imul(a,q0)|0,J=J+Math.imul(l,k0)|0,O=O+Math.imul(l,q0)|0;var M1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(M1>>>26)|0,M1&=67108863,F=Math.imul(I0,_0),J=Math.imul(I0,E0),J=J+Math.imul(C0,_0)|0,O=Math.imul(C0,E0),F=F+Math.imul(F0,B0)|0,J=J+Math.imul(F0,x0)|0,J=J+Math.imul(O0,B0)|0,O=O+Math.imul(O0,x0)|0,F=F+Math.imul(r,S0)|0,J=J+Math.imul(r,g)|0,J=J+Math.imul(J0,S0)|0,O=O+Math.imul(J0,g)|0,F=F+Math.imul(p,e)|0,J=J+Math.imul(p,X0)|0,J=J+Math.imul(m,e)|0,O=O+Math.imul(m,X0)|0,F=F+Math.imul(t,H0)|0,J=J+Math.imul(t,A0)|0,J=J+Math.imul(U0,H0)|0,O=O+Math.imul(U0,A0)|0,F=F+Math.imul(y,P0)|0,J=J+Math.imul(y,N0)|0,J=J+Math.imul(h,P0)|0,O=O+Math.imul(h,N0)|0,F=F+Math.imul(n,k0)|0,J=J+Math.imul(n,q0)|0,J=J+Math.imul(s,k0)|0,O=O+Math.imul(s,q0)|0;var q1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(q1>>>26)|0,q1&=67108863,F=Math.imul(I0,B0),J=Math.imul(I0,x0),J=J+Math.imul(C0,B0)|0,O=Math.imul(C0,x0),F=F+Math.imul(F0,S0)|0,J=J+Math.imul(F0,g)|0,J=J+Math.imul(O0,S0)|0,O=O+Math.imul(O0,g)|0,F=F+Math.imul(r,e)|0,J=J+Math.imul(r,X0)|0,J=J+Math.imul(J0,e)|0,O=O+Math.imul(J0,X0)|0,F=F+Math.imul(p,H0)|0,J=J+Math.imul(p,A0)|0,J=J+Math.imul(m,H0)|0,O=O+Math.imul(m,A0)|0,F=F+Math.imul(t,P0)|0,J=J+Math.imul(t,N0)|0,J=J+Math.imul(U0,P0)|0,O=O+Math.imul(U0,N0)|0,F=F+Math.imul(y,k0)|0,J=J+Math.imul(y,q0)|0,J=J+Math.imul(h,k0)|0,O=O+Math.imul(h,q0)|0;var L1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(L1>>>26)|0,L1&=67108863,F=Math.imul(I0,S0),J=Math.imul(I0,g),J=J+Math.imul(C0,S0)|0,O=Math.imul(C0,g),F=F+Math.imul(F0,e)|0,J=J+Math.imul(F0,X0)|0,J=J+Math.imul(O0,e)|0,O=O+Math.imul(O0,X0)|0,F=F+Math.imul(r,H0)|0,J=J+Math.imul(r,A0)|0,J=J+Math.imul(J0,H0)|0,O=O+Math.imul(J0,A0)|0,F=F+Math.imul(p,P0)|0,J=J+Math.imul(p,N0)|0,J=J+Math.imul(m,P0)|0,O=O+Math.imul(m,N0)|0,F=F+Math.imul(t,k0)|0,J=J+Math.imul(t,q0)|0,J=J+Math.imul(U0,k0)|0,O=O+Math.imul(U0,q0)|0;var T1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(T1>>>26)|0,T1&=67108863,F=Math.imul(I0,e),J=Math.imul(I0,X0),J=J+Math.imul(C0,e)|0,O=Math.imul(C0,X0),F=F+Math.imul(F0,H0)|0,J=J+Math.imul(F0,A0)|0,J=J+Math.imul(O0,H0)|0,O=O+Math.imul(O0,A0)|0,F=F+Math.imul(r,P0)|0,J=J+Math.imul(r,N0)|0,J=J+Math.imul(J0,P0)|0,O=O+Math.imul(J0,N0)|0,F=F+Math.imul(p,k0)|0,J=J+Math.imul(p,q0)|0,J=J+Math.imul(m,k0)|0,O=O+Math.imul(m,q0)|0;var R1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(R1>>>26)|0,R1&=67108863,F=Math.imul(I0,H0),J=Math.imul(I0,A0),J=J+Math.imul(C0,H0)|0,O=Math.imul(C0,A0),F=F+Math.imul(F0,P0)|0,J=J+Math.imul(F0,N0)|0,J=J+Math.imul(O0,P0)|0,O=O+Math.imul(O0,N0)|0,F=F+Math.imul(r,k0)|0,J=J+Math.imul(r,q0)|0,J=J+Math.imul(J0,k0)|0,O=O+Math.imul(J0,q0)|0;var E1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(E1>>>26)|0,E1&=67108863,F=Math.imul(I0,P0),J=Math.imul(I0,N0),J=J+Math.imul(C0,P0)|0,O=Math.imul(C0,N0),F=F+Math.imul(F0,k0)|0,J=J+Math.imul(F0,q0)|0,J=J+Math.imul(O0,k0)|0,O=O+Math.imul(O0,q0)|0;var S1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(S1>>>26)|0,S1&=67108863,F=Math.imul(I0,k0),J=Math.imul(I0,q0),J=J+Math.imul(C0,k0)|0,O=Math.imul(C0,q0);var P1=(D+F|0)+((J&8191)<<13)|0;if(D=(O+(J>>>13)|0)+(P1>>>26)|0,P1&=67108863,C[0]=G1,C[1]=l0,C[2]=b0,C[3]=t0,C[4]=r0,C[5]=F1,C[6]=O1,C[7]=C1,C[8]=A1,C[9]=z1,C[10]=D1,C[11]=M1,C[12]=q1,C[13]=L1,C[14]=T1,C[15]=R1,C[16]=E1,C[17]=S1,C[18]=P1,D!==0)C[19]=D,I.length++;return I};if(!Math.imul)k=j;function B(Y,V,I){I.negative=V.negative^Y.negative,I.length=Y.length+V.length;var G=0,W=0;for(var C=0;C<I.length-1;C++){var D=W;W=0;var F=G&67108863,J=Math.min(C,V.length-1);for(var O=Math.max(0,C-Y.length+1);O<=J;O++){var P=C-O,R=Y.words[P]|0,_=V.words[O]|0,f=R*_,c=f&67108863;D=D+(f/67108864|0)|0,c=c+F|0,F=c&67108863,D=D+(c>>>26)|0,W+=D>>>26,D&=67108863}I.words[C]=F,G=D,D=W}if(G!==0)I.words[C]=G;else I.length--;return I.strip()}function v(Y,V,I){var G=new x;return G.mulp(Y,V,I)}$.prototype.mulTo=function(Y,V){var I,G=this.length+Y.length;if(this.length===10&&Y.length===10)I=k(this,Y,V);else if(G<63)I=j(this,Y,V);else if(G<1024)I=B(this,Y,V);else I=v(this,Y,V);return I};function x(Y,V){this.x=Y,this.y=V}x.prototype.makeRBT=function(Y){var V=Array(Y),I=$.prototype._countBits(Y)-1;for(var G=0;G<Y;G++)V[G]=this.revBin(G,I,Y);return V},x.prototype.revBin=function(Y,V,I){if(Y===0||Y===I-1)return Y;var G=0;for(var W=0;W<V;W++)G|=(Y&1)<<V-W-1,Y>>=1;return G},x.prototype.permute=function(Y,V,I,G,W,C){for(var D=0;D<C;D++)G[D]=V[Y[D]],W[D]=I[Y[D]]},x.prototype.transform=function(Y,V,I,G,W,C){this.permute(C,Y,V,I,G,W);for(var D=1;D<W;D<<=1){var F=D<<1,J=Math.cos(2*Math.PI/F),O=Math.sin(2*Math.PI/F);for(var P=0;P<W;P+=F){var R=J,_=O;for(var f=0;f<D;f++){var c=I[P+f],o=G[P+f],K0=I[P+f+D],a=G[P+f+D],l=R*K0-_*a;if(a=R*a+_*K0,K0=l,I[P+f]=c+K0,G[P+f]=o+a,I[P+f+D]=c-K0,G[P+f+D]=o-a,f!==F)l=J*R-O*_,_=J*_+O*R,R=l}}}},x.prototype.guessLen13b=function(Y,V){var I=Math.max(V,Y)|1,G=I&1,W=0;for(I=I/2|0;I;I=I>>>1)W++;return 1<<W+1+G},x.prototype.conjugate=function(Y,V,I){if(I<=1)return;for(var G=0;G<I/2;G++){var W=Y[G];Y[G]=Y[I-G-1],Y[I-G-1]=W,W=V[G],V[G]=-V[I-G-1],V[I-G-1]=-W}},x.prototype.normalize13b=function(Y,V){var I=0;for(var G=0;G<V/2;G++){var W=Math.round(Y[2*G+1]/V)*8192+Math.round(Y[2*G]/V)+I;if(Y[G]=W&67108863,W<67108864)I=0;else I=W/67108864|0}return Y},x.prototype.convert13b=function(Y,V,I,G){var W=0;for(var C=0;C<V;C++)W=W+(Y[C]|0),I[2*C]=W&8191,W=W>>>13,I[2*C+1]=W&8191,W=W>>>13;for(C=2*V;C<G;++C)I[C]=0;K(W===0),K((W&-8192)===0)},x.prototype.stub=function(Y){var V=Array(Y);for(var I=0;I<Y;I++)V[I]=0;return V},x.prototype.mulp=function(Y,V,I){var G=2*this.guessLen13b(Y.length,V.length),W=this.makeRBT(G),C=this.stub(G),D=Array(G),F=Array(G),J=Array(G),O=Array(G),P=Array(G),R=Array(G),_=I.words;_.length=G,this.convert13b(Y.words,Y.length,D,G),this.convert13b(V.words,V.length,O,G),this.transform(D,C,F,J,G,W),this.transform(O,C,P,R,G,W);for(var f=0;f<G;f++){var c=F[f]*P[f]-J[f]*R[f];J[f]=F[f]*R[f]+J[f]*P[f],F[f]=c}return this.conjugate(F,J,G),this.transform(F,J,_,C,G,W),this.conjugate(_,C,G),this.normalize13b(_,G),I.negative=Y.negative^V.negative,I.length=Y.length+V.length,I.strip()},$.prototype.mul=function(Y){var V=new $(null);return V.words=Array(this.length+Y.length),this.mulTo(Y,V)},$.prototype.mulf=function(Y){var V=new $(null);return V.words=Array(this.length+Y.length),v(this,Y,V)},$.prototype.imul=function(Y){return this.clone().mulTo(Y,this)},$.prototype.imuln=function(Y){K(typeof Y==="number"),K(Y<67108864);var V=0;for(var I=0;I<this.length;I++){var G=(this.words[I]|0)*Y,W=(G&67108863)+(V&67108863);V>>=26,V+=G/67108864|0,V+=W>>>26,this.words[I]=W&67108863}if(V!==0)this.words[I]=V,this.length++;return this.length=Y===0?1:this.length,this},$.prototype.muln=function(Y){return this.clone().imuln(Y)},$.prototype.sqr=function(){return this.mul(this)},$.prototype.isqr=function(){return this.imul(this.clone())},$.prototype.pow=function(Y){var V=S(Y);if(V.length===0)return new $(1);var I=this;for(var G=0;G<V.length;G++,I=I.sqr())if(V[G]!==0)break;if(++G<V.length)for(var W=I.sqr();G<V.length;G++,W=W.sqr()){if(V[G]===0)continue;I=I.mul(W)}return I},$.prototype.iushln=function(Y){K(typeof Y==="number"&&Y>=0);var V=Y%26,I=(Y-V)/26,G=67108863>>>26-V<<26-V,W;if(V!==0){var C=0;for(W=0;W<this.length;W++){var D=this.words[W]&G,F=(this.words[W]|0)-D<<V;this.words[W]=F|C,C=D>>>26-V}if(C)this.words[W]=C,this.length++}if(I!==0){for(W=this.length-1;W>=0;W--)this.words[W+I]=this.words[W];for(W=0;W<I;W++)this.words[W]=0;this.length+=I}return this.strip()},$.prototype.ishln=function(Y){return K(this.negative===0),this.iushln(Y)},$.prototype.iushrn=function(Y,V,I){K(typeof Y==="number"&&Y>=0);var G;if(V)G=(V-V%26)/26;else G=0;var W=Y%26,C=Math.min((Y-W)/26,this.length),D=67108863^67108863>>>W<<W,F=I;if(G-=C,G=Math.max(0,G),F){for(var J=0;J<C;J++)F.words[J]=this.words[J];F.length=C}if(C===0);else if(this.length>C){this.length-=C;for(J=0;J<this.length;J++)this.words[J]=this.words[J+C]}else this.words[0]=0,this.length=1;var O=0;for(J=this.length-1;J>=0&&(O!==0||J>=G);J--){var P=this.words[J]|0;this.words[J]=O<<26-W|P>>>W,O=P&D}if(F&&O!==0)F.words[F.length++]=O;if(this.length===0)this.words[0]=0,this.length=1;return this.strip()},$.prototype.ishrn=function(Y,V,I){return K(this.negative===0),this.iushrn(Y,V,I)},$.prototype.shln=function(Y){return this.clone().ishln(Y)},$.prototype.ushln=function(Y){return this.clone().iushln(Y)},$.prototype.shrn=function(Y){return this.clone().ishrn(Y)},$.prototype.ushrn=function(Y){return this.clone().iushrn(Y)},$.prototype.testn=function(Y){K(typeof Y==="number"&&Y>=0);var V=Y%26,I=(Y-V)/26,G=1<<V;if(this.length<=I)return!1;var W=this.words[I];return!!(W&G)},$.prototype.imaskn=function(Y){K(typeof Y==="number"&&Y>=0);var V=Y%26,I=(Y-V)/26;if(K(this.negative===0,"imaskn works only with positive numbers"),this.length<=I)return this;if(V!==0)I++;if(this.length=Math.min(I,this.length),V!==0){var G=67108863^67108863>>>V<<V;this.words[this.length-1]&=G}return this.strip()},$.prototype.maskn=function(Y){return this.clone().imaskn(Y)},$.prototype.iaddn=function(Y){if(K(typeof Y==="number"),K(Y<67108864),Y<0)return this.isubn(-Y);if(this.negative!==0){if(this.length===1&&(this.words[0]|0)<Y)return this.words[0]=Y-(this.words[0]|0),this.negative=0,this;return this.negative=0,this.isubn(Y),this.negative=1,this}return this._iaddn(Y)},$.prototype._iaddn=function(Y){this.words[0]+=Y;for(var V=0;V<this.length&&this.words[V]>=67108864;V++)if(this.words[V]-=67108864,V===this.length-1)this.words[V+1]=1;else this.words[V+1]++;return this.length=Math.max(this.length,V+1),this},$.prototype.isubn=function(Y){if(K(typeof Y==="number"),K(Y<67108864),Y<0)return this.iaddn(-Y);if(this.negative!==0)return this.negative=0,this.iaddn(Y),this.negative=1,this;if(this.words[0]-=Y,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var V=0;V<this.length&&this.words[V]<0;V++)this.words[V]+=67108864,this.words[V+1]-=1;return this.strip()},$.prototype.addn=function(Y){return this.clone().iaddn(Y)},$.prototype.subn=function(Y){return this.clone().isubn(Y)},$.prototype.iabs=function(){return this.negative=0,this},$.prototype.abs=function(){return this.clone().iabs()},$.prototype._ishlnsubmul=function(Y,V,I){var G=Y.length+I,W;this._expand(G);var C,D=0;for(W=0;W<Y.length;W++){C=(this.words[W+I]|0)+D;var F=(Y.words[W]|0)*V;C-=F&67108863,D=(C>>26)-(F/67108864|0),this.words[W+I]=C&67108863}for(;W<this.length-I;W++)C=(this.words[W+I]|0)+D,D=C>>26,this.words[W+I]=C&67108863;if(D===0)return this.strip();K(D===-1),D=0;for(W=0;W<this.length;W++)C=-(this.words[W]|0)+D,D=C>>26,this.words[W]=C&67108863;return this.negative=1,this.strip()},$.prototype._wordDiv=function(Y,V){var I=this.length-Y.length,G=this.clone(),W=Y,C=W.words[W.length-1]|0,D=this._countBits(C);if(I=26-D,I!==0)W=W.ushln(I),G.iushln(I),C=W.words[W.length-1]|0;var F=G.length-W.length,J;if(V!=="mod"){J=new $(null),J.length=F+1,J.words=Array(J.length);for(var O=0;O<J.length;O++)J.words[O]=0}var P=G.clone()._ishlnsubmul(W,1,F);if(P.negative===0){if(G=P,J)J.words[F]=1}for(var R=F-1;R>=0;R--){var _=(G.words[W.length+R]|0)*67108864+(G.words[W.length+R-1]|0);_=Math.min(_/C|0,67108863),G._ishlnsubmul(W,_,R);while(G.negative!==0)if(_--,G.negative=0,G._ishlnsubmul(W,1,R),!G.isZero())G.negative^=1;if(J)J.words[R]=_}if(J)J.strip();if(G.strip(),V!=="div"&&I!==0)G.iushrn(I);return{div:J||null,mod:G}},$.prototype.divmod=function(Y,V,I){if(K(!Y.isZero()),this.isZero())return{div:new $(0),mod:new $(0)};var G,W,C;if(this.negative!==0&&Y.negative===0){if(C=this.neg().divmod(Y,V),V!=="mod")G=C.div.neg();if(V!=="div"){if(W=C.mod.neg(),I&&W.negative!==0)W.iadd(Y)}return{div:G,mod:W}}if(this.negative===0&&Y.negative!==0){if(C=this.divmod(Y.neg(),V),V!=="mod")G=C.div.neg();return{div:G,mod:C.mod}}if((this.negative&Y.negative)!==0){if(C=this.neg().divmod(Y.neg(),V),V!=="div"){if(W=C.mod.neg(),I&&W.negative!==0)W.isub(Y)}return{div:C.div,mod:W}}if(Y.length>this.length||this.cmp(Y)<0)return{div:new $(0),mod:this};if(Y.length===1){if(V==="div")return{div:this.divn(Y.words[0]),mod:null};if(V==="mod")return{div:null,mod:new $(this.modn(Y.words[0]))};return{div:this.divn(Y.words[0]),mod:new $(this.modn(Y.words[0]))}}return this._wordDiv(Y,V)},$.prototype.div=function(Y){return this.divmod(Y,"div",!1).div},$.prototype.mod=function(Y){return this.divmod(Y,"mod",!1).mod},$.prototype.umod=function(Y){return this.divmod(Y,"mod",!0).mod},$.prototype.divRound=function(Y){var V=this.divmod(Y);if(V.mod.isZero())return V.div;var I=V.div.negative!==0?V.mod.isub(Y):V.mod,G=Y.ushrn(1),W=Y.andln(1),C=I.cmp(G);if(C<0||W===1&&C===0)return V.div;return V.div.negative!==0?V.div.isubn(1):V.div.iaddn(1)},$.prototype.modn=function(Y){K(Y<=67108863);var V=67108864%Y,I=0;for(var G=this.length-1;G>=0;G--)I=(V*I+(this.words[G]|0))%Y;return I},$.prototype.idivn=function(Y){K(Y<=67108863);var V=0;for(var I=this.length-1;I>=0;I--){var G=(this.words[I]|0)+V*67108864;this.words[I]=G/Y|0,V=G%Y}return this.strip()},$.prototype.divn=function(Y){return this.clone().idivn(Y)},$.prototype.egcd=function(Y){K(Y.negative===0),K(!Y.isZero());var V=this,I=Y.clone();if(V.negative!==0)V=V.umod(Y);else V=V.clone();var G=new $(1),W=new $(0),C=new $(0),D=new $(1),F=0;while(V.isEven()&&I.isEven())V.iushrn(1),I.iushrn(1),++F;var J=I.clone(),O=V.clone();while(!V.isZero()){for(var P=0,R=1;(V.words[0]&R)===0&&P<26;++P,R<<=1);if(P>0){V.iushrn(P);while(P-- >0){if(G.isOdd()||W.isOdd())G.iadd(J),W.isub(O);G.iushrn(1),W.iushrn(1)}}for(var _=0,f=1;(I.words[0]&f)===0&&_<26;++_,f<<=1);if(_>0){I.iushrn(_);while(_-- >0){if(C.isOdd()||D.isOdd())C.iadd(J),D.isub(O);C.iushrn(1),D.iushrn(1)}}if(V.cmp(I)>=0)V.isub(I),G.isub(C),W.isub(D);else I.isub(V),C.isub(G),D.isub(W)}return{a:C,b:D,gcd:I.iushln(F)}},$.prototype._invmp=function(Y){K(Y.negative===0),K(!Y.isZero());var V=this,I=Y.clone();if(V.negative!==0)V=V.umod(Y);else V=V.clone();var G=new $(1),W=new $(0),C=I.clone();while(V.cmpn(1)>0&&I.cmpn(1)>0){for(var D=0,F=1;(V.words[0]&F)===0&&D<26;++D,F<<=1);if(D>0){V.iushrn(D);while(D-- >0){if(G.isOdd())G.iadd(C);G.iushrn(1)}}for(var J=0,O=1;(I.words[0]&O)===0&&J<26;++J,O<<=1);if(J>0){I.iushrn(J);while(J-- >0){if(W.isOdd())W.iadd(C);W.iushrn(1)}}if(V.cmp(I)>=0)V.isub(I),G.isub(W);else I.isub(V),W.isub(G)}var P;if(V.cmpn(1)===0)P=G;else P=W;if(P.cmpn(0)<0)P.iadd(Y);return P},$.prototype.gcd=function(Y){if(this.isZero())return Y.abs();if(Y.isZero())return this.abs();var V=this.clone(),I=Y.clone();V.negative=0,I.negative=0;for(var G=0;V.isEven()&&I.isEven();G++)V.iushrn(1),I.iushrn(1);do{while(V.isEven())V.iushrn(1);while(I.isEven())I.iushrn(1);var W=V.cmp(I);if(W<0){var C=V;V=I,I=C}else if(W===0||I.cmpn(1)===0)break;V.isub(I)}while(!0);return I.iushln(G)},$.prototype.invm=function(Y){return this.egcd(Y).a.umod(Y)},$.prototype.isEven=function(){return(this.words[0]&1)===0},$.prototype.isOdd=function(){return(this.words[0]&1)===1},$.prototype.andln=function(Y){return this.words[0]&Y},$.prototype.bincn=function(Y){K(typeof Y==="number");var V=Y%26,I=(Y-V)/26,G=1<<V;if(this.length<=I)return this._expand(I+1),this.words[I]|=G,this;var W=G;for(var C=I;W!==0&&C<this.length;C++){var D=this.words[C]|0;D+=W,W=D>>>26,D&=67108863,this.words[C]=D}if(W!==0)this.words[C]=W,this.length++;return this},$.prototype.isZero=function(){return this.length===1&&this.words[0]===0},$.prototype.cmpn=function(Y){var V=Y<0;if(this.negative!==0&&!V)return-1;if(this.negative===0&&V)return 1;this.strip();var I;if(this.length>1)I=1;else{if(V)Y=-Y;K(Y<=67108863,"Number is too big");var G=this.words[0]|0;I=G===Y?0:G<Y?-1:1}if(this.negative!==0)return-I|0;return I},$.prototype.cmp=function(Y){if(this.negative!==0&&Y.negative===0)return-1;if(this.negative===0&&Y.negative!==0)return 1;var V=this.ucmp(Y);if(this.negative!==0)return-V|0;return V},$.prototype.ucmp=function(Y){if(this.length>Y.length)return 1;if(this.length<Y.length)return-1;var V=0;for(var I=this.length-1;I>=0;I--){var G=this.words[I]|0,W=Y.words[I]|0;if(G===W)continue;if(G<W)V=-1;else if(G>W)V=1;break}return V},$.prototype.gtn=function(Y){return this.cmpn(Y)===1},$.prototype.gt=function(Y){return this.cmp(Y)===1},$.prototype.gten=function(Y){return this.cmpn(Y)>=0},$.prototype.gte=function(Y){return this.cmp(Y)>=0},$.prototype.ltn=function(Y){return this.cmpn(Y)===-1},$.prototype.lt=function(Y){return this.cmp(Y)===-1},$.prototype.lten=function(Y){return this.cmpn(Y)<=0},$.prototype.lte=function(Y){return this.cmp(Y)<=0},$.prototype.eqn=function(Y){return this.cmpn(Y)===0},$.prototype.eq=function(Y){return this.cmp(Y)===0},$.red=function(Y){return new b(Y)},$.prototype.toRed=function(Y){return K(!this.red,"Already a number in reduction context"),K(this.negative===0,"red works only with positives"),Y.convertTo(this)._forceRed(Y)},$.prototype.fromRed=function(){return K(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},$.prototype._forceRed=function(Y){return this.red=Y,this},$.prototype.forceRed=function(Y){return K(!this.red,"Already a number in reduction context"),this._forceRed(Y)},$.prototype.redAdd=function(Y){return K(this.red,"redAdd works only with red numbers"),this.red.add(this,Y)},$.prototype.redIAdd=function(Y){return K(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,Y)},$.prototype.redSub=function(Y){return K(this.red,"redSub works only with red numbers"),this.red.sub(this,Y)},$.prototype.redISub=function(Y){return K(this.red,"redISub works only with red numbers"),this.red.isub(this,Y)},$.prototype.redShl=function(Y){return K(this.red,"redShl works only with red numbers"),this.red.shl(this,Y)},$.prototype.redMul=function(Y){return K(this.red,"redMul works only with red numbers"),this.red._verify2(this,Y),this.red.mul(this,Y)},$.prototype.redIMul=function(Y){return K(this.red,"redMul works only with red numbers"),this.red._verify2(this,Y),this.red.imul(this,Y)},$.prototype.redSqr=function(){return K(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},$.prototype.redISqr=function(){return K(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},$.prototype.redSqrt=function(){return K(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},$.prototype.redInvm=function(){return K(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},$.prototype.redNeg=function(){return K(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},$.prototype.redPow=function(Y){return K(this.red&&!Y.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,Y)};var N={k256:null,p224:null,p192:null,p25519:null};function w(Y,V){this.name=Y,this.p=new $(V,16),this.n=this.p.bitLength(),this.k=new $(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}w.prototype._tmp=function(){var Y=new $(null);return Y.words=Array(Math.ceil(this.n/13)),Y},w.prototype.ireduce=function(Y){var V=Y,I;do this.split(V,this.tmp),V=this.imulK(V),V=V.iadd(this.tmp),I=V.bitLength();while(I>this.n);var G=I<this.n?-1:V.ucmp(this.p);if(G===0)V.words[0]=0,V.length=1;else if(G>0)V.isub(this.p);else if(V.strip!==void 0)V.strip();else V._strip();return V},w.prototype.split=function(Y,V){Y.iushrn(this.n,0,V)},w.prototype.imulK=function(Y){return Y.imul(this.k)};function u(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}H(u,w),u.prototype.split=function(Y,V){var I=4194303,G=Math.min(Y.length,9);for(var W=0;W<G;W++)V.words[W]=Y.words[W];if(V.length=G,Y.length<=9){Y.words[0]=0,Y.length=1;return}var C=Y.words[9];V.words[V.length++]=C&I;for(W=10;W<Y.length;W++){var D=Y.words[W]|0;Y.words[W-10]=(D&I)<<4|C>>>22,C=D}if(C>>>=22,Y.words[W-10]=C,C===0&&Y.length>10)Y.length-=10;else Y.length-=9},u.prototype.imulK=function(Y){Y.words[Y.length]=0,Y.words[Y.length+1]=0,Y.length+=2;var V=0;for(var I=0;I<Y.length;I++){var G=Y.words[I]|0;V+=G*977,Y.words[I]=V&67108863,V=G*64+(V/67108864|0)}if(Y.words[Y.length-1]===0){if(Y.length--,Y.words[Y.length-1]===0)Y.length--}return Y};function Z0(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}H(Z0,w);function V0(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}H(V0,w);function Y0(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}H(Y0,w),Y0.prototype.imulK=function(Y){var V=0;for(var I=0;I<Y.length;I++){var G=(Y.words[I]|0)*19+V,W=G&67108863;G>>>=26,Y.words[I]=W,V=G}if(V!==0)Y.words[Y.length++]=V;return Y},$._prime=function(Y){if(N[Y])return N[Y];var V;if(Y==="k256")V=new u;else if(Y==="p224")V=new Z0;else if(Y==="p192")V=new V0;else if(Y==="p25519")V=new Y0;else throw Error("Unknown prime "+Y);return N[Y]=V,V};function b(Y){if(typeof Y==="string"){var V=$._prime(Y);this.m=V.p,this.prime=V}else K(Y.gtn(1),"modulus must be greater than 1"),this.m=Y,this.prime=null}b.prototype._verify1=function(Y){K(Y.negative===0,"red works only with positives"),K(Y.red,"red works only with red numbers")},b.prototype._verify2=function(Y,V){K((Y.negative|V.negative)===0,"red works only with positives"),K(Y.red&&Y.red===V.red,"red works only with red numbers")},b.prototype.imod=function(Y){if(this.prime)return this.prime.ireduce(Y)._forceRed(this);return Y.umod(this.m)._forceRed(this)},b.prototype.neg=function(Y){if(Y.isZero())return Y.clone();return this.m.sub(Y)._forceRed(this)},b.prototype.add=function(Y,V){this._verify2(Y,V);var I=Y.add(V);if(I.cmp(this.m)>=0)I.isub(this.m);return I._forceRed(this)},b.prototype.iadd=function(Y,V){this._verify2(Y,V);var I=Y.iadd(V);if(I.cmp(this.m)>=0)I.isub(this.m);return I},b.prototype.sub=function(Y,V){this._verify2(Y,V);var I=Y.sub(V);if(I.cmpn(0)<0)I.iadd(this.m);return I._forceRed(this)},b.prototype.isub=function(Y,V){this._verify2(Y,V);var I=Y.isub(V);if(I.cmpn(0)<0)I.iadd(this.m);return I},b.prototype.shl=function(Y,V){return this._verify1(Y),this.imod(Y.ushln(V))},b.prototype.imul=function(Y,V){return this._verify2(Y,V),this.imod(Y.imul(V))},b.prototype.mul=function(Y,V){return this._verify2(Y,V),this.imod(Y.mul(V))},b.prototype.isqr=function(Y){return this.imul(Y,Y.clone())},b.prototype.sqr=function(Y){return this.mul(Y,Y)},b.prototype.sqrt=function(Y){if(Y.isZero())return Y.clone();var V=this.m.andln(3);if(K(V%2===1),V===3){var I=this.m.add(new $(1)).iushrn(2);return this.pow(Y,I)}var G=this.m.subn(1),W=0;while(!G.isZero()&&G.andln(1)===0)W++,G.iushrn(1);K(!G.isZero());var C=new $(1).toRed(this),D=C.redNeg(),F=this.m.subn(1).iushrn(1),J=this.m.bitLength();J=new $(2*J*J).toRed(this);while(this.pow(J,F).cmp(D)!==0)J.redIAdd(D);var O=this.pow(J,G),P=this.pow(Y,G.addn(1).iushrn(1)),R=this.pow(Y,G),_=W;while(R.cmp(C)!==0){var f=R;for(var c=0;f.cmp(C)!==0;c++)f=f.redSqr();K(c<_);var o=this.pow(O,new $(1).iushln(_-c-1));P=P.redMul(o),O=o.redSqr(),R=R.redMul(O),_=c}return P},b.prototype.invm=function(Y){var V=Y._invmp(this.m);if(V.negative!==0)return V.negative=0,this.imod(V).redNeg();else return this.imod(V)},b.prototype.pow=function(Y,V){if(V.isZero())return new $(1).toRed(this);if(V.cmpn(1)===0)return Y.clone();var I=4,G=Array(1<<I);G[0]=new $(1).toRed(this),G[1]=Y;for(var W=2;W<G.length;W++)G[W]=this.mul(G[W-1],Y);var C=G[0],D=0,F=0,J=V.bitLength()%26;if(J===0)J=26;for(W=V.length-1;W>=0;W--){var O=V.words[W];for(var P=J-1;P>=0;P--){var R=O>>P&1;if(C!==G[0])C=this.sqr(C);if(R===0&&D===0){F=0;continue}if(D<<=1,D|=R,F++,F!==I&&(W!==0||P!==0))continue;C=this.mul(C,G[D]),F=0,D=0}J=26}return C},b.prototype.convertTo=function(Y){var V=Y.umod(this.m);return V===Y?V.clone():V},b.prototype.convertFrom=function(Y){var V=Y.clone();return V.red=null,V},$.mont=function(Y){return new i(Y)};function i(Y){if(b.call(this,Y),this.shift=this.m.bitLength(),this.shift%26!==0)this.shift+=26-this.shift%26;this.r=new $(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}H(i,b),i.prototype.convertTo=function(Y){return this.imod(Y.ushln(this.shift))},i.prototype.convertFrom=function(Y){var V=this.imod(Y.mul(this.rinv));return V.red=null,V},i.prototype.imul=function(Y,V){if(Y.isZero()||V.isZero())return Y.words[0]=0,Y.length=1,Y;var I=Y.imul(V),G=I.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),W=I.isub(G).iushrn(this.shift),C=W;if(W.cmp(this.m)>=0)C=W.isub(this.m);else if(W.cmpn(0)<0)C=W.iadd(this.m);return C._forceRed(this)},i.prototype.mul=function(Y,V){if(Y.isZero()||V.isZero())return new $(0)._forceRed(this);var I=Y.mul(V),G=I.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),W=I.isub(G).iushrn(this.shift),C=W;if(W.cmp(this.m)>=0)C=W.isub(this.m);else if(W.cmpn(0)<0)C=W.iadd(this.m);return C._forceRed(this)},i.prototype.invm=function(Y){var V=this.imod(Y._invmp(this.m).mul(this.r2));return V._forceRed(this)}})(typeof Z>"u"||Z,U)}),cU=$0((U,Z)=>{Z.exports=X;function X(Q,K){if(!Q)throw Error(K||"Assertion failed")}X.equal=function(Q,K,H){if(Q!=K)throw Error(H||"Assertion failed: "+Q+" != "+K)}}),UV=$0((U)=>{var Z=U;function X(H,$){if(Array.isArray(H))return H.slice();if(!H)return[];var M=[];if(typeof H!=="string"){for(var q=0;q<H.length;q++)M[q]=H[q]|0;return M}if($==="hex"){if(H=H.replace(/[^a-z0-9]+/ig,""),H.length%2!==0)H="0"+H;for(var q=0;q<H.length;q+=2)M.push(parseInt(H[q]+H[q+1],16))}else for(var q=0;q<H.length;q++){var z=H.charCodeAt(q),T=z>>8,A=z&255;if(T)M.push(T,A);else M.push(A)}return M}Z.toArray=X;function Q(H){if(H.length===1)return"0"+H;else return H}Z.zero2=Q;function K(H){var $="";for(var M=0;M<H.length;M++)$+=Q(H[M].toString(16));return $}Z.toHex=K,Z.encode=function(H,$){if($==="hex")return K(H);else return H}}),WU=$0((U)=>{var Z=U,X=jU(),Q=cU(),K=UV();Z.assert=Q,Z.toArray=K.toArray,Z.zero2=K.zero2,Z.toHex=K.toHex,Z.encode=K.encode;function H(T,A,L){var E=Array(Math.max(T.bitLength(),L)+1),S;for(S=0;S<E.length;S+=1)E[S]=0;var j=1<<A+1,k=T.clone();for(S=0;S<E.length;S++){var B,v=k.andln(j-1);if(k.isOdd()){if(v>(j>>1)-1)B=(j>>1)-v;else B=v;k.isubn(B)}else B=0;E[S]=B,k.iushrn(1)}return E}Z.getNAF=H;function $(T,A){var L=[[],[]];T=T.clone(),A=A.clone();var E=0,S=0,j;while(T.cmpn(-E)>0||A.cmpn(-S)>0){var k=T.andln(3)+E&3,B=A.andln(3)+S&3;if(k===3)k=-1;if(B===3)B=-1;var v;if((k&1)===0)v=0;else if(j=T.andln(7)+E&7,(j===3||j===5)&&B===2)v=-k;else v=k;L[0].push(v);var x;if((B&1)===0)x=0;else if(j=A.andln(7)+S&7,(j===3||j===5)&&k===2)x=-B;else x=B;if(L[1].push(x),2*E===v+1)E=1-E;if(2*S===x+1)S=1-S;T.iushrn(1),A.iushrn(1)}return L}Z.getJSF=$;function M(T,A,L){var E="_"+A;T.prototype[A]=function(){return this[E]!==void 0?this[E]:this[E]=L.call(this)}}Z.cachedProperty=M;function q(T){return typeof T==="string"?Z.toArray(T,"hex"):T}Z.parseBytes=q;function z(T){return new X(T,"hex","le")}Z.intFromLE=z}),ZV=$0((U,Z)=>{var X;Z.exports=function(H){if(!X)X=new Q(null);return X.generate(H)};function Q(H){this.rand=H}if(Z.exports.Rand=Q,Q.prototype.generate=function(H){return this._rand(H)},Q.prototype._rand=function(H){if(this.rand.getBytes)return this.rand.getBytes(H);var $=new Uint8Array(H);for(var M=0;M<$.length;M++)$[M]=this.rand.getByte();return $},typeof self==="object"){if(self.crypto&&self.crypto.getRandomValues)Q.prototype._rand=function(H){var $=new Uint8Array(H);return self.crypto.getRandomValues($),$};else if(self.msCrypto&&self.msCrypto.getRandomValues)Q.prototype._rand=function(H){var $=new Uint8Array(H);return self.msCrypto.getRandomValues($),$};else if(typeof window==="object")Q.prototype._rand=function(){throw Error("Not implemented yet")}}else try{if(K=(UU(),m0(e1)),typeof K.randomBytes!=="function")throw Error("Not supported");Q.prototype._rand=function(H){return K.randomBytes(H)}}catch(H){}var K}),xX=$0((U,Z)=>{var X=jU(),Q=WU(),K=Q.getNAF,H=Q.getJSF,$=Q.assert;function M(z,T){this.type=z,this.p=new X(T.p,16),this.red=T.prime?X.red(T.prime):X.mont(this.p),this.zero=new X(0).toRed(this.red),this.one=new X(1).toRed(this.red),this.two=new X(2).toRed(this.red),this.n=T.n&&new X(T.n,16),this.g=T.g&&this.pointFromJSON(T.g,T.gRed),this._wnafT1=[,,,,],this._wnafT2=[,,,,],this._wnafT3=[,,,,],this._wnafT4=[,,,,],this._bitLength=this.n?this.n.bitLength():0;var A=this.n&&this.p.div(this.n);if(!A||A.cmpn(100)>0)this.redN=null;else this._maxwellTrick=!0,this.redN=this.n.toRed(this.red)}Z.exports=M,M.prototype.point=function(){throw Error("Not implemented")},M.prototype.validate=function(){throw Error("Not implemented")},M.prototype._fixedNafMul=function(z,T){$(z.precomputed);var A=z._getDoubles(),L=K(T,1,this._bitLength),E=(1<<A.step+1)-(A.step%2===0?2:1);E/=3;var S=[],j,k;for(j=0;j<L.length;j+=A.step){k=0;for(var B=j+A.step-1;B>=j;B--)k=(k<<1)+L[B];S.push(k)}var v=this.jpoint(null,null,null),x=this.jpoint(null,null,null);for(var N=E;N>0;N--){for(j=0;j<S.length;j++)if(k=S[j],k===N)x=x.mixedAdd(A.points[j]);else if(k===-N)x=x.mixedAdd(A.points[j].neg());v=v.add(x)}return v.toP()},M.prototype._wnafMul=function(z,T){var A=4,L=z._getNAFPoints(A);A=L.wnd;var E=L.points,S=K(T,A,this._bitLength),j=this.jpoint(null,null,null);for(var k=S.length-1;k>=0;k--){for(var B=0;k>=0&&S[k]===0;k--)B++;if(k>=0)B++;if(j=j.dblp(B),k<0)break;var v=S[k];if($(v!==0),z.type==="affine")if(v>0)j=j.mixedAdd(E[v-1>>1]);else j=j.mixedAdd(E[-v-1>>1].neg());else if(v>0)j=j.add(E[v-1>>1]);else j=j.add(E[-v-1>>1].neg())}return z.type==="affine"?j.toP():j},M.prototype._wnafMulAdd=function(z,T,A,L,E){var S=this._wnafT1,j=this._wnafT2,k=this._wnafT3,B=0,v,x,N;for(v=0;v<L;v++){N=T[v];var w=N._getNAFPoints(z);S[v]=w.wnd,j[v]=w.points}for(v=L-1;v>=1;v-=2){var u=v-1,Z0=v;if(S[u]!==1||S[Z0]!==1){k[u]=K(A[u],S[u],this._bitLength),k[Z0]=K(A[Z0],S[Z0],this._bitLength),B=Math.max(k[u].length,B),B=Math.max(k[Z0].length,B);continue}var V0=[T[u],null,null,T[Z0]];if(T[u].y.cmp(T[Z0].y)===0)V0[1]=T[u].add(T[Z0]),V0[2]=T[u].toJ().mixedAdd(T[Z0].neg());else if(T[u].y.cmp(T[Z0].y.redNeg())===0)V0[1]=T[u].toJ().mixedAdd(T[Z0]),V0[2]=T[u].add(T[Z0].neg());else V0[1]=T[u].toJ().mixedAdd(T[Z0]),V0[2]=T[u].toJ().mixedAdd(T[Z0].neg());var Y0=[-3,-1,-5,-7,0,7,5,1,3],b=H(A[u],A[Z0]);B=Math.max(b[0].length,B),k[u]=Array(B),k[Z0]=Array(B);for(x=0;x<B;x++){var i=b[0][x]|0,Y=b[1][x]|0;k[u][x]=Y0[(i+1)*3+(Y+1)],k[Z0][x]=0,j[u]=V0}}var V=this.jpoint(null,null,null),I=this._wnafT4;for(v=B;v>=0;v--){var G=0;while(v>=0){var W=!0;for(x=0;x<L;x++)if(I[x]=k[x][v]|0,I[x]!==0)W=!1;if(!W)break;G++,v--}if(v>=0)G++;if(V=V.dblp(G),v<0)break;for(x=0;x<L;x++){var C=I[x];if(C===0)continue;else if(C>0)N=j[x][C-1>>1];else if(C<0)N=j[x][-C-1>>1].neg();if(N.type==="affine")V=V.mixedAdd(N);else V=V.add(N)}}for(v=0;v<L;v++)j[v]=null;if(E)return V;else return V.toP()};function q(z,T){this.curve=z,this.type=T,this.precomputed=null}M.BasePoint=q,q.prototype.eq=function(){throw Error("Not implemented")},q.prototype.validate=function(){return this.curve.validate(this)},M.prototype.decodePoint=function(z,T){z=Q.toArray(z,T);var A=this.p.byteLength();if((z[0]===4||z[0]===6||z[0]===7)&&z.length-1===2*A){if(z[0]===6)$(z[z.length-1]%2===0);else if(z[0]===7)$(z[z.length-1]%2===1);var L=this.point(z.slice(1,1+A),z.slice(1+A,1+2*A));return L}else if((z[0]===2||z[0]===3)&&z.length-1===A)return this.pointFromX(z.slice(1,1+A),z[0]===3);throw Error("Unknown point format")},q.prototype.encodeCompressed=function(z){return this.encode(z,!0)},q.prototype._encode=function(z){var T=this.curve.p.byteLength(),A=this.getX().toArray("be",T);if(z)return[this.getY().isEven()?2:3].concat(A);return[4].concat(A,this.getY().toArray("be",T))},q.prototype.encode=function(z,T){return Q.encode(this._encode(T),z)},q.prototype.precompute=function(z){if(this.precomputed)return this;var T={doubles:null,naf:null,beta:null};return T.naf=this._getNAFPoints(8),T.doubles=this._getDoubles(4,z),T.beta=this._getBeta(),this.precomputed=T,this},q.prototype._hasDoubles=function(z){if(!this.precomputed)return!1;var T=this.precomputed.doubles;if(!T)return!1;return T.points.length>=Math.ceil((z.bitLength()+1)/T.step)},q.prototype._getDoubles=function(z,T){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;var A=[this],L=this;for(var E=0;E<T;E+=z){for(var S=0;S<z;S++)L=L.dbl();A.push(L)}return{step:z,points:A}},q.prototype._getNAFPoints=function(z){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;var T=[this],A=(1<<z)-1,L=A===1?null:this.dbl();for(var E=1;E<A;E++)T[E]=T[E-1].add(L);return{wnd:z,points:T}},q.prototype._getBeta=function(){return null},q.prototype.dblp=function(z){var T=this;for(var A=0;A<z;A++)T=T.dbl();return T}}),AH=$0((U,Z)=>{if(typeof Object.create==="function")Z.exports=function(X,Q){if(Q)X.super_=Q,X.prototype=Object.create(Q.prototype,{constructor:{value:X,enumerable:!1,writable:!0,configurable:!0}})};else Z.exports=function(X,Q){if(Q){X.super_=Q;var K=function(){};K.prototype=Q.prototype,X.prototype=new K,X.prototype.constructor=X}}}),YU=$0((U,Z)=>{try{if(X=(AG(),m0(CG)),typeof X.inherits!=="function")throw"";Z.exports=X.inherits}catch(Q){Z.exports=AH()}var X}),zH=$0((U,Z)=>{var X=WU(),Q=jU(),K=YU(),H=xX(),$=X.assert;function M(T){H.call(this,"short",T),this.a=new Q(T.a,16).toRed(this.red),this.b=new Q(T.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(T),this._endoWnafT1=[,,,,],this._endoWnafT2=[,,,,]}K(M,H),Z.exports=M,M.prototype._getEndomorphism=function(T){if(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)return;var A,L;if(T.beta)A=new Q(T.beta,16).toRed(this.red);else{var E=this._getEndoRoots(this.p);A=E[0].cmp(E[1])<0?E[0]:E[1],A=A.toRed(this.red)}if(T.lambda)L=new Q(T.lambda,16);else{var S=this._getEndoRoots(this.n);if(this.g.mul(S[0]).x.cmp(this.g.x.redMul(A))===0)L=S[0];else L=S[1],$(this.g.mul(L).x.cmp(this.g.x.redMul(A))===0)}var j;if(T.basis)j=T.basis.map(function(k){return{a:new Q(k.a,16),b:new Q(k.b,16)}});else j=this._getEndoBasis(L);return{beta:A,lambda:L,basis:j}},M.prototype._getEndoRoots=function(T){var A=T===this.p?this.red:Q.mont(T),L=new Q(2).toRed(A).redInvm(),E=L.redNeg(),S=new Q(3).toRed(A).redNeg().redSqrt().redMul(L),j=E.redAdd(S).fromRed(),k=E.redSub(S).fromRed();return[j,k]},M.prototype._getEndoBasis=function(T){var A=this.n.ushrn(Math.floor(this.n.bitLength()/2)),L=T,E=this.n.clone(),S=new Q(1),j=new Q(0),k=new Q(0),B=new Q(1),v,x,N,w,u,Z0,V0,Y0=0,b,i;while(L.cmpn(0)!==0){var Y=E.div(L);b=E.sub(Y.mul(L)),i=k.sub(Y.mul(S));var V=B.sub(Y.mul(j));if(!N&&b.cmp(A)<0)v=V0.neg(),x=S,N=b.neg(),w=i;else if(N&&++Y0===2)break;V0=b,E=L,L=b,k=S,S=i,B=j,j=V}u=b.neg(),Z0=i;var I=N.sqr().add(w.sqr()),G=u.sqr().add(Z0.sqr());if(G.cmp(I)>=0)u=v,Z0=x;if(N.negative)N=N.neg(),w=w.neg();if(u.negative)u=u.neg(),Z0=Z0.neg();return[{a:N,b:w},{a:u,b:Z0}]},M.prototype._endoSplit=function(T){var A=this.endo.basis,L=A[0],E=A[1],S=E.b.mul(T).divRound(this.n),j=L.b.neg().mul(T).divRound(this.n),k=S.mul(L.a),B=j.mul(E.a),v=S.mul(L.b),x=j.mul(E.b),N=T.sub(k).sub(B),w=v.add(x).neg();return{k1:N,k2:w}},M.prototype.pointFromX=function(T,A){if(T=new Q(T,16),!T.red)T=T.toRed(this.red);var L=T.redSqr().redMul(T).redIAdd(T.redMul(this.a)).redIAdd(this.b),E=L.redSqrt();if(E.redSqr().redSub(L).cmp(this.zero)!==0)throw Error("invalid point");var S=E.fromRed().isOdd();if(A&&!S||!A&&S)E=E.redNeg();return this.point(T,E)},M.prototype.validate=function(T){if(T.inf)return!0;var{x:A,y:L}=T,E=this.a.redMul(A),S=A.redSqr().redMul(A).redIAdd(E).redIAdd(this.b);return L.redSqr().redISub(S).cmpn(0)===0},M.prototype._endoWnafMulAdd=function(T,A,L){var E=this._endoWnafT1,S=this._endoWnafT2;for(var j=0;j<T.length;j++){var k=this._endoSplit(A[j]),B=T[j],v=B._getBeta();if(k.k1.negative)k.k1.ineg(),B=B.neg(!0);if(k.k2.negative)k.k2.ineg(),v=v.neg(!0);E[j*2]=B,E[j*2+1]=v,S[j*2]=k.k1,S[j*2+1]=k.k2}var x=this._wnafMulAdd(1,E,S,j*2,L);for(var N=0;N<j*2;N++)E[N]=null,S[N]=null;return x};function q(T,A,L,E){if(H.BasePoint.call(this,T,"affine"),A===null&&L===null)this.x=null,this.y=null,this.inf=!0;else{if(this.x=new Q(A,16),this.y=new Q(L,16),E)this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red);if(!this.x.red)this.x=this.x.toRed(this.curve.red);if(!this.y.red)this.y=this.y.toRed(this.curve.red);this.inf=!1}}K(q,H.BasePoint),M.prototype.point=function(T,A,L){return new q(this,T,A,L)},M.prototype.pointFromJSON=function(T,A){return q.fromJSON(this,T,A)},q.prototype._getBeta=function(){if(!this.curve.endo)return;var T=this.precomputed;if(T&&T.beta)return T.beta;var A=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(T){var L=this.curve,E=function(S){return L.point(S.x.redMul(L.endo.beta),S.y)};T.beta=A,A.precomputed={beta:null,naf:T.naf&&{wnd:T.naf.wnd,points:T.naf.points.map(E)},doubles:T.doubles&&{step:T.doubles.step,points:T.doubles.points.map(E)}}}return A},q.prototype.toJSON=function(){if(!this.precomputed)return[this.x,this.y];return[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]},q.fromJSON=function(T,A,L){if(typeof A==="string")A=JSON.parse(A);var E=T.point(A[0],A[1],L);if(!A[2])return E;function S(k){return T.point(k[0],k[1],L)}var j=A[2];return E.precomputed={beta:null,doubles:j.doubles&&{step:j.doubles.step,points:[E].concat(j.doubles.points.map(S))},naf:j.naf&&{wnd:j.naf.wnd,points:[E].concat(j.naf.points.map(S))}},E},q.prototype.inspect=function(){if(this.isInfinity())return"<EC Point Infinity>";return"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},q.prototype.isInfinity=function(){return this.inf},q.prototype.add=function(T){if(this.inf)return T;if(T.inf)return this;if(this.eq(T))return this.dbl();if(this.neg().eq(T))return this.curve.point(null,null);if(this.x.cmp(T.x)===0)return this.curve.point(null,null);var A=this.y.redSub(T.y);if(A.cmpn(0)!==0)A=A.redMul(this.x.redSub(T.x).redInvm());var L=A.redSqr().redISub(this.x).redISub(T.x),E=A.redMul(this.x.redSub(L)).redISub(this.y);return this.curve.point(L,E)},q.prototype.dbl=function(){if(this.inf)return this;var T=this.y.redAdd(this.y);if(T.cmpn(0)===0)return this.curve.point(null,null);var A=this.curve.a,L=this.x.redSqr(),E=T.redInvm(),S=L.redAdd(L).redIAdd(L).redIAdd(A).redMul(E),j=S.redSqr().redISub(this.x.redAdd(this.x)),k=S.redMul(this.x.redSub(j)).redISub(this.y);return this.curve.point(j,k)},q.prototype.getX=function(){return this.x.fromRed()},q.prototype.getY=function(){return this.y.fromRed()},q.prototype.mul=function(T){if(T=new Q(T,16),this.isInfinity())return this;else if(this._hasDoubles(T))return this.curve._fixedNafMul(this,T);else if(this.curve.endo)return this.curve._endoWnafMulAdd([this],[T]);else return this.curve._wnafMul(this,T)},q.prototype.mulAdd=function(T,A,L){var E=[this,A],S=[T,L];if(this.curve.endo)return this.curve._endoWnafMulAdd(E,S);else return this.curve._wnafMulAdd(1,E,S,2)},q.prototype.jmulAdd=function(T,A,L){var E=[this,A],S=[T,L];if(this.curve.endo)return this.curve._endoWnafMulAdd(E,S,!0);else return this.curve._wnafMulAdd(1,E,S,2,!0)},q.prototype.eq=function(T){return this===T||this.inf===T.inf&&(this.inf||this.x.cmp(T.x)===0&&this.y.cmp(T.y)===0)},q.prototype.neg=function(T){if(this.inf)return this;var A=this.curve.point(this.x,this.y.redNeg());if(T&&this.precomputed){var L=this.precomputed,E=function(S){return S.neg()};A.precomputed={naf:L.naf&&{wnd:L.naf.wnd,points:L.naf.points.map(E)},doubles:L.doubles&&{step:L.doubles.step,points:L.doubles.points.map(E)}}}return A},q.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var T=this.curve.jpoint(this.x,this.y,this.curve.one);return T};function z(T,A,L,E){if(H.BasePoint.call(this,T,"jacobian"),A===null&&L===null&&E===null)this.x=this.curve.one,this.y=this.curve.one,this.z=new Q(0);else this.x=new Q(A,16),this.y=new Q(L,16),this.z=new Q(E,16);if(!this.x.red)this.x=this.x.toRed(this.curve.red);if(!this.y.red)this.y=this.y.toRed(this.curve.red);if(!this.z.red)this.z=this.z.toRed(this.curve.red);this.zOne=this.z===this.curve.one}K(z,H.BasePoint),M.prototype.jpoint=function(T,A,L){return new z(this,T,A,L)},z.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var T=this.z.redInvm(),A=T.redSqr(),L=this.x.redMul(A),E=this.y.redMul(A).redMul(T);return this.curve.point(L,E)},z.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},z.prototype.add=function(T){if(this.isInfinity())return T;if(T.isInfinity())return this;var A=T.z.redSqr(),L=this.z.redSqr(),E=this.x.redMul(A),S=T.x.redMul(L),j=this.y.redMul(A.redMul(T.z)),k=T.y.redMul(L.redMul(this.z)),B=E.redSub(S),v=j.redSub(k);if(B.cmpn(0)===0)if(v.cmpn(0)!==0)return this.curve.jpoint(null,null,null);else return this.dbl();var x=B.redSqr(),N=x.redMul(B),w=E.redMul(x),u=v.redSqr().redIAdd(N).redISub(w).redISub(w),Z0=v.redMul(w.redISub(u)).redISub(j.redMul(N)),V0=this.z.redMul(T.z).redMul(B);return this.curve.jpoint(u,Z0,V0)},z.prototype.mixedAdd=function(T){if(this.isInfinity())return T.toJ();if(T.isInfinity())return this;var A=this.z.redSqr(),L=this.x,E=T.x.redMul(A),S=this.y,j=T.y.redMul(A).redMul(this.z),k=L.redSub(E),B=S.redSub(j);if(k.cmpn(0)===0)if(B.cmpn(0)!==0)return this.curve.jpoint(null,null,null);else return this.dbl();var v=k.redSqr(),x=v.redMul(k),N=L.redMul(v),w=B.redSqr().redIAdd(x).redISub(N).redISub(N),u=B.redMul(N.redISub(w)).redISub(S.redMul(x)),Z0=this.z.redMul(k);return this.curve.jpoint(w,u,Z0)},z.prototype.dblp=function(T){if(T===0)return this;if(this.isInfinity())return this;if(!T)return this.dbl();var A;if(this.curve.zeroA||this.curve.threeA){var L=this;for(A=0;A<T;A++)L=L.dbl();return L}var E=this.curve.a,S=this.curve.tinv,j=this.x,k=this.y,B=this.z,v=B.redSqr().redSqr(),x=k.redAdd(k);for(A=0;A<T;A++){var N=j.redSqr(),w=x.redSqr(),u=w.redSqr(),Z0=N.redAdd(N).redIAdd(N).redIAdd(E.redMul(v)),V0=j.redMul(w),Y0=Z0.redSqr().redISub(V0.redAdd(V0)),b=V0.redISub(Y0),i=Z0.redMul(b);i=i.redIAdd(i).redISub(u);var Y=x.redMul(B);if(A+1<T)v=v.redMul(u);j=Y0,B=Y,x=i}return this.curve.jpoint(j,x.redMul(S),B)},z.prototype.dbl=function(){if(this.isInfinity())return this;if(this.curve.zeroA)return this._zeroDbl();else if(this.curve.threeA)return this._threeDbl();else return this._dbl()},z.prototype._zeroDbl=function(){var T,A,L;if(this.zOne){var E=this.x.redSqr(),S=this.y.redSqr(),j=S.redSqr(),k=this.x.redAdd(S).redSqr().redISub(E).redISub(j);k=k.redIAdd(k);var B=E.redAdd(E).redIAdd(E),v=B.redSqr().redISub(k).redISub(k),x=j.redIAdd(j);x=x.redIAdd(x),x=x.redIAdd(x),T=v,A=B.redMul(k.redISub(v)).redISub(x),L=this.y.redAdd(this.y)}else{var N=this.x.redSqr(),w=this.y.redSqr(),u=w.redSqr(),Z0=this.x.redAdd(w).redSqr().redISub(N).redISub(u);Z0=Z0.redIAdd(Z0);var V0=N.redAdd(N).redIAdd(N),Y0=V0.redSqr(),b=u.redIAdd(u);b=b.redIAdd(b),b=b.redIAdd(b),T=Y0.redISub(Z0).redISub(Z0),A=V0.redMul(Z0.redISub(T)).redISub(b),L=this.y.redMul(this.z),L=L.redIAdd(L)}return this.curve.jpoint(T,A,L)},z.prototype._threeDbl=function(){var T,A,L;if(this.zOne){var E=this.x.redSqr(),S=this.y.redSqr(),j=S.redSqr(),k=this.x.redAdd(S).redSqr().redISub(E).redISub(j);k=k.redIAdd(k);var B=E.redAdd(E).redIAdd(E).redIAdd(this.curve.a),v=B.redSqr().redISub(k).redISub(k);T=v;var x=j.redIAdd(j);x=x.redIAdd(x),x=x.redIAdd(x),A=B.redMul(k.redISub(v)).redISub(x),L=this.y.redAdd(this.y)}else{var N=this.z.redSqr(),w=this.y.redSqr(),u=this.x.redMul(w),Z0=this.x.redSub(N).redMul(this.x.redAdd(N));Z0=Z0.redAdd(Z0).redIAdd(Z0);var V0=u.redIAdd(u);V0=V0.redIAdd(V0);var Y0=V0.redAdd(V0);T=Z0.redSqr().redISub(Y0),L=this.y.redAdd(this.z).redSqr().redISub(w).redISub(N);var b=w.redSqr();b=b.redIAdd(b),b=b.redIAdd(b),b=b.redIAdd(b),A=Z0.redMul(V0.redISub(T)).redISub(b)}return this.curve.jpoint(T,A,L)},z.prototype._dbl=function(){var T=this.curve.a,A=this.x,L=this.y,E=this.z,S=E.redSqr().redSqr(),j=A.redSqr(),k=L.redSqr(),B=j.redAdd(j).redIAdd(j).redIAdd(T.redMul(S)),v=A.redAdd(A);v=v.redIAdd(v);var x=v.redMul(k),N=B.redSqr().redISub(x.redAdd(x)),w=x.redISub(N),u=k.redSqr();u=u.redIAdd(u),u=u.redIAdd(u),u=u.redIAdd(u);var Z0=B.redMul(w).redISub(u),V0=L.redAdd(L).redMul(E);return this.curve.jpoint(N,Z0,V0)},z.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var T=this.x.redSqr(),A=this.y.redSqr(),L=this.z.redSqr(),E=A.redSqr(),S=T.redAdd(T).redIAdd(T),j=S.redSqr(),k=this.x.redAdd(A).redSqr().redISub(T).redISub(E);k=k.redIAdd(k),k=k.redAdd(k).redIAdd(k),k=k.redISub(j);var B=k.redSqr(),v=E.redIAdd(E);v=v.redIAdd(v),v=v.redIAdd(v),v=v.redIAdd(v);var x=S.redIAdd(k).redSqr().redISub(j).redISub(B).redISub(v),N=A.redMul(x);N=N.redIAdd(N),N=N.redIAdd(N);var w=this.x.redMul(B).redISub(N);w=w.redIAdd(w),w=w.redIAdd(w);var u=this.y.redMul(x.redMul(v.redISub(x)).redISub(k.redMul(B)));u=u.redIAdd(u),u=u.redIAdd(u),u=u.redIAdd(u);var Z0=this.z.redAdd(k).redSqr().redISub(L).redISub(B);return this.curve.jpoint(w,u,Z0)},z.prototype.mul=function(T,A){return T=new Q(T,A),this.curve._wnafMul(this,T)},z.prototype.eq=function(T){if(T.type==="affine")return this.eq(T.toJ());if(this===T)return!0;var A=this.z.redSqr(),L=T.z.redSqr();if(this.x.redMul(L).redISub(T.x.redMul(A)).cmpn(0)!==0)return!1;var E=A.redMul(this.z),S=L.redMul(T.z);return this.y.redMul(S).redISub(T.y.redMul(E)).cmpn(0)===0},z.prototype.eqXToP=function(T){var A=this.z.redSqr(),L=T.toRed(this.curve.red).redMul(A);if(this.x.cmp(L)===0)return!0;var E=T.clone(),S=this.curve.redN.redMul(A);for(;;){if(E.iadd(this.curve.n),E.cmp(this.curve.p)>=0)return!1;if(L.redIAdd(S),this.x.cmp(L)===0)return!0}},z.prototype.inspect=function(){if(this.isInfinity())return"<EC JPoint Infinity>";return"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},z.prototype.isInfinity=function(){return this.z.cmpn(0)===0}}),DH=$0((U,Z)=>{var X=jU(),Q=YU(),K=xX(),H=WU();function $(q){K.call(this,"mont",q),this.a=new X(q.a,16).toRed(this.red),this.b=new X(q.b,16).toRed(this.red),this.i4=new X(4).toRed(this.red).redInvm(),this.two=new X(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}Q($,K),Z.exports=$,$.prototype.validate=function(q){var z=q.normalize().x,T=z.redSqr(),A=T.redMul(z).redAdd(T.redMul(this.a)).redAdd(z),L=A.redSqrt();return L.redSqr().cmp(A)===0};function M(q,z,T){if(K.BasePoint.call(this,q,"projective"),z===null&&T===null)this.x=this.curve.one,this.z=this.curve.zero;else{if(this.x=new X(z,16),this.z=new X(T,16),!this.x.red)this.x=this.x.toRed(this.curve.red);if(!this.z.red)this.z=this.z.toRed(this.curve.red)}}Q(M,K.BasePoint),$.prototype.decodePoint=function(q,z){return this.point(H.toArray(q,z),1)},$.prototype.point=function(q,z){return new M(this,q,z)},$.prototype.pointFromJSON=function(q){return M.fromJSON(this,q)},M.prototype.precompute=function(){},M.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},M.fromJSON=function(q,z){return new M(q,z[0],z[1]||q.one)},M.prototype.inspect=function(){if(this.isInfinity())return"<EC Point Infinity>";return"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},M.prototype.isInfinity=function(){return this.z.cmpn(0)===0},M.prototype.dbl=function(){var q=this.x.redAdd(this.z),z=q.redSqr(),T=this.x.redSub(this.z),A=T.redSqr(),L=z.redSub(A),E=z.redMul(A),S=L.redMul(A.redAdd(this.curve.a24.redMul(L)));return this.curve.point(E,S)},M.prototype.add=function(){throw Error("Not supported on Montgomery curve")},M.prototype.diffAdd=function(q,z){var T=this.x.redAdd(this.z),A=this.x.redSub(this.z),L=q.x.redAdd(q.z),E=q.x.redSub(q.z),S=E.redMul(T),j=L.redMul(A),k=z.z.redMul(S.redAdd(j).redSqr()),B=z.x.redMul(S.redISub(j).redSqr());return this.curve.point(k,B)},M.prototype.mul=function(q){var z=q.clone(),T=this,A=this.curve.point(null,null),L=this;for(var E=[];z.cmpn(0)!==0;z.iushrn(1))E.push(z.andln(1));for(var S=E.length-1;S>=0;S--)if(E[S]===0)T=T.diffAdd(A,L),A=A.dbl();else A=T.diffAdd(A,L),T=T.dbl();return A},M.prototype.mulAdd=function(){throw Error("Not supported on Montgomery curve")},M.prototype.jumlAdd=function(){throw Error("Not supported on Montgomery curve")},M.prototype.eq=function(q){return this.getX().cmp(q.getX())===0},M.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},M.prototype.getX=function(){return this.normalize(),this.x.fromRed()}}),MH=$0((U,Z)=>{var X=WU(),Q=jU(),K=YU(),H=xX(),$=X.assert;function M(z){this.twisted=(z.a|0)!==1,this.mOneA=this.twisted&&(z.a|0)===-1,this.extended=this.mOneA,H.call(this,"edwards",z),this.a=new Q(z.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new Q(z.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new Q(z.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),$(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(z.c|0)===1}K(M,H),Z.exports=M,M.prototype._mulA=function(z){if(this.mOneA)return z.redNeg();else return this.a.redMul(z)},M.prototype._mulC=function(z){if(this.oneC)return z;else return this.c.redMul(z)},M.prototype.jpoint=function(z,T,A,L){return this.point(z,T,A,L)},M.prototype.pointFromX=function(z,T){if(z=new Q(z,16),!z.red)z=z.toRed(this.red);var A=z.redSqr(),L=this.c2.redSub(this.a.redMul(A)),E=this.one.redSub(this.c2.redMul(this.d).redMul(A)),S=L.redMul(E.redInvm()),j=S.redSqrt();if(j.redSqr().redSub(S).cmp(this.zero)!==0)throw Error("invalid point");var k=j.fromRed().isOdd();if(T&&!k||!T&&k)j=j.redNeg();return this.point(z,j)},M.prototype.pointFromY=function(z,T){if(z=new Q(z,16),!z.red)z=z.toRed(this.red);var A=z.redSqr(),L=A.redSub(this.c2),E=A.redMul(this.d).redMul(this.c2).redSub(this.a),S=L.redMul(E.redInvm());if(S.cmp(this.zero)===0)if(T)throw Error("invalid point");else return this.point(this.zero,z);var j=S.redSqrt();if(j.redSqr().redSub(S).cmp(this.zero)!==0)throw Error("invalid point");if(j.fromRed().isOdd()!==T)j=j.redNeg();return this.point(j,z)},M.prototype.validate=function(z){if(z.isInfinity())return!0;z.normalize();var T=z.x.redSqr(),A=z.y.redSqr(),L=T.redMul(this.a).redAdd(A),E=this.c2.redMul(this.one.redAdd(this.d.redMul(T).redMul(A)));return L.cmp(E)===0};function q(z,T,A,L,E){if(H.BasePoint.call(this,z,"projective"),T===null&&A===null&&L===null)this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0;else{if(this.x=new Q(T,16),this.y=new Q(A,16),this.z=L?new Q(L,16):this.curve.one,this.t=E&&new Q(E,16),!this.x.red)this.x=this.x.toRed(this.curve.red);if(!this.y.red)this.y=this.y.toRed(this.curve.red);if(!this.z.red)this.z=this.z.toRed(this.curve.red);if(this.t&&!this.t.red)this.t=this.t.toRed(this.curve.red);if(this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t){if(this.t=this.x.redMul(this.y),!this.zOne)this.t=this.t.redMul(this.z.redInvm())}}}K(q,H.BasePoint),M.prototype.pointFromJSON=function(z){return q.fromJSON(this,z)},M.prototype.point=function(z,T,A,L){return new q(this,z,T,A,L)},q.fromJSON=function(z,T){return new q(z,T[0],T[1],T[2])},q.prototype.inspect=function(){if(this.isInfinity())return"<EC Point Infinity>";return"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},q.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},q.prototype._extDbl=function(){var z=this.x.redSqr(),T=this.y.redSqr(),A=this.z.redSqr();A=A.redIAdd(A);var L=this.curve._mulA(z),E=this.x.redAdd(this.y).redSqr().redISub(z).redISub(T),S=L.redAdd(T),j=S.redSub(A),k=L.redSub(T),B=E.redMul(j),v=S.redMul(k),x=E.redMul(k),N=j.redMul(S);return this.curve.point(B,v,N,x)},q.prototype._projDbl=function(){var z=this.x.redAdd(this.y).redSqr(),T=this.x.redSqr(),A=this.y.redSqr(),L,E,S,j,k,B;if(this.curve.twisted){j=this.curve._mulA(T);var v=j.redAdd(A);if(this.zOne)L=z.redSub(T).redSub(A).redMul(v.redSub(this.curve.two)),E=v.redMul(j.redSub(A)),S=v.redSqr().redSub(v).redSub(v);else k=this.z.redSqr(),B=v.redSub(k).redISub(k),L=z.redSub(T).redISub(A).redMul(B),E=v.redMul(j.redSub(A)),S=v.redMul(B)}else j=T.redAdd(A),k=this.curve._mulC(this.z).redSqr(),B=j.redSub(k).redSub(k),L=this.curve._mulC(z.redISub(j)).redMul(B),E=this.curve._mulC(j).redMul(T.redISub(A)),S=j.redMul(B);return this.curve.point(L,E,S)},q.prototype.dbl=function(){if(this.isInfinity())return this;if(this.curve.extended)return this._extDbl();else return this._projDbl()},q.prototype._extAdd=function(z){var T=this.y.redSub(this.x).redMul(z.y.redSub(z.x)),A=this.y.redAdd(this.x).redMul(z.y.redAdd(z.x)),L=this.t.redMul(this.curve.dd).redMul(z.t),E=this.z.redMul(z.z.redAdd(z.z)),S=A.redSub(T),j=E.redSub(L),k=E.redAdd(L),B=A.redAdd(T),v=S.redMul(j),x=k.redMul(B),N=S.redMul(B),w=j.redMul(k);return this.curve.point(v,x,w,N)},q.prototype._projAdd=function(z){var T=this.z.redMul(z.z),A=T.redSqr(),L=this.x.redMul(z.x),E=this.y.redMul(z.y),S=this.curve.d.redMul(L).redMul(E),j=A.redSub(S),k=A.redAdd(S),B=this.x.redAdd(this.y).redMul(z.x.redAdd(z.y)).redISub(L).redISub(E),v=T.redMul(j).redMul(B),x,N;if(this.curve.twisted)x=T.redMul(k).redMul(E.redSub(this.curve._mulA(L))),N=j.redMul(k);else x=T.redMul(k).redMul(E.redSub(L)),N=this.curve._mulC(j).redMul(k);return this.curve.point(v,x,N)},q.prototype.add=function(z){if(this.isInfinity())return z;if(z.isInfinity())return this;if(this.curve.extended)return this._extAdd(z);else return this._projAdd(z)},q.prototype.mul=function(z){if(this._hasDoubles(z))return this.curve._fixedNafMul(this,z);else return this.curve._wnafMul(this,z)},q.prototype.mulAdd=function(z,T,A){return this.curve._wnafMulAdd(1,[this,T],[z,A],2,!1)},q.prototype.jmulAdd=function(z,T,A){return this.curve._wnafMulAdd(1,[this,T],[z,A],2,!0)},q.prototype.normalize=function(){if(this.zOne)return this;var z=this.z.redInvm();if(this.x=this.x.redMul(z),this.y=this.y.redMul(z),this.t)this.t=this.t.redMul(z);return this.z=this.curve.one,this.zOne=!0,this},q.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},q.prototype.getX=function(){return this.normalize(),this.x.fromRed()},q.prototype.getY=function(){return this.normalize(),this.y.fromRed()},q.prototype.eq=function(z){return this===z||this.getX().cmp(z.getX())===0&&this.getY().cmp(z.getY())===0},q.prototype.eqXToP=function(z){var T=z.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(T)===0)return!0;var A=z.clone(),L=this.curve.redN.redMul(this.z);for(;;){if(A.iadd(this.curve.n),A.cmp(this.curve.p)>=0)return!1;if(T.redIAdd(L),this.x.cmp(T)===0)return!0}},q.prototype.toP=q.prototype.normalize,q.prototype.mixedAdd=q.prototype.add}),XV=$0((U)=>{var Z=U;Z.base=xX(),Z.short=zH(),Z.mont=DH(),Z.edwards=MH()}),DU=$0((U)=>{var Z=cU(),X=YU();U.inherits=X;function Q(V,I){if((V.charCodeAt(I)&64512)!==55296)return!1;if(I<0||I+1>=V.length)return!1;return(V.charCodeAt(I+1)&64512)===56320}function K(V,I){if(Array.isArray(V))return V.slice();if(!V)return[];var G=[];if(typeof V==="string"){if(!I){var W=0;for(var C=0;C<V.length;C++){var D=V.charCodeAt(C);if(D<128)G[W++]=D;else if(D<2048)G[W++]=D>>6|192,G[W++]=D&63|128;else if(Q(V,C))D=65536+((D&1023)<<10)+(V.charCodeAt(++C)&1023),G[W++]=D>>18|240,G[W++]=D>>12&63|128,G[W++]=D>>6&63|128,G[W++]=D&63|128;else G[W++]=D>>12|224,G[W++]=D>>6&63|128,G[W++]=D&63|128}}else if(I==="hex"){if(V=V.replace(/[^a-z0-9]+/ig,""),V.length%2!==0)V="0"+V;for(C=0;C<V.length;C+=2)G.push(parseInt(V[C]+V[C+1],16))}}else for(C=0;C<V.length;C++)G[C]=V[C]|0;return G}U.toArray=K;function H(V){var I="";for(var G=0;G<V.length;G++)I+=q(V[G].toString(16));return I}U.toHex=H;function $(V){var I=V>>>24|V>>>8&65280|V<<8&16711680|(V&255)<<24;return I>>>0}U.htonl=$;function M(V,I){var G="";for(var W=0;W<V.length;W++){var C=V[W];if(I==="little")C=$(C);G+=z(C.toString(16))}return G}U.toHex32=M;function q(V){if(V.length===1)return"0"+V;else return V}U.zero2=q;function z(V){if(V.length===7)return"0"+V;else if(V.length===6)return"00"+V;else if(V.length===5)return"000"+V;else if(V.length===4)return"0000"+V;else if(V.length===3)return"00000"+V;else if(V.length===2)return"000000"+V;else if(V.length===1)return"0000000"+V;else return V}U.zero8=z;function T(V,I,G,W){var C=G-I;Z(C%4===0);var D=Array(C/4);for(var F=0,J=I;F<D.length;F++,J+=4){var O;if(W==="big")O=V[J]<<24|V[J+1]<<16|V[J+2]<<8|V[J+3];else O=V[J+3]<<24|V[J+2]<<16|V[J+1]<<8|V[J];D[F]=O>>>0}return D}U.join32=T;function A(V,I){var G=Array(V.length*4);for(var W=0,C=0;W<V.length;W++,C+=4){var D=V[W];if(I==="big")G[C]=D>>>24,G[C+1]=D>>>16&255,G[C+2]=D>>>8&255,G[C+3]=D&255;else G[C+3]=D>>>24,G[C+2]=D>>>16&255,G[C+1]=D>>>8&255,G[C]=D&255}return G}U.split32=A;function L(V,I){return V>>>I|V<<32-I}U.rotr32=L;function E(V,I){return V<<I|V>>>32-I}U.rotl32=E;function S(V,I){return V+I>>>0}U.sum32=S;function j(V,I,G){return V+I+G>>>0}U.sum32_3=j;function k(V,I,G,W){return V+I+G+W>>>0}U.sum32_4=k;function B(V,I,G,W,C){return V+I+G+W+C>>>0}U.sum32_5=B;function v(V,I,G,W){var C=V[I],D=V[I+1],F=W+D>>>0,J=(F<W?1:0)+G+C;V[I]=J>>>0,V[I+1]=F}U.sum64=v;function x(V,I,G,W){var C=I+W>>>0,D=(C<I?1:0)+V+G;return D>>>0}U.sum64_hi=x;function N(V,I,G,W){var C=I+W;return C>>>0}U.sum64_lo=N;function w(V,I,G,W,C,D,F,J){var O=0,P=I;P=P+W>>>0,O+=P<I?1:0,P=P+D>>>0,O+=P<D?1:0,P=P+J>>>0,O+=P<J?1:0;var R=V+G+C+F+O;return R>>>0}U.sum64_4_hi=w;function u(V,I,G,W,C,D,F,J){var O=I+W+D+J;return O>>>0}U.sum64_4_lo=u;function Z0(V,I,G,W,C,D,F,J,O,P){var R=0,_=I;_=_+W>>>0,R+=_<I?1:0,_=_+D>>>0,R+=_<D?1:0,_=_+J>>>0,R+=_<J?1:0,_=_+P>>>0,R+=_<P?1:0;var f=V+G+C+F+O+R;return f>>>0}U.sum64_5_hi=Z0;function V0(V,I,G,W,C,D,F,J,O,P){var R=I+W+D+J+P;return R>>>0}U.sum64_5_lo=V0;function Y0(V,I,G){var W=I<<32-G|V>>>G;return W>>>0}U.rotr64_hi=Y0;function b(V,I,G){var W=V<<32-G|I>>>G;return W>>>0}U.rotr64_lo=b;function i(V,I,G){return V>>>G}U.shr64_hi=i;function Y(V,I,G){var W=V<<32-G|I>>>G;return W>>>0}U.shr64_lo=Y}),hZ=$0((U)=>{var Z=DU(),X=cU();function Q(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}U.BlockHash=Q,Q.prototype.update=function(K,H){if(K=Z.toArray(K,H),!this.pending)this.pending=K;else this.pending=this.pending.concat(K);if(this.pendingTotal+=K.length,this.pending.length>=this._delta8){K=this.pending;var $=K.length%this._delta8;if(this.pending=K.slice(K.length-$,K.length),this.pending.length===0)this.pending=null;K=Z.join32(K,0,K.length-$,this.endian);for(var M=0;M<K.length;M+=this._delta32)this._update(K,M,M+this._delta32)}return this},Q.prototype.digest=function(K){return this.update(this._pad()),X(this.pending===null),this._digest(K)},Q.prototype._pad=function(){var K=this.pendingTotal,H=this._delta8,$=H-(K+this.padLength)%H,M=Array($+this.padLength);M[0]=128;for(var q=1;q<$;q++)M[q]=0;if(K<<=3,this.endian==="big"){for(var z=8;z<this.padLength;z++)M[q++]=0;M[q++]=0,M[q++]=0,M[q++]=0,M[q++]=0,M[q++]=K>>>24&255,M[q++]=K>>>16&255,M[q++]=K>>>8&255,M[q++]=K&255}else{M[q++]=K&255,M[q++]=K>>>8&255,M[q++]=K>>>16&255,M[q++]=K>>>24&255,M[q++]=0,M[q++]=0,M[q++]=0,M[q++]=0;for(z=8;z<this.padLength;z++)M[q++]=0}return M}}),YV=$0((U)=>{var Z=DU(),X=Z.rotr32;function Q(A,L,E,S){if(A===0)return K(L,E,S);if(A===1||A===3)return $(L,E,S);if(A===2)return H(L,E,S)}U.ft_1=Q;function K(A,L,E){return A&L^~A&E}U.ch32=K;function H(A,L,E){return A&L^A&E^L&E}U.maj32=H;function $(A,L,E){return A^L^E}U.p32=$;function M(A){return X(A,2)^X(A,13)^X(A,22)}U.s0_256=M;function q(A){return X(A,6)^X(A,11)^X(A,25)}U.s1_256=q;function z(A){return X(A,7)^X(A,18)^A>>>3}U.g0_256=z;function T(A){return X(A,17)^X(A,19)^A>>>10}U.g1_256=T}),qH=$0((U,Z)=>{var X=DU(),Q=hZ(),K=YV(),H=X.rotl32,$=X.sum32,M=X.sum32_5,q=K.ft_1,z=Q.BlockHash,T=[1518500249,1859775393,2400959708,3395469782];function A(){if(!(this instanceof A))return new A;z.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=Array(80)}X.inherits(A,z),Z.exports=A,A.blockSize=512,A.outSize=160,A.hmacStrength=80,A.padLength=64,A.prototype._update=function(L,E){var S=this.W;for(var j=0;j<16;j++)S[j]=L[E+j];for(;j<S.length;j++)S[j]=H(S[j-3]^S[j-8]^S[j-14]^S[j-16],1);var k=this.h[0],B=this.h[1],v=this.h[2],x=this.h[3],N=this.h[4];for(j=0;j<S.length;j++){var w=~~(j/20),u=M(H(k,5),q(w,B,v,x),N,S[j],T[w]);N=x,x=v,v=H(B,30),B=k,k=u}this.h[0]=$(this.h[0],k),this.h[1]=$(this.h[1],B),this.h[2]=$(this.h[2],v),this.h[3]=$(this.h[3],x),this.h[4]=$(this.h[4],N)},A.prototype._digest=function(L){if(L==="hex")return X.toHex32(this.h,"big");else return X.split32(this.h,"big")}}),JV=$0((U,Z)=>{var X=DU(),Q=hZ(),K=YV(),H=cU(),$=X.sum32,M=X.sum32_4,q=X.sum32_5,z=K.ch32,T=K.maj32,A=K.s0_256,L=K.s1_256,E=K.g0_256,S=K.g1_256,j=Q.BlockHash,k=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function B(){if(!(this instanceof B))return new B;j.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=k,this.W=Array(64)}X.inherits(B,j),Z.exports=B,B.blockSize=512,B.outSize=256,B.hmacStrength=192,B.padLength=64,B.prototype._update=function(v,x){var N=this.W;for(var w=0;w<16;w++)N[w]=v[x+w];for(;w<N.length;w++)N[w]=M(S(N[w-2]),N[w-7],E(N[w-15]),N[w-16]);var u=this.h[0],Z0=this.h[1],V0=this.h[2],Y0=this.h[3],b=this.h[4],i=this.h[5],Y=this.h[6],V=this.h[7];H(this.k.length===N.length);for(w=0;w<N.length;w++){var I=q(V,L(b),z(b,i,Y),this.k[w],N[w]),G=$(A(u),T(u,Z0,V0));V=Y,Y=i,i=b,b=$(Y0,I),Y0=V0,V0=Z0,Z0=u,u=$(I,G)}this.h[0]=$(this.h[0],u),this.h[1]=$(this.h[1],Z0),this.h[2]=$(this.h[2],V0),this.h[3]=$(this.h[3],Y0),this.h[4]=$(this.h[4],b),this.h[5]=$(this.h[5],i),this.h[6]=$(this.h[6],Y),this.h[7]=$(this.h[7],V)},B.prototype._digest=function(v){if(v==="hex")return X.toHex32(this.h,"big");else return X.split32(this.h,"big")}}),LH=$0((U,Z)=>{var X=DU(),Q=JV();function K(){if(!(this instanceof K))return new K;Q.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}X.inherits(K,Q),Z.exports=K,K.blockSize=512,K.outSize=224,K.hmacStrength=192,K.padLength=64,K.prototype._digest=function(H){if(H==="hex")return X.toHex32(this.h.slice(0,7),"big");else return X.split32(this.h.slice(0,7),"big")}}),QV=$0((U,Z)=>{var X=DU(),Q=hZ(),K=cU(),H=X.rotr64_hi,$=X.rotr64_lo,M=X.shr64_hi,q=X.shr64_lo,z=X.sum64,T=X.sum64_hi,A=X.sum64_lo,L=X.sum64_4_hi,E=X.sum64_4_lo,S=X.sum64_5_hi,j=X.sum64_5_lo,k=Q.BlockHash,B=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function v(){if(!(this instanceof v))return new v;k.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=B,this.W=Array(160)}X.inherits(v,k),Z.exports=v,v.blockSize=1024,v.outSize=512,v.hmacStrength=192,v.padLength=128,v.prototype._prepareBlock=function(G,W){var C=this.W;for(var D=0;D<32;D++)C[D]=G[W+D];for(;D<C.length;D+=2){var F=V(C[D-4],C[D-3]),J=I(C[D-4],C[D-3]),O=C[D-14],P=C[D-13],R=i(C[D-30],C[D-29]),_=Y(C[D-30],C[D-29]),f=C[D-32],c=C[D-31];C[D]=L(F,J,O,P,R,_,f,c),C[D+1]=E(F,J,O,P,R,_,f,c)}},v.prototype._update=function(G,W){this._prepareBlock(G,W);var C=this.W,D=this.h[0],F=this.h[1],J=this.h[2],O=this.h[3],P=this.h[4],R=this.h[5],_=this.h[6],f=this.h[7],c=this.h[8],o=this.h[9],K0=this.h[10],a=this.h[11],l=this.h[12],Q0=this.h[13],n=this.h[14],s=this.h[15];K(this.k.length===C.length);for(var f0=0;f0<C.length;f0+=2){var y=n,h=s,G0=Y0(c,o),t=b(c,o),U0=x(c,o,K0,a,l,Q0),L0=N(c,o,K0,a,l,Q0),p=this.k[f0],m=this.k[f0+1],g0=C[f0],r=C[f0+1],J0=S(y,h,G0,t,U0,L0,p,m,g0,r),h0=j(y,h,G0,t,U0,L0,p,m,g0,r);y=Z0(D,F),h=V0(D,F),G0=w(D,F,J,O,P,R),t=u(D,F,J,O,P,R);var F0=T(y,h,G0,t),O0=A(y,h,G0,t);n=l,s=Q0,l=K0,Q0=a,K0=c,a=o,c=T(_,f,J0,h0),o=A(f,f,J0,h0),_=P,f=R,P=J,R=O,J=D,O=F,D=T(J0,h0,F0,O0),F=A(J0,h0,F0,O0)}z(this.h,0,D,F),z(this.h,2,J,O),z(this.h,4,P,R),z(this.h,6,_,f),z(this.h,8,c,o),z(this.h,10,K0,a),z(this.h,12,l,Q0),z(this.h,14,n,s)},v.prototype._digest=function(G){if(G==="hex")return X.toHex32(this.h,"big");else return X.split32(this.h,"big")};function x(G,W,C,D,F){var J=G&C^~G&F;if(J<0)J+=4294967296;return J}function N(G,W,C,D,F,J){var O=W&D^~W&J;if(O<0)O+=4294967296;return O}function w(G,W,C,D,F){var J=G&C^G&F^C&F;if(J<0)J+=4294967296;return J}function u(G,W,C,D,F,J){var O=W&D^W&J^D&J;if(O<0)O+=4294967296;return O}function Z0(G,W){var C=H(G,W,28),D=H(W,G,2),F=H(W,G,7),J=C^D^F;if(J<0)J+=4294967296;return J}function V0(G,W){var C=$(G,W,28),D=$(W,G,2),F=$(W,G,7),J=C^D^F;if(J<0)J+=4294967296;return J}function Y0(G,W){var C=H(G,W,14),D=H(G,W,18),F=H(W,G,9),J=C^D^F;if(J<0)J+=4294967296;return J}function b(G,W){var C=$(G,W,14),D=$(G,W,18),F=$(W,G,9),J=C^D^F;if(J<0)J+=4294967296;return J}function i(G,W){var C=H(G,W,1),D=H(G,W,8),F=M(G,W,7),J=C^D^F;if(J<0)J+=4294967296;return J}function Y(G,W){var C=$(G,W,1),D=$(G,W,8),F=q(G,W,7),J=C^D^F;if(J<0)J+=4294967296;return J}function V(G,W){var C=H(G,W,19),D=H(W,G,29),F=M(G,W,6),J=C^D^F;if(J<0)J+=4294967296;return J}function I(G,W){var C=$(G,W,19),D=$(W,G,29),F=q(G,W,6),J=C^D^F;if(J<0)J+=4294967296;return J}}),TH=$0((U,Z)=>{var X=DU(),Q=QV();function K(){if(!(this instanceof K))return new K;Q.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}X.inherits(K,Q),Z.exports=K,K.blockSize=1024,K.outSize=384,K.hmacStrength=192,K.padLength=128,K.prototype._digest=function(H){if(H==="hex")return X.toHex32(this.h.slice(0,12),"big");else return X.split32(this.h.slice(0,12),"big")}}),RH=$0((U)=>{U.sha1=qH(),U.sha224=LH(),U.sha256=JV(),U.sha384=TH(),U.sha512=QV()}),EH=$0((U)=>{var Z=DU(),X=hZ(),Q=Z.rotl32,K=Z.sum32,H=Z.sum32_3,$=Z.sum32_4,M=X.BlockHash;function q(){if(!(this instanceof q))return new q;M.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}Z.inherits(q,M),U.ripemd160=q,q.blockSize=512,q.outSize=160,q.hmacStrength=192,q.padLength=64,q.prototype._update=function(k,B){var v=this.h[0],x=this.h[1],N=this.h[2],w=this.h[3],u=this.h[4],Z0=v,V0=x,Y0=N,b=w,i=u;for(var Y=0;Y<80;Y++){var V=K(Q($(v,z(Y,x,N,w),k[L[Y]+B],T(Y)),S[Y]),u);v=u,u=w,w=Q(N,10),N=x,x=V,V=K(Q($(Z0,z(79-Y,V0,Y0,b),k[E[Y]+B],A(Y)),j[Y]),i),Z0=i,i=b,b=Q(Y0,10),Y0=V0,V0=V}V=H(this.h[1],N,b),this.h[1]=H(this.h[2],w,i),this.h[2]=H(this.h[3],u,Z0),this.h[3]=H(this.h[4],v,V0),this.h[4]=H(this.h[0],x,Y0),this.h[0]=V},q.prototype._digest=function(k){if(k==="hex")return Z.toHex32(this.h,"little");else return Z.split32(this.h,"little")};function z(k,B,v,x){if(k<=15)return B^v^x;else if(k<=31)return B&v|~B&x;else if(k<=47)return(B|~v)^x;else if(k<=63)return B&x|v&~x;else return B^(v|~x)}function T(k){if(k<=15)return 0;else if(k<=31)return 1518500249;else if(k<=47)return 1859775393;else if(k<=63)return 2400959708;else return 2840853838}function A(k){if(k<=15)return 1352829926;else if(k<=31)return 1548603684;else if(k<=47)return 1836072691;else if(k<=63)return 2053994217;else return 0}var L=[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],E=[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],S=[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],j=[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]}),SH=$0((U,Z)=>{var X=DU(),Q=cU();function K(H,$,M){if(!(this instanceof K))return new K(H,$,M);this.Hash=H,this.blockSize=H.blockSize/8,this.outSize=H.outSize/8,this.inner=null,this.outer=null,this._init(X.toArray($,M))}Z.exports=K,K.prototype._init=function(H){if(H.length>this.blockSize)H=new this.Hash().update(H).digest();Q(H.length<=this.blockSize);for(var $=H.length;$<this.blockSize;$++)H.push(0);for($=0;$<H.length;$++)H[$]^=54;this.inner=new this.Hash().update(H);for($=0;$<H.length;$++)H[$]^=106;this.outer=new this.Hash().update(H)},K.prototype.update=function(H,$){return this.inner.update(H,$),this},K.prototype.digest=function(H){return this.outer.update(this.inner.digest()),this.outer.digest(H)}}),ZJ=$0((U)=>{var Z=U;Z.utils=DU(),Z.common=hZ(),Z.sha=RH(),Z.ripemd=EH(),Z.hmac=SH(),Z.sha1=Z.sha.sha1,Z.sha256=Z.sha.sha256,Z.sha224=Z.sha.sha224,Z.sha384=Z.sha.sha384,Z.sha512=Z.sha.sha512,Z.ripemd160=Z.ripemd.ripemd160}),PH=$0((U,Z)=>{Z.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}}),XJ=$0((U)=>{var Z=U,X=ZJ(),Q=XV(),K=WU(),H=K.assert;function $(z){if(z.type==="short")this.curve=new Q.short(z);else if(z.type==="edwards")this.curve=new Q.edwards(z);else this.curve=new Q.mont(z);this.g=this.curve.g,this.n=this.curve.n,this.hash=z.hash,H(this.g.validate(),"Invalid curve"),H(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}Z.PresetCurve=$;function M(z,T){Object.defineProperty(Z,z,{configurable:!0,enumerable:!0,get:function(){var A=new $(T);return Object.defineProperty(Z,z,{configurable:!0,enumerable:!0,value:A}),A}})}M("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:X.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),M("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:X.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),M("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:X.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),M("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:X.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),M("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:X.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),M("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:X.sha256,gRed:!1,g:["9"]}),M("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:X.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var q;try{q=PH()}catch(z){q=void 0}M("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:X.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",q]})}),kH=$0((U,Z)=>{var X=ZJ(),Q=UV(),K=cU();function H($){if(!(this instanceof H))return new H($);this.hash=$.hash,this.predResist=!!$.predResist,this.outLen=this.hash.outSize,this.minEntropy=$.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var M=Q.toArray($.entropy,$.entropyEnc||"hex"),q=Q.toArray($.nonce,$.nonceEnc||"hex"),z=Q.toArray($.pers,$.persEnc||"hex");K(M.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(M,q,z)}Z.exports=H,H.prototype._init=function($,M,q){var z=$.concat(M).concat(q);this.K=Array(this.outLen/8),this.V=Array(this.outLen/8);for(var T=0;T<this.V.length;T++)this.K[T]=0,this.V[T]=1;this._update(z),this._reseed=1,this.reseedInterval=281474976710656},H.prototype._hmac=function(){return new X.hmac(this.hash,this.K)},H.prototype._update=function($){var M=this._hmac().update(this.V).update([0]);if($)M=M.update($);if(this.K=M.digest(),this.V=this._hmac().update(this.V).digest(),!$)return;this.K=this._hmac().update(this.V).update([1]).update($).digest(),this.V=this._hmac().update(this.V).digest()},H.prototype.reseed=function($,M,q,z){if(typeof M!=="string")z=q,q=M,M=null;$=Q.toArray($,M),q=Q.toArray(q,z),K($.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update($.concat(q||[])),this._reseed=1},H.prototype.generate=function($,M,q,z){if(this._reseed>this.reseedInterval)throw Error("Reseed is required");if(typeof M!=="string")z=q,q=M,M=null;if(q)q=Q.toArray(q,z||"hex"),this._update(q);var T=[];while(T.length<$)this.V=this._hmac().update(this.V).digest(),T=T.concat(this.V);var A=T.slice(0,$);return this._update(q),this._reseed++,Q.encode(A,M)}}),jH=$0((U,Z)=>{var X=jU(),Q=WU(),K=Q.assert;function H($,M){if(this.ec=$,this.priv=null,this.pub=null,M.priv)this._importPrivate(M.priv,M.privEnc);if(M.pub)this._importPublic(M.pub,M.pubEnc)}Z.exports=H,H.fromPublic=function($,M,q){if(M instanceof H)return M;return new H($,{pub:M,pubEnc:q})},H.fromPrivate=function($,M,q){if(M instanceof H)return M;return new H($,{priv:M,privEnc:q})},H.prototype.validate=function(){var $=this.getPublic();if($.isInfinity())return{result:!1,reason:"Invalid public key"};if(!$.validate())return{result:!1,reason:"Public key is not a point"};if(!$.mul(this.ec.curve.n).isInfinity())return{result:!1,reason:"Public key * N != O"};return{result:!0,reason:null}},H.prototype.getPublic=function($,M){if(typeof $==="string")M=$,$=null;if(!this.pub)this.pub=this.ec.g.mul(this.priv);if(!M)return this.pub;return this.pub.encode(M,$)},H.prototype.getPrivate=function($){if($==="hex")return this.priv.toString(16,2);else return this.priv},H.prototype._importPrivate=function($,M){this.priv=new X($,M||16),this.priv=this.priv.umod(this.ec.curve.n)},H.prototype._importPublic=function($,M){if($.x||$.y){if(this.ec.curve.type==="mont")K($.x,"Need x coordinate");else if(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")K($.x&&$.y,"Need both x and y coordinate");this.pub=this.ec.curve.point($.x,$.y);return}this.pub=this.ec.curve.decodePoint($,M)},H.prototype.derive=function($){if(!$.validate())K($.validate(),"public point not validated");return $.mul(this.priv).getX()},H.prototype.sign=function($,M,q){return this.ec.sign($,this,M,q)},H.prototype.verify=function($,M,q){return this.ec.verify($,M,this,void 0,q)},H.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"}}),vH=$0((U,Z)=>{var X=jU(),Q=WU(),K=Q.assert;function H(T,A){if(T instanceof H)return T;if(this._importDER(T,A))return;if(K(T.r&&T.s,"Signature without r or s"),this.r=new X(T.r,16),this.s=new X(T.s,16),T.recoveryParam===void 0)this.recoveryParam=null;else this.recoveryParam=T.recoveryParam}Z.exports=H;function $(){this.place=0}function M(T,A){var L=T[A.place++];if(!(L&128))return L;var E=L&15;if(E===0||E>4)return!1;if(T[A.place]===0)return!1;var S=0;for(var j=0,k=A.place;j<E;j++,k++)S<<=8,S|=T[k],S>>>=0;if(S<=127)return!1;return A.place=k,S}function q(T){var A=0,L=T.length-1;while(!T[A]&&!(T[A+1]&128)&&A<L)A++;if(A===0)return T;return T.slice(A)}H.prototype._importDER=function(T,A){T=Q.toArray(T,A);var L=new $;if(T[L.place++]!==48)return!1;var E=M(T,L);if(E===!1)return!1;if(E+L.place!==T.length)return!1;if(T[L.place++]!==2)return!1;var S=M(T,L);if(S===!1)return!1;if((T[L.place]&128)!==0)return!1;var j=T.slice(L.place,S+L.place);if(L.place+=S,T[L.place++]!==2)return!1;var k=M(T,L);if(k===!1)return!1;if(T.length!==k+L.place)return!1;if((T[L.place]&128)!==0)return!1;var B=T.slice(L.place,k+L.place);if(j[0]===0)if(j[1]&128)j=j.slice(1);else return!1;if(B[0]===0)if(B[1]&128)B=B.slice(1);else return!1;return this.r=new X(j),this.s=new X(B),this.recoveryParam=null,!0};function z(T,A){if(A<128){T.push(A);return}var L=1+(Math.log(A)/Math.LN2>>>3);T.push(L|128);while(--L)T.push(A>>>(L<<3)&255);T.push(A)}H.prototype.toDER=function(T){var A=this.r.toArray(),L=this.s.toArray();if(A[0]&128)A=[0].concat(A);if(L[0]&128)L=[0].concat(L);A=q(A),L=q(L);while(!L[0]&&!(L[1]&128))L=L.slice(1);var E=[2];z(E,A.length),E=E.concat(A),E.push(2),z(E,L.length);var S=E.concat(L),j=[48];return z(j,S.length),j=j.concat(S),Q.encode(j,T)}}),_H=$0((U,Z)=>{var X=jU(),Q=kH(),K=WU(),H=XJ(),$=ZV(),M=K.assert,q=jH(),z=vH();function T(A){if(!(this instanceof T))return new T(A);if(typeof A==="string")M(Object.prototype.hasOwnProperty.call(H,A),"Unknown curve "+A),A=H[A];if(A instanceof H.PresetCurve)A={curve:A};this.curve=A.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=A.curve.g,this.g.precompute(A.curve.n.bitLength()+1),this.hash=A.hash||A.curve.hash}Z.exports=T,T.prototype.keyPair=function(A){return new q(this,A)},T.prototype.keyFromPrivate=function(A,L){return q.fromPrivate(this,A,L)},T.prototype.keyFromPublic=function(A,L){return q.fromPublic(this,A,L)},T.prototype.genKeyPair=function(A){if(!A)A={};var L=new Q({hash:this.hash,pers:A.pers,persEnc:A.persEnc||"utf8",entropy:A.entropy||$(this.hash.hmacStrength),entropyEnc:A.entropy&&A.entropyEnc||"utf8",nonce:this.n.toArray()}),E=this.n.byteLength(),S=this.n.sub(new X(2));for(;;){var j=new X(L.generate(E));if(j.cmp(S)>0)continue;return j.iaddn(1),this.keyFromPrivate(j)}},T.prototype._truncateToN=function(A,L,E){var S;if(X.isBN(A)||typeof A==="number")A=new X(A,16),S=A.byteLength();else if(typeof A==="object")S=A.length,A=new X(A,16);else{var j=A.toString();S=j.length+1>>>1,A=new X(j,16)}if(typeof E!=="number")E=S*8;var k=E-this.n.bitLength();if(k>0)A=A.ushrn(k);if(!L&&A.cmp(this.n)>=0)return A.sub(this.n);else return A},T.prototype.sign=function(A,L,E,S){if(typeof E==="object")S=E,E=null;if(!S)S={};if(typeof A!=="string"&&typeof A!=="number"&&!X.isBN(A)){M(typeof A==="object"&&A&&typeof A.length==="number","Expected message to be an array-like, a hex string, or a BN instance"),M(A.length>>>0===A.length);for(var j=0;j<A.length;j++)M((A[j]&255)===A[j])}L=this.keyFromPrivate(L,E),A=this._truncateToN(A,!1,S.msgBitLength),M(!A.isNeg(),"Can not sign a negative message");var k=this.n.byteLength(),B=L.getPrivate().toArray("be",k),v=A.toArray("be",k);M(new X(v).eq(A),"Can not sign message");var x=new Q({hash:this.hash,entropy:B,nonce:v,pers:S.pers,persEnc:S.persEnc||"utf8"}),N=this.n.sub(new X(1));for(var w=0;;w++){var u=S.k?S.k(w):new X(x.generate(this.n.byteLength()));if(u=this._truncateToN(u,!0),u.cmpn(1)<=0||u.cmp(N)>=0)continue;var Z0=this.g.mul(u);if(Z0.isInfinity())continue;var V0=Z0.getX(),Y0=V0.umod(this.n);if(Y0.cmpn(0)===0)continue;var b=u.invm(this.n).mul(Y0.mul(L.getPrivate()).iadd(A));if(b=b.umod(this.n),b.cmpn(0)===0)continue;var i=(Z0.getY().isOdd()?1:0)|(V0.cmp(Y0)!==0?2:0);if(S.canonical&&b.cmp(this.nh)>0)b=this.n.sub(b),i^=1;return new z({r:Y0,s:b,recoveryParam:i})}},T.prototype.verify=function(A,L,E,S,j){if(!j)j={};A=this._truncateToN(A,!1,j.msgBitLength),E=this.keyFromPublic(E,S),L=new z(L,"hex");var{r:k,s:B}=L;if(k.cmpn(1)<0||k.cmp(this.n)>=0)return!1;if(B.cmpn(1)<0||B.cmp(this.n)>=0)return!1;var v=B.invm(this.n),x=v.mul(A).umod(this.n),N=v.mul(k).umod(this.n),w;if(!this.curve._maxwellTrick){if(w=this.g.mulAdd(x,E.getPublic(),N),w.isInfinity())return!1;return w.getX().umod(this.n).cmp(k)===0}if(w=this.g.jmulAdd(x,E.getPublic(),N),w.isInfinity())return!1;return w.eqXToP(k)},T.prototype.recoverPubKey=function(A,L,E,S){M((3&E)===E,"The recovery param is more than two bits"),L=new z(L,S);var j=this.n,k=new X(A),B=L.r,v=L.s,x=E&1,N=E>>1;if(B.cmp(this.curve.p.umod(this.curve.n))>=0&&N)throw Error("Unable to find sencond key candinate");if(N)B=this.curve.pointFromX(B.add(this.curve.n),x);else B=this.curve.pointFromX(B,x);var w=L.r.invm(j),u=j.sub(k).mul(w).umod(j),Z0=v.mul(w).umod(j);return this.g.mulAdd(u,B,Z0)},T.prototype.getKeyRecoveryParam=function(A,L,E,S){if(L=new z(L,S),L.recoveryParam!==null)return L.recoveryParam;for(var j=0;j<4;j++){var k;try{k=this.recoverPubKey(A,L,j)}catch(B){continue}if(k.eq(E))return j}throw Error("Unable to find valid recovery factor")}}),BH=$0((U,Z)=>{var X=WU(),Q=X.assert,K=X.parseBytes,H=X.cachedProperty;function $(M,q){if(this.eddsa=M,this._secret=K(q.secret),M.isPoint(q.pub))this._pub=q.pub;else this._pubBytes=K(q.pub)}$.fromPublic=function(M,q){if(q instanceof $)return q;return new $(M,{pub:q})},$.fromSecret=function(M,q){if(q instanceof $)return q;return new $(M,{secret:q})},$.prototype.secret=function(){return this._secret},H($,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),H($,"pub",function(){if(this._pubBytes)return this.eddsa.decodePoint(this._pubBytes);return this.eddsa.g.mul(this.priv())}),H($,"privBytes",function(){var M=this.eddsa,q=this.hash(),z=M.encodingLength-1,T=q.slice(0,M.encodingLength);return T[0]&=248,T[z]&=127,T[z]|=64,T}),H($,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),H($,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),H($,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),$.prototype.sign=function(M){return Q(this._secret,"KeyPair can only verify"),this.eddsa.sign(M,this)},$.prototype.verify=function(M,q){return this.eddsa.verify(M,q,this)},$.prototype.getSecret=function(M){return Q(this._secret,"KeyPair is public only"),X.encode(this.secret(),M)},$.prototype.getPublic=function(M){return X.encode(this.pubBytes(),M)},Z.exports=$}),xH=$0((U,Z)=>{var X=jU(),Q=WU(),K=Q.assert,H=Q.cachedProperty,$=Q.parseBytes;function M(q,z){if(this.eddsa=q,typeof z!=="object")z=$(z);if(Array.isArray(z))K(z.length===q.encodingLength*2,"Signature has invalid size"),z={R:z.slice(0,q.encodingLength),S:z.slice(q.encodingLength)};if(K(z.R&&z.S,"Signature without R or S"),q.isPoint(z.R))this._R=z.R;if(z.S instanceof X)this._S=z.S;this._Rencoded=Array.isArray(z.R)?z.R:z.Rencoded,this._Sencoded=Array.isArray(z.S)?z.S:z.Sencoded}H(M,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),H(M,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),H(M,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),H(M,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),M.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},M.prototype.toHex=function(){return Q.encode(this.toBytes(),"hex").toUpperCase()},Z.exports=M}),NH=$0((U,Z)=>{var X=ZJ(),Q=XJ(),K=WU(),H=K.assert,$=K.parseBytes,M=BH(),q=xH();function z(T){if(H(T==="ed25519","only tested with ed25519 so far"),!(this instanceof z))return new z(T);T=Q[T].curve,this.curve=T,this.g=T.g,this.g.precompute(T.n.bitLength()+1),this.pointClass=T.point().constructor,this.encodingLength=Math.ceil(T.n.bitLength()/8),this.hash=X.sha512}Z.exports=z,z.prototype.sign=function(T,A){T=$(T);var L=this.keyFromSecret(A),E=this.hashInt(L.messagePrefix(),T),S=this.g.mul(E),j=this.encodePoint(S),k=this.hashInt(j,L.pubBytes(),T).mul(L.priv()),B=E.add(k).umod(this.curve.n);return this.makeSignature({R:S,S:B,Rencoded:j})},z.prototype.verify=function(T,A,L){if(T=$(T),A=this.makeSignature(A),A.S().gte(A.eddsa.curve.n)||A.S().isNeg())return!1;var E=this.keyFromPublic(L),S=this.hashInt(A.Rencoded(),E.pubBytes(),T),j=this.g.mul(A.S()),k=A.R().add(E.pub().mul(S));return k.eq(j)},z.prototype.hashInt=function(){var T=this.hash();for(var A=0;A<arguments.length;A++)T.update(arguments[A]);return K.intFromLE(T.digest()).umod(this.curve.n)},z.prototype.keyFromPublic=function(T){return M.fromPublic(this,T)},z.prototype.keyFromSecret=function(T){return M.fromSecret(this,T)},z.prototype.makeSignature=function(T){if(T instanceof q)return T;return new q(this,T)},z.prototype.encodePoint=function(T){var A=T.getY().toArray("le",this.encodingLength);return A[this.encodingLength-1]|=T.getX().isOdd()?128:0,A},z.prototype.decodePoint=function(T){T=K.parseBytes(T);var A=T.length-1,L=T.slice(0,A).concat(T[A]&-129),E=(T[A]&128)!==0,S=K.intFromLE(L);return this.curve.pointFromY(S,E)},z.prototype.encodeInt=function(T){return T.toArray("le",this.encodingLength)},z.prototype.decodeInt=function(T){return K.intFromLE(T)},z.prototype.isPoint=function(T){return T instanceof this.pointClass}}),gH=$0((U)=>{var Z=U;Z.version=CH().version,Z.utils=WU(),Z.rand=ZV(),Z.curve=XV(),Z.curves=XJ(),Z.ec=_H(),Z.eddsa=NH()}),fH=$0((U,Z)=>{(function(X,Q){function K(Y,V){if(!Y)throw Error(V||"Assertion failed")}function H(Y,V){Y.super_=V;var I=function(){};I.prototype=V.prototype,Y.prototype=new I,Y.prototype.constructor=Y}function $(Y,V,I){if($.isBN(Y))return Y;if(this.negative=0,this.words=null,this.length=0,this.red=null,Y!==null){if(V==="le"||V==="be")I=V,V=10;this._init(Y||0,V||10,I||"be")}}if(typeof X==="object")X.exports=$;else Q.BN=$;$.BN=$,$.wordSize=26;var M;try{if(typeof window<"u"&&typeof window.Buffer<"u")M=window.Buffer;else M=(g1(),m0(N1)).Buffer}catch(Y){}$.isBN=function(Y){if(Y instanceof $)return!0;return Y!==null&&typeof Y==="object"&&Y.constructor.wordSize===$.wordSize&&Array.isArray(Y.words)},$.max=function(Y,V){if(Y.cmp(V)>0)return Y;return V},$.min=function(Y,V){if(Y.cmp(V)<0)return Y;return V},$.prototype._init=function(Y,V,I){if(typeof Y==="number")return this._initNumber(Y,V,I);if(typeof Y==="object")return this._initArray(Y,V,I);if(V==="hex")V=16;K(V===(V|0)&&V>=2&&V<=36),Y=Y.toString().replace(/\s+/g,"");var G=0;if(Y[0]==="-")G++,this.negative=1;if(G<Y.length){if(V===16)this._parseHex(Y,G,I);else if(this._parseBase(Y,V,G),I==="le")this._initArray(this.toArray(),V,I)}},$.prototype._initNumber=function(Y,V,I){if(Y<0)this.negative=1,Y=-Y;if(Y<67108864)this.words=[Y&67108863],this.length=1;else if(Y<4503599627370496)this.words=[Y&67108863,Y/67108864&67108863],this.length=2;else K(Y<9007199254740992),this.words=[Y&67108863,Y/67108864&67108863,1],this.length=3;if(I!=="le")return;this._initArray(this.toArray(),V,I)},$.prototype._initArray=function(Y,V,I){if(K(typeof Y.length==="number"),Y.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(Y.length/3),this.words=Array(this.length);for(var G=0;G<this.length;G++)this.words[G]=0;var W,C,D=0;if(I==="be"){for(G=Y.length-1,W=0;G>=0;G-=3)if(C=Y[G]|Y[G-1]<<8|Y[G-2]<<16,this.words[W]|=C<<D&67108863,this.words[W+1]=C>>>26-D&67108863,D+=24,D>=26)D-=26,W++}else if(I==="le"){for(G=0,W=0;G<Y.length;G+=3)if(C=Y[G]|Y[G+1]<<8|Y[G+2]<<16,this.words[W]|=C<<D&67108863,this.words[W+1]=C>>>26-D&67108863,D+=24,D>=26)D-=26,W++}return this.strip()};function q(Y,V){var I=Y.charCodeAt(V);if(I>=65&&I<=70)return I-55;else if(I>=97&&I<=102)return I-87;else return I-48&15}function z(Y,V,I){var G=q(Y,I);if(I-1>=V)G|=q(Y,I-1)<<4;return G}$.prototype._parseHex=function(Y,V,I){this.length=Math.ceil((Y.length-V)/6),this.words=Array(this.length);for(var G=0;G<this.length;G++)this.words[G]=0;var W=0,C=0,D;if(I==="be")for(G=Y.length-1;G>=V;G-=2)if(D=z(Y,V,G)<<W,this.words[C]|=D&67108863,W>=18)W-=18,C+=1,this.words[C]|=D>>>26;else W+=8;else{var F=Y.length-V;for(G=F%2===0?V+1:V;G<Y.length;G+=2)if(D=z(Y,V,G)<<W,this.words[C]|=D&67108863,W>=18)W-=18,C+=1,this.words[C]|=D>>>26;else W+=8}this.strip()};function T(Y,V,I,G){var W=0,C=Math.min(Y.length,I);for(var D=V;D<C;D++){var F=Y.charCodeAt(D)-48;if(W*=G,F>=49)W+=F-49+10;else if(F>=17)W+=F-17+10;else W+=F}return W}$.prototype._parseBase=function(Y,V,I){this.words=[0],this.length=1;for(var G=0,W=1;W<=67108863;W*=V)G++;G--,W=W/V|0;var C=Y.length-I,D=C%G,F=Math.min(C,C-D)+I,J=0;for(var O=I;O<F;O+=G)if(J=T(Y,O,O+G,V),this.imuln(W),this.words[0]+J<67108864)this.words[0]+=J;else this._iaddn(J);if(D!==0){var P=1;J=T(Y,O,Y.length,V);for(O=0;O<D;O++)P*=V;if(this.imuln(P),this.words[0]+J<67108864)this.words[0]+=J;else this._iaddn(J)}this.strip()},$.prototype.copy=function(Y){Y.words=Array(this.length);for(var V=0;V<this.length;V++)Y.words[V]=this.words[V];Y.length=this.length,Y.negative=this.negative,Y.red=this.red},$.prototype.clone=function(){var Y=new $(null);return this.copy(Y),Y},$.prototype._expand=function(Y){while(this.length<Y)this.words[this.length++]=0;return this},$.prototype.strip=function(){while(this.length>1&&this.words[this.length-1]===0)this.length--;return this._normSign()},$.prototype._normSign=function(){if(this.length===1&&this.words[0]===0)this.negative=0;return this},$.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var A=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],L=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],E=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64000000,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,24300000,28629151,33554432,39135393,45435424,52521875,60466176];if($.prototype.toString=function(Y,V){Y=Y||10,V=V|0||1;var I;if(Y===16||Y==="hex"){I="";var G=0,W=0;for(var C=0;C<this.length;C++){var D=this.words[C],F=((D<<G|W)&16777215).toString(16);if(W=D>>>24-G&16777215,G+=2,G>=26)G-=26,C--;if(W!==0||C!==this.length-1)I=A[6-F.length]+F+I;else I=F+I}if(W!==0)I=W.toString(16)+I;while(I.length%V!==0)I="0"+I;if(this.negative!==0)I="-"+I;return I}if(Y===(Y|0)&&Y>=2&&Y<=36){var J=L[Y],O=E[Y];I="";var P=this.clone();P.negative=0;while(!P.isZero()){var R=P.modn(O).toString(Y);if(P=P.idivn(O),!P.isZero())I=A[J-R.length]+R+I;else I=R+I}if(this.isZero())I="0"+I;while(I.length%V!==0)I="0"+I;if(this.negative!==0)I="-"+I;return I}K(!1,"Base should be between 2 and 36")},$.prototype.toNumber=function(){var Y=this.words[0];if(this.length===2)Y+=this.words[1]*67108864;else if(this.length===3&&this.words[2]===1)Y+=4503599627370496+this.words[1]*67108864;else if(this.length>2)K(!1,"Number can only safely store up to 53 bits");return this.negative!==0?-Y:Y},$.prototype.toJSON=function(){return this.toString(16)},$.prototype.toBuffer=function(Y,V){return K(typeof M<"u"),this.toArrayLike(M,Y,V)},$.prototype.toArray=function(Y,V){return this.toArrayLike(Array,Y,V)},$.prototype.toArrayLike=function(Y,V,I){var G=this.byteLength(),W=I||Math.max(1,G);K(G<=W,"byte array longer than desired length"),K(W>0,"Requested array length <= 0"),this.strip();var C=V==="le",D=new Y(W),F,J,O=this.clone();if(!C){for(J=0;J<W-G;J++)D[J]=0;for(J=0;!O.isZero();J++)F=O.andln(255),O.iushrn(8),D[W-J-1]=F}else{for(J=0;!O.isZero();J++)F=O.andln(255),O.iushrn(8),D[J]=F;for(;J<W;J++)D[J]=0}return D},Math.clz32)$.prototype._countBits=function(Y){return 32-Math.clz32(Y)};else $.prototype._countBits=function(Y){var V=Y,I=0;if(V>=4096)I+=13,V>>>=13;if(V>=64)I+=7,V>>>=7;if(V>=8)I+=4,V>>>=4;if(V>=2)I+=2,V>>>=2;return I+V};$.prototype._zeroBits=function(Y){if(Y===0)return 26;var V=Y,I=0;if((V&8191)===0)I+=13,V>>>=13;if((V&127)===0)I+=7,V>>>=7;if((V&15)===0)I+=4,V>>>=4;if((V&3)===0)I+=2,V>>>=2;if((V&1)===0)I++;return I},$.prototype.bitLength=function(){var Y=this.words[this.length-1],V=this._countBits(Y);return(this.length-1)*26+V};function S(Y){var V=Array(Y.bitLength());for(var I=0;I<V.length;I++){var G=I/26|0,W=I%26;V[I]=(Y.words[G]&1<<W)>>>W}return V}$.prototype.zeroBits=function(){if(this.isZero())return 0;var Y=0;for(var V=0;V<this.length;V++){var I=this._zeroBits(this.words[V]);if(Y+=I,I!==26)break}return Y},$.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},$.prototype.toTwos=function(Y){if(this.negative!==0)return this.abs().inotn(Y).iaddn(1);return this.clone()},$.prototype.fromTwos=function(Y){if(this.testn(Y-1))return this.notn(Y).iaddn(1).ineg();return this.clone()},$.prototype.isNeg=function(){return this.negative!==0},$.prototype.neg=function(){return this.clone().ineg()},$.prototype.ineg=function(){if(!this.isZero())this.negative^=1;return this},$.prototype.iuor=function(Y){while(this.length<Y.length)this.words[this.length++]=0;for(var V=0;V<Y.length;V++)this.words[V]=this.words[V]|Y.words[V];return this.strip()},$.prototype.ior=function(Y){return K((this.negative|Y.negative)===0),this.iuor(Y)},$.prototype.or=function(Y){if(this.length>Y.length)return this.clone().ior(Y);return Y.clone().ior(this)},$.prototype.uor=function(Y){if(this.length>Y.length)return this.clone().iuor(Y);return Y.clone().iuor(this)},$.prototype.iuand=function(Y){var V;if(this.length>Y.length)V=Y;else V=this;for(var I=0;I<V.length;I++)this.words[I]=this.words[I]&Y.words[I];return this.length=V.length,this.strip()},$.prototype.iand=function(Y){return K((this.negative|Y.negative)===0),this.iuand(Y)},$.prototype.and=function(Y){if(this.length>Y.length)return this.clone().iand(Y);return Y.clone().iand(this)},$.prototype.uand=function(Y){if(this.length>Y.length)return this.clone().iuand(Y);return Y.clone().iuand(this)},$.prototype.iuxor=function(Y){var V,I;if(this.length>Y.length)V=this,I=Y;else V=Y,I=this;for(var G=0;G<I.length;G++)this.words[G]=V.words[G]^I.words[G];if(this!==V)for(;G<V.length;G++)this.words[G]=V.words[G];return this.length=V.length,this.strip()},$.prototype.ixor=function(Y){return K((this.negative|Y.negative)===0),this.iuxor(Y)},$.prototype.xor=function(Y){if(this.length>Y.length)return this.clone().ixor(Y);return Y.clone().ixor(this)},$.prototype.uxor=function(Y){if(this.length>Y.length)return this.clone().iuxor(Y);return Y.clone().iuxor(this)},$.prototype.inotn=function(Y){K(typeof Y==="number"&&Y>=0);var V=Math.ceil(Y/26)|0,I=Y%26;if(this._expand(V),I>0)V--;for(var G=0;G<V;G++)this.words[G]=~this.words[G]&67108863;if(I>0)this.words[G]=~this.words[G]&67108863>>26-I;return this.strip()},$.prototype.notn=function(Y){return this.clone().inotn(Y)},$.prototype.setn=function(Y,V){K(typeof Y==="number"&&Y>=0);var I=Y/26|0,G=Y%26;if(this._expand(I+1),V)this.words[I]=this.words[I]|1<<G;else this.words[I]=this.words[I]&~(1<<G);return this.strip()},$.prototype.iadd=function(Y){var V;if(this.negative!==0&&Y.negative===0)return this.negative=0,V=this.isub(Y),this.negative^=1,this._normSign();else if(this.negative===0&&Y.negative!==0)return Y.negative=0,V=this.isub(Y),Y.negative=1,V._normSign();var I,G;if(this.length>Y.length)I=this,G=Y;else I=Y,G=this;var W=0;for(var C=0;C<G.length;C++)V=(I.words[C]|0)+(G.words[C]|0)+W,this.words[C]=V&67108863,W=V>>>26;for(;W!==0&&C<I.length;C++)V=(I.words[C]|0)+W,this.words[C]=V&67108863,W=V>>>26;if(this.length=I.length,W!==0)this.words[this.length]=W,this.length++;else if(I!==this)for(;C<I.length;C++)this.words[C]=I.words[C];return this},$.prototype.add=function(Y){var V;if(Y.negative!==0&&this.negative===0)return Y.negative=0,V=this.sub(Y),Y.negative^=1,V;else if(Y.negative===0&&this.negative!==0)return this.negative=0,V=Y.sub(this),this.negative=1,V;if(this.length>Y.length)return this.clone().iadd(Y);return Y.clone().iadd(this)},$.prototype.isub=function(Y){if(Y.negative!==0){Y.negative=0;var V=this.iadd(Y);return Y.negative=1,V._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(Y),this.negative=1,this._normSign();var I=this.cmp(Y);if(I===0)return this.negative=0,this.length=1,this.words[0]=0,this;var G,W;if(I>0)G=this,W=Y;else G=Y,W=this;var C=0;for(var D=0;D<W.length;D++)V=(G.words[D]|0)-(W.words[D]|0)+C,C=V>>26,this.words[D]=V&67108863;for(;C!==0&&D<G.length;D++)V=(G.words[D]|0)+C,C=V>>26,this.words[D]=V&67108863;if(C===0&&D<G.length&&G!==this)for(;D<G.length;D++)this.words[D]=G.words[D];if(this.length=Math.max(this.length,D),G!==this)this.negative=1;return this.strip()},$.prototype.sub=function(Y){return this.clone().isub(Y)};function j(Y,V,I){I.negative=V.negative^Y.negative;var G=Y.length+V.length|0;I.length=G,G=G-1|0;var W=Y.words[0]|0,C=V.words[0]|0,D=W*C,F=D&67108863,J=D/67108864|0;I.words[0]=F;for(var O=1;O<G;O++){var P=J>>>26,R=J&67108863,_=Math.min(O,V.length-1);for(var f=Math.max(0,O-Y.length+1);f<=_;f++){var c=O-f|0;W=Y.words[c]|0,C=V.words[f]|0,D=W*C+R,P+=D/67108864|0,R=D&67108863}I.words[O]=R|0,J=P|0}if(J!==0)I.words[O]=J|0;else I.length--;return I.strip()}var k=function(Y,V,I){var G=Y.words,W=V.words,C=I.words,D=0,F,J,O,P=G[0]|0,R=P&8191,_=P>>>13,f=G[1]|0,c=f&8191,o=f>>>13,K0=G[2]|0,a=K0&8191,l=K0>>>13,Q0=G[3]|0,n=Q0&8191,s=Q0>>>13,f0=G[4]|0,y=f0&8191,h=f0>>>13,G0=G[5]|0,t=G0&8191,U0=G0>>>13,L0=G[6]|0,p=L0&8191,m=L0>>>13,g0=G[7]|0,r=g0&8191,J0=g0>>>13,h0=G[8]|0,F0=h0&8191,O0=h0>>>13,J1=G[9]|0,I0=J1&8191,C0=J1>>>13,K1=W[0]|0,M0=K1&8191,z0=K1>>>13,d1=W[1]|0,T0=d1&8191,j0=d1>>>13,l1=W[2]|0,v0=l1&8191,R0=l1>>>13,h1=W[3]|0,_0=h1&8191,E0=h1>>>13,_1=W[4]|0,B0=_1&8191,x0=_1>>>13,B1=W[5]|0,S0=B1&8191,g=B1>>>13,d=W[6]|0,e=d&8191,X0=d>>>13,y0=W[7]|0,H0=y0&8191,A0=y0>>>13,Q1=W[8]|0,P0=Q1&8191,N0=Q1>>>13,u1=W[9]|0,k0=u1&8191,q0=u1>>>13;I.negative=Y.negative^V.negative,I.length=19,F=Math.imul(R,M0),J=Math.imul(R,z0),J=J+Math.imul(_,M0)|0,O=Math.imul(_,z0);var G1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(G1>>>26)|0,G1&=67108863,F=Math.imul(c,M0),J=Math.imul(c,z0),J=J+Math.imul(o,M0)|0,O=Math.imul(o,z0),F=F+Math.imul(R,T0)|0,J=J+Math.imul(R,j0)|0,J=J+Math.imul(_,T0)|0,O=O+Math.imul(_,j0)|0;var l0=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(l0>>>26)|0,l0&=67108863,F=Math.imul(a,M0),J=Math.imul(a,z0),J=J+Math.imul(l,M0)|0,O=Math.imul(l,z0),F=F+Math.imul(c,T0)|0,J=J+Math.imul(c,j0)|0,J=J+Math.imul(o,T0)|0,O=O+Math.imul(o,j0)|0,F=F+Math.imul(R,v0)|0,J=J+Math.imul(R,R0)|0,J=J+Math.imul(_,v0)|0,O=O+Math.imul(_,R0)|0;var b0=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(b0>>>26)|0,b0&=67108863,F=Math.imul(n,M0),J=Math.imul(n,z0),J=J+Math.imul(s,M0)|0,O=Math.imul(s,z0),F=F+Math.imul(a,T0)|0,J=J+Math.imul(a,j0)|0,J=J+Math.imul(l,T0)|0,O=O+Math.imul(l,j0)|0,F=F+Math.imul(c,v0)|0,J=J+Math.imul(c,R0)|0,J=J+Math.imul(o,v0)|0,O=O+Math.imul(o,R0)|0,F=F+Math.imul(R,_0)|0,J=J+Math.imul(R,E0)|0,J=J+Math.imul(_,_0)|0,O=O+Math.imul(_,E0)|0;var t0=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(t0>>>26)|0,t0&=67108863,F=Math.imul(y,M0),J=Math.imul(y,z0),J=J+Math.imul(h,M0)|0,O=Math.imul(h,z0),F=F+Math.imul(n,T0)|0,J=J+Math.imul(n,j0)|0,J=J+Math.imul(s,T0)|0,O=O+Math.imul(s,j0)|0,F=F+Math.imul(a,v0)|0,J=J+Math.imul(a,R0)|0,J=J+Math.imul(l,v0)|0,O=O+Math.imul(l,R0)|0,F=F+Math.imul(c,_0)|0,J=J+Math.imul(c,E0)|0,J=J+Math.imul(o,_0)|0,O=O+Math.imul(o,E0)|0,F=F+Math.imul(R,B0)|0,J=J+Math.imul(R,x0)|0,J=J+Math.imul(_,B0)|0,O=O+Math.imul(_,x0)|0;var r0=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(r0>>>26)|0,r0&=67108863,F=Math.imul(t,M0),J=Math.imul(t,z0),J=J+Math.imul(U0,M0)|0,O=Math.imul(U0,z0),F=F+Math.imul(y,T0)|0,J=J+Math.imul(y,j0)|0,J=J+Math.imul(h,T0)|0,O=O+Math.imul(h,j0)|0,F=F+Math.imul(n,v0)|0,J=J+Math.imul(n,R0)|0,J=J+Math.imul(s,v0)|0,O=O+Math.imul(s,R0)|0,F=F+Math.imul(a,_0)|0,J=J+Math.imul(a,E0)|0,J=J+Math.imul(l,_0)|0,O=O+Math.imul(l,E0)|0,F=F+Math.imul(c,B0)|0,J=J+Math.imul(c,x0)|0,J=J+Math.imul(o,B0)|0,O=O+Math.imul(o,x0)|0,F=F+Math.imul(R,S0)|0,J=J+Math.imul(R,g)|0,J=J+Math.imul(_,S0)|0,O=O+Math.imul(_,g)|0;var F1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(F1>>>26)|0,F1&=67108863,F=Math.imul(p,M0),J=Math.imul(p,z0),J=J+Math.imul(m,M0)|0,O=Math.imul(m,z0),F=F+Math.imul(t,T0)|0,J=J+Math.imul(t,j0)|0,J=J+Math.imul(U0,T0)|0,O=O+Math.imul(U0,j0)|0,F=F+Math.imul(y,v0)|0,J=J+Math.imul(y,R0)|0,J=J+Math.imul(h,v0)|0,O=O+Math.imul(h,R0)|0,F=F+Math.imul(n,_0)|0,J=J+Math.imul(n,E0)|0,J=J+Math.imul(s,_0)|0,O=O+Math.imul(s,E0)|0,F=F+Math.imul(a,B0)|0,J=J+Math.imul(a,x0)|0,J=J+Math.imul(l,B0)|0,O=O+Math.imul(l,x0)|0,F=F+Math.imul(c,S0)|0,J=J+Math.imul(c,g)|0,J=J+Math.imul(o,S0)|0,O=O+Math.imul(o,g)|0,F=F+Math.imul(R,e)|0,J=J+Math.imul(R,X0)|0,J=J+Math.imul(_,e)|0,O=O+Math.imul(_,X0)|0;var O1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(O1>>>26)|0,O1&=67108863,F=Math.imul(r,M0),J=Math.imul(r,z0),J=J+Math.imul(J0,M0)|0,O=Math.imul(J0,z0),F=F+Math.imul(p,T0)|0,J=J+Math.imul(p,j0)|0,J=J+Math.imul(m,T0)|0,O=O+Math.imul(m,j0)|0,F=F+Math.imul(t,v0)|0,J=J+Math.imul(t,R0)|0,J=J+Math.imul(U0,v0)|0,O=O+Math.imul(U0,R0)|0,F=F+Math.imul(y,_0)|0,J=J+Math.imul(y,E0)|0,J=J+Math.imul(h,_0)|0,O=O+Math.imul(h,E0)|0,F=F+Math.imul(n,B0)|0,J=J+Math.imul(n,x0)|0,J=J+Math.imul(s,B0)|0,O=O+Math.imul(s,x0)|0,F=F+Math.imul(a,S0)|0,J=J+Math.imul(a,g)|0,J=J+Math.imul(l,S0)|0,O=O+Math.imul(l,g)|0,F=F+Math.imul(c,e)|0,J=J+Math.imul(c,X0)|0,J=J+Math.imul(o,e)|0,O=O+Math.imul(o,X0)|0,F=F+Math.imul(R,H0)|0,J=J+Math.imul(R,A0)|0,J=J+Math.imul(_,H0)|0,O=O+Math.imul(_,A0)|0;var C1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(C1>>>26)|0,C1&=67108863,F=Math.imul(F0,M0),J=Math.imul(F0,z0),J=J+Math.imul(O0,M0)|0,O=Math.imul(O0,z0),F=F+Math.imul(r,T0)|0,J=J+Math.imul(r,j0)|0,J=J+Math.imul(J0,T0)|0,O=O+Math.imul(J0,j0)|0,F=F+Math.imul(p,v0)|0,J=J+Math.imul(p,R0)|0,J=J+Math.imul(m,v0)|0,O=O+Math.imul(m,R0)|0,F=F+Math.imul(t,_0)|0,J=J+Math.imul(t,E0)|0,J=J+Math.imul(U0,_0)|0,O=O+Math.imul(U0,E0)|0,F=F+Math.imul(y,B0)|0,J=J+Math.imul(y,x0)|0,J=J+Math.imul(h,B0)|0,O=O+Math.imul(h,x0)|0,F=F+Math.imul(n,S0)|0,J=J+Math.imul(n,g)|0,J=J+Math.imul(s,S0)|0,O=O+Math.imul(s,g)|0,F=F+Math.imul(a,e)|0,J=J+Math.imul(a,X0)|0,J=J+Math.imul(l,e)|0,O=O+Math.imul(l,X0)|0,F=F+Math.imul(c,H0)|0,J=J+Math.imul(c,A0)|0,J=J+Math.imul(o,H0)|0,O=O+Math.imul(o,A0)|0,F=F+Math.imul(R,P0)|0,J=J+Math.imul(R,N0)|0,J=J+Math.imul(_,P0)|0,O=O+Math.imul(_,N0)|0;var A1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(A1>>>26)|0,A1&=67108863,F=Math.imul(I0,M0),J=Math.imul(I0,z0),J=J+Math.imul(C0,M0)|0,O=Math.imul(C0,z0),F=F+Math.imul(F0,T0)|0,J=J+Math.imul(F0,j0)|0,J=J+Math.imul(O0,T0)|0,O=O+Math.imul(O0,j0)|0,F=F+Math.imul(r,v0)|0,J=J+Math.imul(r,R0)|0,J=J+Math.imul(J0,v0)|0,O=O+Math.imul(J0,R0)|0,F=F+Math.imul(p,_0)|0,J=J+Math.imul(p,E0)|0,J=J+Math.imul(m,_0)|0,O=O+Math.imul(m,E0)|0,F=F+Math.imul(t,B0)|0,J=J+Math.imul(t,x0)|0,J=J+Math.imul(U0,B0)|0,O=O+Math.imul(U0,x0)|0,F=F+Math.imul(y,S0)|0,J=J+Math.imul(y,g)|0,J=J+Math.imul(h,S0)|0,O=O+Math.imul(h,g)|0,F=F+Math.imul(n,e)|0,J=J+Math.imul(n,X0)|0,J=J+Math.imul(s,e)|0,O=O+Math.imul(s,X0)|0,F=F+Math.imul(a,H0)|0,J=J+Math.imul(a,A0)|0,J=J+Math.imul(l,H0)|0,O=O+Math.imul(l,A0)|0,F=F+Math.imul(c,P0)|0,J=J+Math.imul(c,N0)|0,J=J+Math.imul(o,P0)|0,O=O+Math.imul(o,N0)|0,F=F+Math.imul(R,k0)|0,J=J+Math.imul(R,q0)|0,J=J+Math.imul(_,k0)|0,O=O+Math.imul(_,q0)|0;var z1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(z1>>>26)|0,z1&=67108863,F=Math.imul(I0,T0),J=Math.imul(I0,j0),J=J+Math.imul(C0,T0)|0,O=Math.imul(C0,j0),F=F+Math.imul(F0,v0)|0,J=J+Math.imul(F0,R0)|0,J=J+Math.imul(O0,v0)|0,O=O+Math.imul(O0,R0)|0,F=F+Math.imul(r,_0)|0,J=J+Math.imul(r,E0)|0,J=J+Math.imul(J0,_0)|0,O=O+Math.imul(J0,E0)|0,F=F+Math.imul(p,B0)|0,J=J+Math.imul(p,x0)|0,J=J+Math.imul(m,B0)|0,O=O+Math.imul(m,x0)|0,F=F+Math.imul(t,S0)|0,J=J+Math.imul(t,g)|0,J=J+Math.imul(U0,S0)|0,O=O+Math.imul(U0,g)|0,F=F+Math.imul(y,e)|0,J=J+Math.imul(y,X0)|0,J=J+Math.imul(h,e)|0,O=O+Math.imul(h,X0)|0,F=F+Math.imul(n,H0)|0,J=J+Math.imul(n,A0)|0,J=J+Math.imul(s,H0)|0,O=O+Math.imul(s,A0)|0,F=F+Math.imul(a,P0)|0,J=J+Math.imul(a,N0)|0,J=J+Math.imul(l,P0)|0,O=O+Math.imul(l,N0)|0,F=F+Math.imul(c,k0)|0,J=J+Math.imul(c,q0)|0,J=J+Math.imul(o,k0)|0,O=O+Math.imul(o,q0)|0;var D1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(D1>>>26)|0,D1&=67108863,F=Math.imul(I0,v0),J=Math.imul(I0,R0),J=J+Math.imul(C0,v0)|0,O=Math.imul(C0,R0),F=F+Math.imul(F0,_0)|0,J=J+Math.imul(F0,E0)|0,J=J+Math.imul(O0,_0)|0,O=O+Math.imul(O0,E0)|0,F=F+Math.imul(r,B0)|0,J=J+Math.imul(r,x0)|0,J=J+Math.imul(J0,B0)|0,O=O+Math.imul(J0,x0)|0,F=F+Math.imul(p,S0)|0,J=J+Math.imul(p,g)|0,J=J+Math.imul(m,S0)|0,O=O+Math.imul(m,g)|0,F=F+Math.imul(t,e)|0,J=J+Math.imul(t,X0)|0,J=J+Math.imul(U0,e)|0,O=O+Math.imul(U0,X0)|0,F=F+Math.imul(y,H0)|0,J=J+Math.imul(y,A0)|0,J=J+Math.imul(h,H0)|0,O=O+Math.imul(h,A0)|0,F=F+Math.imul(n,P0)|0,J=J+Math.imul(n,N0)|0,J=J+Math.imul(s,P0)|0,O=O+Math.imul(s,N0)|0,F=F+Math.imul(a,k0)|0,J=J+Math.imul(a,q0)|0,J=J+Math.imul(l,k0)|0,O=O+Math.imul(l,q0)|0;var M1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(M1>>>26)|0,M1&=67108863,F=Math.imul(I0,_0),J=Math.imul(I0,E0),J=J+Math.imul(C0,_0)|0,O=Math.imul(C0,E0),F=F+Math.imul(F0,B0)|0,J=J+Math.imul(F0,x0)|0,J=J+Math.imul(O0,B0)|0,O=O+Math.imul(O0,x0)|0,F=F+Math.imul(r,S0)|0,J=J+Math.imul(r,g)|0,J=J+Math.imul(J0,S0)|0,O=O+Math.imul(J0,g)|0,F=F+Math.imul(p,e)|0,J=J+Math.imul(p,X0)|0,J=J+Math.imul(m,e)|0,O=O+Math.imul(m,X0)|0,F=F+Math.imul(t,H0)|0,J=J+Math.imul(t,A0)|0,J=J+Math.imul(U0,H0)|0,O=O+Math.imul(U0,A0)|0,F=F+Math.imul(y,P0)|0,J=J+Math.imul(y,N0)|0,J=J+Math.imul(h,P0)|0,O=O+Math.imul(h,N0)|0,F=F+Math.imul(n,k0)|0,J=J+Math.imul(n,q0)|0,J=J+Math.imul(s,k0)|0,O=O+Math.imul(s,q0)|0;var q1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(q1>>>26)|0,q1&=67108863,F=Math.imul(I0,B0),J=Math.imul(I0,x0),J=J+Math.imul(C0,B0)|0,O=Math.imul(C0,x0),F=F+Math.imul(F0,S0)|0,J=J+Math.imul(F0,g)|0,J=J+Math.imul(O0,S0)|0,O=O+Math.imul(O0,g)|0,F=F+Math.imul(r,e)|0,J=J+Math.imul(r,X0)|0,J=J+Math.imul(J0,e)|0,O=O+Math.imul(J0,X0)|0,F=F+Math.imul(p,H0)|0,J=J+Math.imul(p,A0)|0,J=J+Math.imul(m,H0)|0,O=O+Math.imul(m,A0)|0,F=F+Math.imul(t,P0)|0,J=J+Math.imul(t,N0)|0,J=J+Math.imul(U0,P0)|0,O=O+Math.imul(U0,N0)|0,F=F+Math.imul(y,k0)|0,J=J+Math.imul(y,q0)|0,J=J+Math.imul(h,k0)|0,O=O+Math.imul(h,q0)|0;var L1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(L1>>>26)|0,L1&=67108863,F=Math.imul(I0,S0),J=Math.imul(I0,g),J=J+Math.imul(C0,S0)|0,O=Math.imul(C0,g),F=F+Math.imul(F0,e)|0,J=J+Math.imul(F0,X0)|0,J=J+Math.imul(O0,e)|0,O=O+Math.imul(O0,X0)|0,F=F+Math.imul(r,H0)|0,J=J+Math.imul(r,A0)|0,J=J+Math.imul(J0,H0)|0,O=O+Math.imul(J0,A0)|0,F=F+Math.imul(p,P0)|0,J=J+Math.imul(p,N0)|0,J=J+Math.imul(m,P0)|0,O=O+Math.imul(m,N0)|0,F=F+Math.imul(t,k0)|0,J=J+Math.imul(t,q0)|0,J=J+Math.imul(U0,k0)|0,O=O+Math.imul(U0,q0)|0;var T1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(T1>>>26)|0,T1&=67108863,F=Math.imul(I0,e),J=Math.imul(I0,X0),J=J+Math.imul(C0,e)|0,O=Math.imul(C0,X0),F=F+Math.imul(F0,H0)|0,J=J+Math.imul(F0,A0)|0,J=J+Math.imul(O0,H0)|0,O=O+Math.imul(O0,A0)|0,F=F+Math.imul(r,P0)|0,J=J+Math.imul(r,N0)|0,J=J+Math.imul(J0,P0)|0,O=O+Math.imul(J0,N0)|0,F=F+Math.imul(p,k0)|0,J=J+Math.imul(p,q0)|0,J=J+Math.imul(m,k0)|0,O=O+Math.imul(m,q0)|0;var R1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(R1>>>26)|0,R1&=67108863,F=Math.imul(I0,H0),J=Math.imul(I0,A0),J=J+Math.imul(C0,H0)|0,O=Math.imul(C0,A0),F=F+Math.imul(F0,P0)|0,J=J+Math.imul(F0,N0)|0,J=J+Math.imul(O0,P0)|0,O=O+Math.imul(O0,N0)|0,F=F+Math.imul(r,k0)|0,J=J+Math.imul(r,q0)|0,J=J+Math.imul(J0,k0)|0,O=O+Math.imul(J0,q0)|0;var E1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(E1>>>26)|0,E1&=67108863,F=Math.imul(I0,P0),J=Math.imul(I0,N0),J=J+Math.imul(C0,P0)|0,O=Math.imul(C0,N0),F=F+Math.imul(F0,k0)|0,J=J+Math.imul(F0,q0)|0,J=J+Math.imul(O0,k0)|0,O=O+Math.imul(O0,q0)|0;var S1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(S1>>>26)|0,S1&=67108863,F=Math.imul(I0,k0),J=Math.imul(I0,q0),J=J+Math.imul(C0,k0)|0,O=Math.imul(C0,q0);var P1=(D+F|0)+((J&8191)<<13)|0;if(D=(O+(J>>>13)|0)+(P1>>>26)|0,P1&=67108863,C[0]=G1,C[1]=l0,C[2]=b0,C[3]=t0,C[4]=r0,C[5]=F1,C[6]=O1,C[7]=C1,C[8]=A1,C[9]=z1,C[10]=D1,C[11]=M1,C[12]=q1,C[13]=L1,C[14]=T1,C[15]=R1,C[16]=E1,C[17]=S1,C[18]=P1,D!==0)C[19]=D,I.length++;return I};if(!Math.imul)k=j;function B(Y,V,I){I.negative=V.negative^Y.negative,I.length=Y.length+V.length;var G=0,W=0;for(var C=0;C<I.length-1;C++){var D=W;W=0;var F=G&67108863,J=Math.min(C,V.length-1);for(var O=Math.max(0,C-Y.length+1);O<=J;O++){var P=C-O,R=Y.words[P]|0,_=V.words[O]|0,f=R*_,c=f&67108863;D=D+(f/67108864|0)|0,c=c+F|0,F=c&67108863,D=D+(c>>>26)|0,W+=D>>>26,D&=67108863}I.words[C]=F,G=D,D=W}if(G!==0)I.words[C]=G;else I.length--;return I.strip()}function v(Y,V,I){var G=new x;return G.mulp(Y,V,I)}$.prototype.mulTo=function(Y,V){var I,G=this.length+Y.length;if(this.length===10&&Y.length===10)I=k(this,Y,V);else if(G<63)I=j(this,Y,V);else if(G<1024)I=B(this,Y,V);else I=v(this,Y,V);return I};function x(Y,V){this.x=Y,this.y=V}x.prototype.makeRBT=function(Y){var V=Array(Y),I=$.prototype._countBits(Y)-1;for(var G=0;G<Y;G++)V[G]=this.revBin(G,I,Y);return V},x.prototype.revBin=function(Y,V,I){if(Y===0||Y===I-1)return Y;var G=0;for(var W=0;W<V;W++)G|=(Y&1)<<V-W-1,Y>>=1;return G},x.prototype.permute=function(Y,V,I,G,W,C){for(var D=0;D<C;D++)G[D]=V[Y[D]],W[D]=I[Y[D]]},x.prototype.transform=function(Y,V,I,G,W,C){this.permute(C,Y,V,I,G,W);for(var D=1;D<W;D<<=1){var F=D<<1,J=Math.cos(2*Math.PI/F),O=Math.sin(2*Math.PI/F);for(var P=0;P<W;P+=F){var R=J,_=O;for(var f=0;f<D;f++){var c=I[P+f],o=G[P+f],K0=I[P+f+D],a=G[P+f+D],l=R*K0-_*a;if(a=R*a+_*K0,K0=l,I[P+f]=c+K0,G[P+f]=o+a,I[P+f+D]=c-K0,G[P+f+D]=o-a,f!==F)l=J*R-O*_,_=J*_+O*R,R=l}}}},x.prototype.guessLen13b=function(Y,V){var I=Math.max(V,Y)|1,G=I&1,W=0;for(I=I/2|0;I;I=I>>>1)W++;return 1<<W+1+G},x.prototype.conjugate=function(Y,V,I){if(I<=1)return;for(var G=0;G<I/2;G++){var W=Y[G];Y[G]=Y[I-G-1],Y[I-G-1]=W,W=V[G],V[G]=-V[I-G-1],V[I-G-1]=-W}},x.prototype.normalize13b=function(Y,V){var I=0;for(var G=0;G<V/2;G++){var W=Math.round(Y[2*G+1]/V)*8192+Math.round(Y[2*G]/V)+I;if(Y[G]=W&67108863,W<67108864)I=0;else I=W/67108864|0}return Y},x.prototype.convert13b=function(Y,V,I,G){var W=0;for(var C=0;C<V;C++)W=W+(Y[C]|0),I[2*C]=W&8191,W=W>>>13,I[2*C+1]=W&8191,W=W>>>13;for(C=2*V;C<G;++C)I[C]=0;K(W===0),K((W&-8192)===0)},x.prototype.stub=function(Y){var V=Array(Y);for(var I=0;I<Y;I++)V[I]=0;return V},x.prototype.mulp=function(Y,V,I){var G=2*this.guessLen13b(Y.length,V.length),W=this.makeRBT(G),C=this.stub(G),D=Array(G),F=Array(G),J=Array(G),O=Array(G),P=Array(G),R=Array(G),_=I.words;_.length=G,this.convert13b(Y.words,Y.length,D,G),this.convert13b(V.words,V.length,O,G),this.transform(D,C,F,J,G,W),this.transform(O,C,P,R,G,W);for(var f=0;f<G;f++){var c=F[f]*P[f]-J[f]*R[f];J[f]=F[f]*R[f]+J[f]*P[f],F[f]=c}return this.conjugate(F,J,G),this.transform(F,J,_,C,G,W),this.conjugate(_,C,G),this.normalize13b(_,G),I.negative=Y.negative^V.negative,I.length=Y.length+V.length,I.strip()},$.prototype.mul=function(Y){var V=new $(null);return V.words=Array(this.length+Y.length),this.mulTo(Y,V)},$.prototype.mulf=function(Y){var V=new $(null);return V.words=Array(this.length+Y.length),v(this,Y,V)},$.prototype.imul=function(Y){return this.clone().mulTo(Y,this)},$.prototype.imuln=function(Y){K(typeof Y==="number"),K(Y<67108864);var V=0;for(var I=0;I<this.length;I++){var G=(this.words[I]|0)*Y,W=(G&67108863)+(V&67108863);V>>=26,V+=G/67108864|0,V+=W>>>26,this.words[I]=W&67108863}if(V!==0)this.words[I]=V,this.length++;return this.length=Y===0?1:this.length,this},$.prototype.muln=function(Y){return this.clone().imuln(Y)},$.prototype.sqr=function(){return this.mul(this)},$.prototype.isqr=function(){return this.imul(this.clone())},$.prototype.pow=function(Y){var V=S(Y);if(V.length===0)return new $(1);var I=this;for(var G=0;G<V.length;G++,I=I.sqr())if(V[G]!==0)break;if(++G<V.length)for(var W=I.sqr();G<V.length;G++,W=W.sqr()){if(V[G]===0)continue;I=I.mul(W)}return I},$.prototype.iushln=function(Y){K(typeof Y==="number"&&Y>=0);var V=Y%26,I=(Y-V)/26,G=67108863>>>26-V<<26-V,W;if(V!==0){var C=0;for(W=0;W<this.length;W++){var D=this.words[W]&G,F=(this.words[W]|0)-D<<V;this.words[W]=F|C,C=D>>>26-V}if(C)this.words[W]=C,this.length++}if(I!==0){for(W=this.length-1;W>=0;W--)this.words[W+I]=this.words[W];for(W=0;W<I;W++)this.words[W]=0;this.length+=I}return this.strip()},$.prototype.ishln=function(Y){return K(this.negative===0),this.iushln(Y)},$.prototype.iushrn=function(Y,V,I){K(typeof Y==="number"&&Y>=0);var G;if(V)G=(V-V%26)/26;else G=0;var W=Y%26,C=Math.min((Y-W)/26,this.length),D=67108863^67108863>>>W<<W,F=I;if(G-=C,G=Math.max(0,G),F){for(var J=0;J<C;J++)F.words[J]=this.words[J];F.length=C}if(C===0);else if(this.length>C){this.length-=C;for(J=0;J<this.length;J++)this.words[J]=this.words[J+C]}else this.words[0]=0,this.length=1;var O=0;for(J=this.length-1;J>=0&&(O!==0||J>=G);J--){var P=this.words[J]|0;this.words[J]=O<<26-W|P>>>W,O=P&D}if(F&&O!==0)F.words[F.length++]=O;if(this.length===0)this.words[0]=0,this.length=1;return this.strip()},$.prototype.ishrn=function(Y,V,I){return K(this.negative===0),this.iushrn(Y,V,I)},$.prototype.shln=function(Y){return this.clone().ishln(Y)},$.prototype.ushln=function(Y){return this.clone().iushln(Y)},$.prototype.shrn=function(Y){return this.clone().ishrn(Y)},$.prototype.ushrn=function(Y){return this.clone().iushrn(Y)},$.prototype.testn=function(Y){K(typeof Y==="number"&&Y>=0);var V=Y%26,I=(Y-V)/26,G=1<<V;if(this.length<=I)return!1;var W=this.words[I];return!!(W&G)},$.prototype.imaskn=function(Y){K(typeof Y==="number"&&Y>=0);var V=Y%26,I=(Y-V)/26;if(K(this.negative===0,"imaskn works only with positive numbers"),this.length<=I)return this;if(V!==0)I++;if(this.length=Math.min(I,this.length),V!==0){var G=67108863^67108863>>>V<<V;this.words[this.length-1]&=G}return this.strip()},$.prototype.maskn=function(Y){return this.clone().imaskn(Y)},$.prototype.iaddn=function(Y){if(K(typeof Y==="number"),K(Y<67108864),Y<0)return this.isubn(-Y);if(this.negative!==0){if(this.length===1&&(this.words[0]|0)<Y)return this.words[0]=Y-(this.words[0]|0),this.negative=0,this;return this.negative=0,this.isubn(Y),this.negative=1,this}return this._iaddn(Y)},$.prototype._iaddn=function(Y){this.words[0]+=Y;for(var V=0;V<this.length&&this.words[V]>=67108864;V++)if(this.words[V]-=67108864,V===this.length-1)this.words[V+1]=1;else this.words[V+1]++;return this.length=Math.max(this.length,V+1),this},$.prototype.isubn=function(Y){if(K(typeof Y==="number"),K(Y<67108864),Y<0)return this.iaddn(-Y);if(this.negative!==0)return this.negative=0,this.iaddn(Y),this.negative=1,this;if(this.words[0]-=Y,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var V=0;V<this.length&&this.words[V]<0;V++)this.words[V]+=67108864,this.words[V+1]-=1;return this.strip()},$.prototype.addn=function(Y){return this.clone().iaddn(Y)},$.prototype.subn=function(Y){return this.clone().isubn(Y)},$.prototype.iabs=function(){return this.negative=0,this},$.prototype.abs=function(){return this.clone().iabs()},$.prototype._ishlnsubmul=function(Y,V,I){var G=Y.length+I,W;this._expand(G);var C,D=0;for(W=0;W<Y.length;W++){C=(this.words[W+I]|0)+D;var F=(Y.words[W]|0)*V;C-=F&67108863,D=(C>>26)-(F/67108864|0),this.words[W+I]=C&67108863}for(;W<this.length-I;W++)C=(this.words[W+I]|0)+D,D=C>>26,this.words[W+I]=C&67108863;if(D===0)return this.strip();K(D===-1),D=0;for(W=0;W<this.length;W++)C=-(this.words[W]|0)+D,D=C>>26,this.words[W]=C&67108863;return this.negative=1,this.strip()},$.prototype._wordDiv=function(Y,V){var I=this.length-Y.length,G=this.clone(),W=Y,C=W.words[W.length-1]|0,D=this._countBits(C);if(I=26-D,I!==0)W=W.ushln(I),G.iushln(I),C=W.words[W.length-1]|0;var F=G.length-W.length,J;if(V!=="mod"){J=new $(null),J.length=F+1,J.words=Array(J.length);for(var O=0;O<J.length;O++)J.words[O]=0}var P=G.clone()._ishlnsubmul(W,1,F);if(P.negative===0){if(G=P,J)J.words[F]=1}for(var R=F-1;R>=0;R--){var _=(G.words[W.length+R]|0)*67108864+(G.words[W.length+R-1]|0);_=Math.min(_/C|0,67108863),G._ishlnsubmul(W,_,R);while(G.negative!==0)if(_--,G.negative=0,G._ishlnsubmul(W,1,R),!G.isZero())G.negative^=1;if(J)J.words[R]=_}if(J)J.strip();if(G.strip(),V!=="div"&&I!==0)G.iushrn(I);return{div:J||null,mod:G}},$.prototype.divmod=function(Y,V,I){if(K(!Y.isZero()),this.isZero())return{div:new $(0),mod:new $(0)};var G,W,C;if(this.negative!==0&&Y.negative===0){if(C=this.neg().divmod(Y,V),V!=="mod")G=C.div.neg();if(V!=="div"){if(W=C.mod.neg(),I&&W.negative!==0)W.iadd(Y)}return{div:G,mod:W}}if(this.negative===0&&Y.negative!==0){if(C=this.divmod(Y.neg(),V),V!=="mod")G=C.div.neg();return{div:G,mod:C.mod}}if((this.negative&Y.negative)!==0){if(C=this.neg().divmod(Y.neg(),V),V!=="div"){if(W=C.mod.neg(),I&&W.negative!==0)W.isub(Y)}return{div:C.div,mod:W}}if(Y.length>this.length||this.cmp(Y)<0)return{div:new $(0),mod:this};if(Y.length===1){if(V==="div")return{div:this.divn(Y.words[0]),mod:null};if(V==="mod")return{div:null,mod:new $(this.modn(Y.words[0]))};return{div:this.divn(Y.words[0]),mod:new $(this.modn(Y.words[0]))}}return this._wordDiv(Y,V)},$.prototype.div=function(Y){return this.divmod(Y,"div",!1).div},$.prototype.mod=function(Y){return this.divmod(Y,"mod",!1).mod},$.prototype.umod=function(Y){return this.divmod(Y,"mod",!0).mod},$.prototype.divRound=function(Y){var V=this.divmod(Y);if(V.mod.isZero())return V.div;var I=V.div.negative!==0?V.mod.isub(Y):V.mod,G=Y.ushrn(1),W=Y.andln(1),C=I.cmp(G);if(C<0||W===1&&C===0)return V.div;return V.div.negative!==0?V.div.isubn(1):V.div.iaddn(1)},$.prototype.modn=function(Y){K(Y<=67108863);var V=67108864%Y,I=0;for(var G=this.length-1;G>=0;G--)I=(V*I+(this.words[G]|0))%Y;return I},$.prototype.idivn=function(Y){K(Y<=67108863);var V=0;for(var I=this.length-1;I>=0;I--){var G=(this.words[I]|0)+V*67108864;this.words[I]=G/Y|0,V=G%Y}return this.strip()},$.prototype.divn=function(Y){return this.clone().idivn(Y)},$.prototype.egcd=function(Y){K(Y.negative===0),K(!Y.isZero());var V=this,I=Y.clone();if(V.negative!==0)V=V.umod(Y);else V=V.clone();var G=new $(1),W=new $(0),C=new $(0),D=new $(1),F=0;while(V.isEven()&&I.isEven())V.iushrn(1),I.iushrn(1),++F;var J=I.clone(),O=V.clone();while(!V.isZero()){for(var P=0,R=1;(V.words[0]&R)===0&&P<26;++P,R<<=1);if(P>0){V.iushrn(P);while(P-- >0){if(G.isOdd()||W.isOdd())G.iadd(J),W.isub(O);G.iushrn(1),W.iushrn(1)}}for(var _=0,f=1;(I.words[0]&f)===0&&_<26;++_,f<<=1);if(_>0){I.iushrn(_);while(_-- >0){if(C.isOdd()||D.isOdd())C.iadd(J),D.isub(O);C.iushrn(1),D.iushrn(1)}}if(V.cmp(I)>=0)V.isub(I),G.isub(C),W.isub(D);else I.isub(V),C.isub(G),D.isub(W)}return{a:C,b:D,gcd:I.iushln(F)}},$.prototype._invmp=function(Y){K(Y.negative===0),K(!Y.isZero());var V=this,I=Y.clone();if(V.negative!==0)V=V.umod(Y);else V=V.clone();var G=new $(1),W=new $(0),C=I.clone();while(V.cmpn(1)>0&&I.cmpn(1)>0){for(var D=0,F=1;(V.words[0]&F)===0&&D<26;++D,F<<=1);if(D>0){V.iushrn(D);while(D-- >0){if(G.isOdd())G.iadd(C);G.iushrn(1)}}for(var J=0,O=1;(I.words[0]&O)===0&&J<26;++J,O<<=1);if(J>0){I.iushrn(J);while(J-- >0){if(W.isOdd())W.iadd(C);W.iushrn(1)}}if(V.cmp(I)>=0)V.isub(I),G.isub(W);else I.isub(V),W.isub(G)}var P;if(V.cmpn(1)===0)P=G;else P=W;if(P.cmpn(0)<0)P.iadd(Y);return P},$.prototype.gcd=function(Y){if(this.isZero())return Y.abs();if(Y.isZero())return this.abs();var V=this.clone(),I=Y.clone();V.negative=0,I.negative=0;for(var G=0;V.isEven()&&I.isEven();G++)V.iushrn(1),I.iushrn(1);do{while(V.isEven())V.iushrn(1);while(I.isEven())I.iushrn(1);var W=V.cmp(I);if(W<0){var C=V;V=I,I=C}else if(W===0||I.cmpn(1)===0)break;V.isub(I)}while(!0);return I.iushln(G)},$.prototype.invm=function(Y){return this.egcd(Y).a.umod(Y)},$.prototype.isEven=function(){return(this.words[0]&1)===0},$.prototype.isOdd=function(){return(this.words[0]&1)===1},$.prototype.andln=function(Y){return this.words[0]&Y},$.prototype.bincn=function(Y){K(typeof Y==="number");var V=Y%26,I=(Y-V)/26,G=1<<V;if(this.length<=I)return this._expand(I+1),this.words[I]|=G,this;var W=G;for(var C=I;W!==0&&C<this.length;C++){var D=this.words[C]|0;D+=W,W=D>>>26,D&=67108863,this.words[C]=D}if(W!==0)this.words[C]=W,this.length++;return this},$.prototype.isZero=function(){return this.length===1&&this.words[0]===0},$.prototype.cmpn=function(Y){var V=Y<0;if(this.negative!==0&&!V)return-1;if(this.negative===0&&V)return 1;this.strip();var I;if(this.length>1)I=1;else{if(V)Y=-Y;K(Y<=67108863,"Number is too big");var G=this.words[0]|0;I=G===Y?0:G<Y?-1:1}if(this.negative!==0)return-I|0;return I},$.prototype.cmp=function(Y){if(this.negative!==0&&Y.negative===0)return-1;if(this.negative===0&&Y.negative!==0)return 1;var V=this.ucmp(Y);if(this.negative!==0)return-V|0;return V},$.prototype.ucmp=function(Y){if(this.length>Y.length)return 1;if(this.length<Y.length)return-1;var V=0;for(var I=this.length-1;I>=0;I--){var G=this.words[I]|0,W=Y.words[I]|0;if(G===W)continue;if(G<W)V=-1;else if(G>W)V=1;break}return V},$.prototype.gtn=function(Y){return this.cmpn(Y)===1},$.prototype.gt=function(Y){return this.cmp(Y)===1},$.prototype.gten=function(Y){return this.cmpn(Y)>=0},$.prototype.gte=function(Y){return this.cmp(Y)>=0},$.prototype.ltn=function(Y){return this.cmpn(Y)===-1},$.prototype.lt=function(Y){return this.cmp(Y)===-1},$.prototype.lten=function(Y){return this.cmpn(Y)<=0},$.prototype.lte=function(Y){return this.cmp(Y)<=0},$.prototype.eqn=function(Y){return this.cmpn(Y)===0},$.prototype.eq=function(Y){return this.cmp(Y)===0},$.red=function(Y){return new b(Y)},$.prototype.toRed=function(Y){return K(!this.red,"Already a number in reduction context"),K(this.negative===0,"red works only with positives"),Y.convertTo(this)._forceRed(Y)},$.prototype.fromRed=function(){return K(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},$.prototype._forceRed=function(Y){return this.red=Y,this},$.prototype.forceRed=function(Y){return K(!this.red,"Already a number in reduction context"),this._forceRed(Y)},$.prototype.redAdd=function(Y){return K(this.red,"redAdd works only with red numbers"),this.red.add(this,Y)},$.prototype.redIAdd=function(Y){return K(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,Y)},$.prototype.redSub=function(Y){return K(this.red,"redSub works only with red numbers"),this.red.sub(this,Y)},$.prototype.redISub=function(Y){return K(this.red,"redISub works only with red numbers"),this.red.isub(this,Y)},$.prototype.redShl=function(Y){return K(this.red,"redShl works only with red numbers"),this.red.shl(this,Y)},$.prototype.redMul=function(Y){return K(this.red,"redMul works only with red numbers"),this.red._verify2(this,Y),this.red.mul(this,Y)},$.prototype.redIMul=function(Y){return K(this.red,"redMul works only with red numbers"),this.red._verify2(this,Y),this.red.imul(this,Y)},$.prototype.redSqr=function(){return K(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},$.prototype.redISqr=function(){return K(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},$.prototype.redSqrt=function(){return K(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},$.prototype.redInvm=function(){return K(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},$.prototype.redNeg=function(){return K(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},$.prototype.redPow=function(Y){return K(this.red&&!Y.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,Y)};var N={k256:null,p224:null,p192:null,p25519:null};function w(Y,V){this.name=Y,this.p=new $(V,16),this.n=this.p.bitLength(),this.k=new $(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}w.prototype._tmp=function(){var Y=new $(null);return Y.words=Array(Math.ceil(this.n/13)),Y},w.prototype.ireduce=function(Y){var V=Y,I;do this.split(V,this.tmp),V=this.imulK(V),V=V.iadd(this.tmp),I=V.bitLength();while(I>this.n);var G=I<this.n?-1:V.ucmp(this.p);if(G===0)V.words[0]=0,V.length=1;else if(G>0)V.isub(this.p);else if(V.strip!==void 0)V.strip();else V._strip();return V},w.prototype.split=function(Y,V){Y.iushrn(this.n,0,V)},w.prototype.imulK=function(Y){return Y.imul(this.k)};function u(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}H(u,w),u.prototype.split=function(Y,V){var I=4194303,G=Math.min(Y.length,9);for(var W=0;W<G;W++)V.words[W]=Y.words[W];if(V.length=G,Y.length<=9){Y.words[0]=0,Y.length=1;return}var C=Y.words[9];V.words[V.length++]=C&I;for(W=10;W<Y.length;W++){var D=Y.words[W]|0;Y.words[W-10]=(D&I)<<4|C>>>22,C=D}if(C>>>=22,Y.words[W-10]=C,C===0&&Y.length>10)Y.length-=10;else Y.length-=9},u.prototype.imulK=function(Y){Y.words[Y.length]=0,Y.words[Y.length+1]=0,Y.length+=2;var V=0;for(var I=0;I<Y.length;I++){var G=Y.words[I]|0;V+=G*977,Y.words[I]=V&67108863,V=G*64+(V/67108864|0)}if(Y.words[Y.length-1]===0){if(Y.length--,Y.words[Y.length-1]===0)Y.length--}return Y};function Z0(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}H(Z0,w);function V0(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}H(V0,w);function Y0(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}H(Y0,w),Y0.prototype.imulK=function(Y){var V=0;for(var I=0;I<Y.length;I++){var G=(Y.words[I]|0)*19+V,W=G&67108863;G>>>=26,Y.words[I]=W,V=G}if(V!==0)Y.words[Y.length++]=V;return Y},$._prime=function(Y){if(N[Y])return N[Y];var V;if(Y==="k256")V=new u;else if(Y==="p224")V=new Z0;else if(Y==="p192")V=new V0;else if(Y==="p25519")V=new Y0;else throw Error("Unknown prime "+Y);return N[Y]=V,V};function b(Y){if(typeof Y==="string"){var V=$._prime(Y);this.m=V.p,this.prime=V}else K(Y.gtn(1),"modulus must be greater than 1"),this.m=Y,this.prime=null}b.prototype._verify1=function(Y){K(Y.negative===0,"red works only with positives"),K(Y.red,"red works only with red numbers")},b.prototype._verify2=function(Y,V){K((Y.negative|V.negative)===0,"red works only with positives"),K(Y.red&&Y.red===V.red,"red works only with red numbers")},b.prototype.imod=function(Y){if(this.prime)return this.prime.ireduce(Y)._forceRed(this);return Y.umod(this.m)._forceRed(this)},b.prototype.neg=function(Y){if(Y.isZero())return Y.clone();return this.m.sub(Y)._forceRed(this)},b.prototype.add=function(Y,V){this._verify2(Y,V);var I=Y.add(V);if(I.cmp(this.m)>=0)I.isub(this.m);return I._forceRed(this)},b.prototype.iadd=function(Y,V){this._verify2(Y,V);var I=Y.iadd(V);if(I.cmp(this.m)>=0)I.isub(this.m);return I},b.prototype.sub=function(Y,V){this._verify2(Y,V);var I=Y.sub(V);if(I.cmpn(0)<0)I.iadd(this.m);return I._forceRed(this)},b.prototype.isub=function(Y,V){this._verify2(Y,V);var I=Y.isub(V);if(I.cmpn(0)<0)I.iadd(this.m);return I},b.prototype.shl=function(Y,V){return this._verify1(Y),this.imod(Y.ushln(V))},b.prototype.imul=function(Y,V){return this._verify2(Y,V),this.imod(Y.imul(V))},b.prototype.mul=function(Y,V){return this._verify2(Y,V),this.imod(Y.mul(V))},b.prototype.isqr=function(Y){return this.imul(Y,Y.clone())},b.prototype.sqr=function(Y){return this.mul(Y,Y)},b.prototype.sqrt=function(Y){if(Y.isZero())return Y.clone();var V=this.m.andln(3);if(K(V%2===1),V===3){var I=this.m.add(new $(1)).iushrn(2);return this.pow(Y,I)}var G=this.m.subn(1),W=0;while(!G.isZero()&&G.andln(1)===0)W++,G.iushrn(1);K(!G.isZero());var C=new $(1).toRed(this),D=C.redNeg(),F=this.m.subn(1).iushrn(1),J=this.m.bitLength();J=new $(2*J*J).toRed(this);while(this.pow(J,F).cmp(D)!==0)J.redIAdd(D);var O=this.pow(J,G),P=this.pow(Y,G.addn(1).iushrn(1)),R=this.pow(Y,G),_=W;while(R.cmp(C)!==0){var f=R;for(var c=0;f.cmp(C)!==0;c++)f=f.redSqr();K(c<_);var o=this.pow(O,new $(1).iushln(_-c-1));P=P.redMul(o),O=o.redSqr(),R=R.redMul(O),_=c}return P},b.prototype.invm=function(Y){var V=Y._invmp(this.m);if(V.negative!==0)return V.negative=0,this.imod(V).redNeg();else return this.imod(V)},b.prototype.pow=function(Y,V){if(V.isZero())return new $(1).toRed(this);if(V.cmpn(1)===0)return Y.clone();var I=4,G=Array(1<<I);G[0]=new $(1).toRed(this),G[1]=Y;for(var W=2;W<G.length;W++)G[W]=this.mul(G[W-1],Y);var C=G[0],D=0,F=0,J=V.bitLength()%26;if(J===0)J=26;for(W=V.length-1;W>=0;W--){var O=V.words[W];for(var P=J-1;P>=0;P--){var R=O>>P&1;if(C!==G[0])C=this.sqr(C);if(R===0&&D===0){F=0;continue}if(D<<=1,D|=R,F++,F!==I&&(W!==0||P!==0))continue;C=this.mul(C,G[D]),F=0,D=0}J=26}return C},b.prototype.convertTo=function(Y){var V=Y.umod(this.m);return V===Y?V.clone():V},b.prototype.convertFrom=function(Y){var V=Y.clone();return V.red=null,V},$.mont=function(Y){return new i(Y)};function i(Y){if(b.call(this,Y),this.shift=this.m.bitLength(),this.shift%26!==0)this.shift+=26-this.shift%26;this.r=new $(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}H(i,b),i.prototype.convertTo=function(Y){return this.imod(Y.ushln(this.shift))},i.prototype.convertFrom=function(Y){var V=this.imod(Y.mul(this.rinv));return V.red=null,V},i.prototype.imul=function(Y,V){if(Y.isZero()||V.isZero())return Y.words[0]=0,Y.length=1,Y;var I=Y.imul(V),G=I.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),W=I.isub(G).iushrn(this.shift),C=W;if(W.cmp(this.m)>=0)C=W.isub(this.m);else if(W.cmpn(0)<0)C=W.iadd(this.m);return C._forceRed(this)},i.prototype.mul=function(Y,V){if(Y.isZero()||V.isZero())return new $(0)._forceRed(this);var I=Y.mul(V),G=I.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),W=I.isub(G).iushrn(this.shift),C=W;if(W.cmp(this.m)>=0)C=W.isub(this.m);else if(W.cmpn(0)<0)C=W.iadd(this.m);return C._forceRed(this)},i.prototype.invm=function(Y){var V=this.imod(Y._invmp(this.m).mul(this.r2));return V._forceRed(this)}})(typeof Z>"u"||Z,U)}),wH=$0((U,Z)=>{var X=gH(),Q=fH();Z.exports=function(M){return new H(M)};var K={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};K.p224=K.secp224r1,K.p256=K.secp256r1=K.prime256v1,K.p192=K.secp192r1=K.prime192v1,K.p384=K.secp384r1,K.p521=K.secp521r1;function H(M){if(this.curveType=K[M],!this.curveType)this.curveType={name:M};this.curve=new X.ec(this.curveType.name),this.keys=void 0}H.prototype.generateKeys=function(M,q){return this.keys=this.curve.genKeyPair(),this.getPublicKey(M,q)},H.prototype.computeSecret=function(M,q,z){if(q=q||"utf8",!Buffer.isBuffer(M))M=new Buffer(M,q);var T=this.curve.keyFromPublic(M).getPublic(),A=T.mul(this.keys.getPrivate()).getX();return $(A,z,this.curveType.byteLength)},H.prototype.getPublicKey=function(M,q){var z=this.keys.getPublic(q==="compressed",!0);if(q==="hybrid")if(z[z.length-1]%2)z[0]=7;else z[0]=6;return $(z,M)},H.prototype.getPrivateKey=function(M){return $(this.keys.getPrivate(),M)},H.prototype.setPublicKey=function(M,q){if(q=q||"utf8",!Buffer.isBuffer(M))M=new Buffer(M,q);return this.keys._importPublic(M),this},H.prototype.setPrivateKey=function(M,q){if(q=q||"utf8",!Buffer.isBuffer(M))M=new Buffer(M,q);var z=new Q(M);return z=z.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(z),this};function $(M,q,z){if(!Array.isArray(M))M=M.toArray();var T=new Buffer(M);if(z&&T.length<z){var A=new Buffer(z-T.length);A.fill(0),T=Buffer.concat([A,T])}if(!q)return T;else return T.toString(q)}}),yH=$0((U,Z)=>{var X=(UU(),m0(e1)).createECDH;Z.exports=X||wH()}),cH=$0((U,Z)=>{(function(X,Q){function K(Y,V){if(!Y)throw Error(V||"Assertion failed")}function H(Y,V){Y.super_=V;var I=function(){};I.prototype=V.prototype,Y.prototype=new I,Y.prototype.constructor=Y}function $(Y,V,I){if($.isBN(Y))return Y;if(this.negative=0,this.words=null,this.length=0,this.red=null,Y!==null){if(V==="le"||V==="be")I=V,V=10;this._init(Y||0,V||10,I||"be")}}if(typeof X==="object")X.exports=$;else Q.BN=$;$.BN=$,$.wordSize=26;var M;try{if(typeof window<"u"&&typeof window.Buffer<"u")M=window.Buffer;else M=(g1(),m0(N1)).Buffer}catch(Y){}$.isBN=function(Y){if(Y instanceof $)return!0;return Y!==null&&typeof Y==="object"&&Y.constructor.wordSize===$.wordSize&&Array.isArray(Y.words)},$.max=function(Y,V){if(Y.cmp(V)>0)return Y;return V},$.min=function(Y,V){if(Y.cmp(V)<0)return Y;return V},$.prototype._init=function(Y,V,I){if(typeof Y==="number")return this._initNumber(Y,V,I);if(typeof Y==="object")return this._initArray(Y,V,I);if(V==="hex")V=16;K(V===(V|0)&&V>=2&&V<=36),Y=Y.toString().replace(/\s+/g,"");var G=0;if(Y[0]==="-")G++,this.negative=1;if(G<Y.length){if(V===16)this._parseHex(Y,G,I);else if(this._parseBase(Y,V,G),I==="le")this._initArray(this.toArray(),V,I)}},$.prototype._initNumber=function(Y,V,I){if(Y<0)this.negative=1,Y=-Y;if(Y<67108864)this.words=[Y&67108863],this.length=1;else if(Y<4503599627370496)this.words=[Y&67108863,Y/67108864&67108863],this.length=2;else K(Y<9007199254740992),this.words=[Y&67108863,Y/67108864&67108863,1],this.length=3;if(I!=="le")return;this._initArray(this.toArray(),V,I)},$.prototype._initArray=function(Y,V,I){if(K(typeof Y.length==="number"),Y.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(Y.length/3),this.words=Array(this.length);for(var G=0;G<this.length;G++)this.words[G]=0;var W,C,D=0;if(I==="be"){for(G=Y.length-1,W=0;G>=0;G-=3)if(C=Y[G]|Y[G-1]<<8|Y[G-2]<<16,this.words[W]|=C<<D&67108863,this.words[W+1]=C>>>26-D&67108863,D+=24,D>=26)D-=26,W++}else if(I==="le"){for(G=0,W=0;G<Y.length;G+=3)if(C=Y[G]|Y[G+1]<<8|Y[G+2]<<16,this.words[W]|=C<<D&67108863,this.words[W+1]=C>>>26-D&67108863,D+=24,D>=26)D-=26,W++}return this.strip()};function q(Y,V){var I=Y.charCodeAt(V);if(I>=65&&I<=70)return I-55;else if(I>=97&&I<=102)return I-87;else return I-48&15}function z(Y,V,I){var G=q(Y,I);if(I-1>=V)G|=q(Y,I-1)<<4;return G}$.prototype._parseHex=function(Y,V,I){this.length=Math.ceil((Y.length-V)/6),this.words=Array(this.length);for(var G=0;G<this.length;G++)this.words[G]=0;var W=0,C=0,D;if(I==="be")for(G=Y.length-1;G>=V;G-=2)if(D=z(Y,V,G)<<W,this.words[C]|=D&67108863,W>=18)W-=18,C+=1,this.words[C]|=D>>>26;else W+=8;else{var F=Y.length-V;for(G=F%2===0?V+1:V;G<Y.length;G+=2)if(D=z(Y,V,G)<<W,this.words[C]|=D&67108863,W>=18)W-=18,C+=1,this.words[C]|=D>>>26;else W+=8}this.strip()};function T(Y,V,I,G){var W=0,C=Math.min(Y.length,I);for(var D=V;D<C;D++){var F=Y.charCodeAt(D)-48;if(W*=G,F>=49)W+=F-49+10;else if(F>=17)W+=F-17+10;else W+=F}return W}$.prototype._parseBase=function(Y,V,I){this.words=[0],this.length=1;for(var G=0,W=1;W<=67108863;W*=V)G++;G--,W=W/V|0;var C=Y.length-I,D=C%G,F=Math.min(C,C-D)+I,J=0;for(var O=I;O<F;O+=G)if(J=T(Y,O,O+G,V),this.imuln(W),this.words[0]+J<67108864)this.words[0]+=J;else this._iaddn(J);if(D!==0){var P=1;J=T(Y,O,Y.length,V);for(O=0;O<D;O++)P*=V;if(this.imuln(P),this.words[0]+J<67108864)this.words[0]+=J;else this._iaddn(J)}this.strip()},$.prototype.copy=function(Y){Y.words=Array(this.length);for(var V=0;V<this.length;V++)Y.words[V]=this.words[V];Y.length=this.length,Y.negative=this.negative,Y.red=this.red},$.prototype.clone=function(){var Y=new $(null);return this.copy(Y),Y},$.prototype._expand=function(Y){while(this.length<Y)this.words[this.length++]=0;return this},$.prototype.strip=function(){while(this.length>1&&this.words[this.length-1]===0)this.length--;return this._normSign()},$.prototype._normSign=function(){if(this.length===1&&this.words[0]===0)this.negative=0;return this},$.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var A=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],L=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],E=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64000000,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,24300000,28629151,33554432,39135393,45435424,52521875,60466176];if($.prototype.toString=function(Y,V){Y=Y||10,V=V|0||1;var I;if(Y===16||Y==="hex"){I="";var G=0,W=0;for(var C=0;C<this.length;C++){var D=this.words[C],F=((D<<G|W)&16777215).toString(16);if(W=D>>>24-G&16777215,G+=2,G>=26)G-=26,C--;if(W!==0||C!==this.length-1)I=A[6-F.length]+F+I;else I=F+I}if(W!==0)I=W.toString(16)+I;while(I.length%V!==0)I="0"+I;if(this.negative!==0)I="-"+I;return I}if(Y===(Y|0)&&Y>=2&&Y<=36){var J=L[Y],O=E[Y];I="";var P=this.clone();P.negative=0;while(!P.isZero()){var R=P.modn(O).toString(Y);if(P=P.idivn(O),!P.isZero())I=A[J-R.length]+R+I;else I=R+I}if(this.isZero())I="0"+I;while(I.length%V!==0)I="0"+I;if(this.negative!==0)I="-"+I;return I}K(!1,"Base should be between 2 and 36")},$.prototype.toNumber=function(){var Y=this.words[0];if(this.length===2)Y+=this.words[1]*67108864;else if(this.length===3&&this.words[2]===1)Y+=4503599627370496+this.words[1]*67108864;else if(this.length>2)K(!1,"Number can only safely store up to 53 bits");return this.negative!==0?-Y:Y},$.prototype.toJSON=function(){return this.toString(16)},$.prototype.toBuffer=function(Y,V){return K(typeof M<"u"),this.toArrayLike(M,Y,V)},$.prototype.toArray=function(Y,V){return this.toArrayLike(Array,Y,V)},$.prototype.toArrayLike=function(Y,V,I){var G=this.byteLength(),W=I||Math.max(1,G);K(G<=W,"byte array longer than desired length"),K(W>0,"Requested array length <= 0"),this.strip();var C=V==="le",D=new Y(W),F,J,O=this.clone();if(!C){for(J=0;J<W-G;J++)D[J]=0;for(J=0;!O.isZero();J++)F=O.andln(255),O.iushrn(8),D[W-J-1]=F}else{for(J=0;!O.isZero();J++)F=O.andln(255),O.iushrn(8),D[J]=F;for(;J<W;J++)D[J]=0}return D},Math.clz32)$.prototype._countBits=function(Y){return 32-Math.clz32(Y)};else $.prototype._countBits=function(Y){var V=Y,I=0;if(V>=4096)I+=13,V>>>=13;if(V>=64)I+=7,V>>>=7;if(V>=8)I+=4,V>>>=4;if(V>=2)I+=2,V>>>=2;return I+V};$.prototype._zeroBits=function(Y){if(Y===0)return 26;var V=Y,I=0;if((V&8191)===0)I+=13,V>>>=13;if((V&127)===0)I+=7,V>>>=7;if((V&15)===0)I+=4,V>>>=4;if((V&3)===0)I+=2,V>>>=2;if((V&1)===0)I++;return I},$.prototype.bitLength=function(){var Y=this.words[this.length-1],V=this._countBits(Y);return(this.length-1)*26+V};function S(Y){var V=Array(Y.bitLength());for(var I=0;I<V.length;I++){var G=I/26|0,W=I%26;V[I]=(Y.words[G]&1<<W)>>>W}return V}$.prototype.zeroBits=function(){if(this.isZero())return 0;var Y=0;for(var V=0;V<this.length;V++){var I=this._zeroBits(this.words[V]);if(Y+=I,I!==26)break}return Y},$.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},$.prototype.toTwos=function(Y){if(this.negative!==0)return this.abs().inotn(Y).iaddn(1);return this.clone()},$.prototype.fromTwos=function(Y){if(this.testn(Y-1))return this.notn(Y).iaddn(1).ineg();return this.clone()},$.prototype.isNeg=function(){return this.negative!==0},$.prototype.neg=function(){return this.clone().ineg()},$.prototype.ineg=function(){if(!this.isZero())this.negative^=1;return this},$.prototype.iuor=function(Y){while(this.length<Y.length)this.words[this.length++]=0;for(var V=0;V<Y.length;V++)this.words[V]=this.words[V]|Y.words[V];return this.strip()},$.prototype.ior=function(Y){return K((this.negative|Y.negative)===0),this.iuor(Y)},$.prototype.or=function(Y){if(this.length>Y.length)return this.clone().ior(Y);return Y.clone().ior(this)},$.prototype.uor=function(Y){if(this.length>Y.length)return this.clone().iuor(Y);return Y.clone().iuor(this)},$.prototype.iuand=function(Y){var V;if(this.length>Y.length)V=Y;else V=this;for(var I=0;I<V.length;I++)this.words[I]=this.words[I]&Y.words[I];return this.length=V.length,this.strip()},$.prototype.iand=function(Y){return K((this.negative|Y.negative)===0),this.iuand(Y)},$.prototype.and=function(Y){if(this.length>Y.length)return this.clone().iand(Y);return Y.clone().iand(this)},$.prototype.uand=function(Y){if(this.length>Y.length)return this.clone().iuand(Y);return Y.clone().iuand(this)},$.prototype.iuxor=function(Y){var V,I;if(this.length>Y.length)V=this,I=Y;else V=Y,I=this;for(var G=0;G<I.length;G++)this.words[G]=V.words[G]^I.words[G];if(this!==V)for(;G<V.length;G++)this.words[G]=V.words[G];return this.length=V.length,this.strip()},$.prototype.ixor=function(Y){return K((this.negative|Y.negative)===0),this.iuxor(Y)},$.prototype.xor=function(Y){if(this.length>Y.length)return this.clone().ixor(Y);return Y.clone().ixor(this)},$.prototype.uxor=function(Y){if(this.length>Y.length)return this.clone().iuxor(Y);return Y.clone().iuxor(this)},$.prototype.inotn=function(Y){K(typeof Y==="number"&&Y>=0);var V=Math.ceil(Y/26)|0,I=Y%26;if(this._expand(V),I>0)V--;for(var G=0;G<V;G++)this.words[G]=~this.words[G]&67108863;if(I>0)this.words[G]=~this.words[G]&67108863>>26-I;return this.strip()},$.prototype.notn=function(Y){return this.clone().inotn(Y)},$.prototype.setn=function(Y,V){K(typeof Y==="number"&&Y>=0);var I=Y/26|0,G=Y%26;if(this._expand(I+1),V)this.words[I]=this.words[I]|1<<G;else this.words[I]=this.words[I]&~(1<<G);return this.strip()},$.prototype.iadd=function(Y){var V;if(this.negative!==0&&Y.negative===0)return this.negative=0,V=this.isub(Y),this.negative^=1,this._normSign();else if(this.negative===0&&Y.negative!==0)return Y.negative=0,V=this.isub(Y),Y.negative=1,V._normSign();var I,G;if(this.length>Y.length)I=this,G=Y;else I=Y,G=this;var W=0;for(var C=0;C<G.length;C++)V=(I.words[C]|0)+(G.words[C]|0)+W,this.words[C]=V&67108863,W=V>>>26;for(;W!==0&&C<I.length;C++)V=(I.words[C]|0)+W,this.words[C]=V&67108863,W=V>>>26;if(this.length=I.length,W!==0)this.words[this.length]=W,this.length++;else if(I!==this)for(;C<I.length;C++)this.words[C]=I.words[C];return this},$.prototype.add=function(Y){var V;if(Y.negative!==0&&this.negative===0)return Y.negative=0,V=this.sub(Y),Y.negative^=1,V;else if(Y.negative===0&&this.negative!==0)return this.negative=0,V=Y.sub(this),this.negative=1,V;if(this.length>Y.length)return this.clone().iadd(Y);return Y.clone().iadd(this)},$.prototype.isub=function(Y){if(Y.negative!==0){Y.negative=0;var V=this.iadd(Y);return Y.negative=1,V._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(Y),this.negative=1,this._normSign();var I=this.cmp(Y);if(I===0)return this.negative=0,this.length=1,this.words[0]=0,this;var G,W;if(I>0)G=this,W=Y;else G=Y,W=this;var C=0;for(var D=0;D<W.length;D++)V=(G.words[D]|0)-(W.words[D]|0)+C,C=V>>26,this.words[D]=V&67108863;for(;C!==0&&D<G.length;D++)V=(G.words[D]|0)+C,C=V>>26,this.words[D]=V&67108863;if(C===0&&D<G.length&&G!==this)for(;D<G.length;D++)this.words[D]=G.words[D];if(this.length=Math.max(this.length,D),G!==this)this.negative=1;return this.strip()},$.prototype.sub=function(Y){return this.clone().isub(Y)};function j(Y,V,I){I.negative=V.negative^Y.negative;var G=Y.length+V.length|0;I.length=G,G=G-1|0;var W=Y.words[0]|0,C=V.words[0]|0,D=W*C,F=D&67108863,J=D/67108864|0;I.words[0]=F;for(var O=1;O<G;O++){var P=J>>>26,R=J&67108863,_=Math.min(O,V.length-1);for(var f=Math.max(0,O-Y.length+1);f<=_;f++){var c=O-f|0;W=Y.words[c]|0,C=V.words[f]|0,D=W*C+R,P+=D/67108864|0,R=D&67108863}I.words[O]=R|0,J=P|0}if(J!==0)I.words[O]=J|0;else I.length--;return I.strip()}var k=function(Y,V,I){var G=Y.words,W=V.words,C=I.words,D=0,F,J,O,P=G[0]|0,R=P&8191,_=P>>>13,f=G[1]|0,c=f&8191,o=f>>>13,K0=G[2]|0,a=K0&8191,l=K0>>>13,Q0=G[3]|0,n=Q0&8191,s=Q0>>>13,f0=G[4]|0,y=f0&8191,h=f0>>>13,G0=G[5]|0,t=G0&8191,U0=G0>>>13,L0=G[6]|0,p=L0&8191,m=L0>>>13,g0=G[7]|0,r=g0&8191,J0=g0>>>13,h0=G[8]|0,F0=h0&8191,O0=h0>>>13,J1=G[9]|0,I0=J1&8191,C0=J1>>>13,K1=W[0]|0,M0=K1&8191,z0=K1>>>13,d1=W[1]|0,T0=d1&8191,j0=d1>>>13,l1=W[2]|0,v0=l1&8191,R0=l1>>>13,h1=W[3]|0,_0=h1&8191,E0=h1>>>13,_1=W[4]|0,B0=_1&8191,x0=_1>>>13,B1=W[5]|0,S0=B1&8191,g=B1>>>13,d=W[6]|0,e=d&8191,X0=d>>>13,y0=W[7]|0,H0=y0&8191,A0=y0>>>13,Q1=W[8]|0,P0=Q1&8191,N0=Q1>>>13,u1=W[9]|0,k0=u1&8191,q0=u1>>>13;I.negative=Y.negative^V.negative,I.length=19,F=Math.imul(R,M0),J=Math.imul(R,z0),J=J+Math.imul(_,M0)|0,O=Math.imul(_,z0);var G1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(G1>>>26)|0,G1&=67108863,F=Math.imul(c,M0),J=Math.imul(c,z0),J=J+Math.imul(o,M0)|0,O=Math.imul(o,z0),F=F+Math.imul(R,T0)|0,J=J+Math.imul(R,j0)|0,J=J+Math.imul(_,T0)|0,O=O+Math.imul(_,j0)|0;var l0=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(l0>>>26)|0,l0&=67108863,F=Math.imul(a,M0),J=Math.imul(a,z0),J=J+Math.imul(l,M0)|0,O=Math.imul(l,z0),F=F+Math.imul(c,T0)|0,J=J+Math.imul(c,j0)|0,J=J+Math.imul(o,T0)|0,O=O+Math.imul(o,j0)|0,F=F+Math.imul(R,v0)|0,J=J+Math.imul(R,R0)|0,J=J+Math.imul(_,v0)|0,O=O+Math.imul(_,R0)|0;var b0=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(b0>>>26)|0,b0&=67108863,F=Math.imul(n,M0),J=Math.imul(n,z0),J=J+Math.imul(s,M0)|0,O=Math.imul(s,z0),F=F+Math.imul(a,T0)|0,J=J+Math.imul(a,j0)|0,J=J+Math.imul(l,T0)|0,O=O+Math.imul(l,j0)|0,F=F+Math.imul(c,v0)|0,J=J+Math.imul(c,R0)|0,J=J+Math.imul(o,v0)|0,O=O+Math.imul(o,R0)|0,F=F+Math.imul(R,_0)|0,J=J+Math.imul(R,E0)|0,J=J+Math.imul(_,_0)|0,O=O+Math.imul(_,E0)|0;var t0=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(t0>>>26)|0,t0&=67108863,F=Math.imul(y,M0),J=Math.imul(y,z0),J=J+Math.imul(h,M0)|0,O=Math.imul(h,z0),F=F+Math.imul(n,T0)|0,J=J+Math.imul(n,j0)|0,J=J+Math.imul(s,T0)|0,O=O+Math.imul(s,j0)|0,F=F+Math.imul(a,v0)|0,J=J+Math.imul(a,R0)|0,J=J+Math.imul(l,v0)|0,O=O+Math.imul(l,R0)|0,F=F+Math.imul(c,_0)|0,J=J+Math.imul(c,E0)|0,J=J+Math.imul(o,_0)|0,O=O+Math.imul(o,E0)|0,F=F+Math.imul(R,B0)|0,J=J+Math.imul(R,x0)|0,J=J+Math.imul(_,B0)|0,O=O+Math.imul(_,x0)|0;var r0=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(r0>>>26)|0,r0&=67108863,F=Math.imul(t,M0),J=Math.imul(t,z0),J=J+Math.imul(U0,M0)|0,O=Math.imul(U0,z0),F=F+Math.imul(y,T0)|0,J=J+Math.imul(y,j0)|0,J=J+Math.imul(h,T0)|0,O=O+Math.imul(h,j0)|0,F=F+Math.imul(n,v0)|0,J=J+Math.imul(n,R0)|0,J=J+Math.imul(s,v0)|0,O=O+Math.imul(s,R0)|0,F=F+Math.imul(a,_0)|0,J=J+Math.imul(a,E0)|0,J=J+Math.imul(l,_0)|0,O=O+Math.imul(l,E0)|0,F=F+Math.imul(c,B0)|0,J=J+Math.imul(c,x0)|0,J=J+Math.imul(o,B0)|0,O=O+Math.imul(o,x0)|0,F=F+Math.imul(R,S0)|0,J=J+Math.imul(R,g)|0,J=J+Math.imul(_,S0)|0,O=O+Math.imul(_,g)|0;var F1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(F1>>>26)|0,F1&=67108863,F=Math.imul(p,M0),J=Math.imul(p,z0),J=J+Math.imul(m,M0)|0,O=Math.imul(m,z0),F=F+Math.imul(t,T0)|0,J=J+Math.imul(t,j0)|0,J=J+Math.imul(U0,T0)|0,O=O+Math.imul(U0,j0)|0,F=F+Math.imul(y,v0)|0,J=J+Math.imul(y,R0)|0,J=J+Math.imul(h,v0)|0,O=O+Math.imul(h,R0)|0,F=F+Math.imul(n,_0)|0,J=J+Math.imul(n,E0)|0,J=J+Math.imul(s,_0)|0,O=O+Math.imul(s,E0)|0,F=F+Math.imul(a,B0)|0,J=J+Math.imul(a,x0)|0,J=J+Math.imul(l,B0)|0,O=O+Math.imul(l,x0)|0,F=F+Math.imul(c,S0)|0,J=J+Math.imul(c,g)|0,J=J+Math.imul(o,S0)|0,O=O+Math.imul(o,g)|0,F=F+Math.imul(R,e)|0,J=J+Math.imul(R,X0)|0,J=J+Math.imul(_,e)|0,O=O+Math.imul(_,X0)|0;var O1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(O1>>>26)|0,O1&=67108863,F=Math.imul(r,M0),J=Math.imul(r,z0),J=J+Math.imul(J0,M0)|0,O=Math.imul(J0,z0),F=F+Math.imul(p,T0)|0,J=J+Math.imul(p,j0)|0,J=J+Math.imul(m,T0)|0,O=O+Math.imul(m,j0)|0,F=F+Math.imul(t,v0)|0,J=J+Math.imul(t,R0)|0,J=J+Math.imul(U0,v0)|0,O=O+Math.imul(U0,R0)|0,F=F+Math.imul(y,_0)|0,J=J+Math.imul(y,E0)|0,J=J+Math.imul(h,_0)|0,O=O+Math.imul(h,E0)|0,F=F+Math.imul(n,B0)|0,J=J+Math.imul(n,x0)|0,J=J+Math.imul(s,B0)|0,O=O+Math.imul(s,x0)|0,F=F+Math.imul(a,S0)|0,J=J+Math.imul(a,g)|0,J=J+Math.imul(l,S0)|0,O=O+Math.imul(l,g)|0,F=F+Math.imul(c,e)|0,J=J+Math.imul(c,X0)|0,J=J+Math.imul(o,e)|0,O=O+Math.imul(o,X0)|0,F=F+Math.imul(R,H0)|0,J=J+Math.imul(R,A0)|0,J=J+Math.imul(_,H0)|0,O=O+Math.imul(_,A0)|0;var C1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(C1>>>26)|0,C1&=67108863,F=Math.imul(F0,M0),J=Math.imul(F0,z0),J=J+Math.imul(O0,M0)|0,O=Math.imul(O0,z0),F=F+Math.imul(r,T0)|0,J=J+Math.imul(r,j0)|0,J=J+Math.imul(J0,T0)|0,O=O+Math.imul(J0,j0)|0,F=F+Math.imul(p,v0)|0,J=J+Math.imul(p,R0)|0,J=J+Math.imul(m,v0)|0,O=O+Math.imul(m,R0)|0,F=F+Math.imul(t,_0)|0,J=J+Math.imul(t,E0)|0,J=J+Math.imul(U0,_0)|0,O=O+Math.imul(U0,E0)|0,F=F+Math.imul(y,B0)|0,J=J+Math.imul(y,x0)|0,J=J+Math.imul(h,B0)|0,O=O+Math.imul(h,x0)|0,F=F+Math.imul(n,S0)|0,J=J+Math.imul(n,g)|0,J=J+Math.imul(s,S0)|0,O=O+Math.imul(s,g)|0,F=F+Math.imul(a,e)|0,J=J+Math.imul(a,X0)|0,J=J+Math.imul(l,e)|0,O=O+Math.imul(l,X0)|0,F=F+Math.imul(c,H0)|0,J=J+Math.imul(c,A0)|0,J=J+Math.imul(o,H0)|0,O=O+Math.imul(o,A0)|0,F=F+Math.imul(R,P0)|0,J=J+Math.imul(R,N0)|0,J=J+Math.imul(_,P0)|0,O=O+Math.imul(_,N0)|0;var A1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(A1>>>26)|0,A1&=67108863,F=Math.imul(I0,M0),J=Math.imul(I0,z0),J=J+Math.imul(C0,M0)|0,O=Math.imul(C0,z0),F=F+Math.imul(F0,T0)|0,J=J+Math.imul(F0,j0)|0,J=J+Math.imul(O0,T0)|0,O=O+Math.imul(O0,j0)|0,F=F+Math.imul(r,v0)|0,J=J+Math.imul(r,R0)|0,J=J+Math.imul(J0,v0)|0,O=O+Math.imul(J0,R0)|0,F=F+Math.imul(p,_0)|0,J=J+Math.imul(p,E0)|0,J=J+Math.imul(m,_0)|0,O=O+Math.imul(m,E0)|0,F=F+Math.imul(t,B0)|0,J=J+Math.imul(t,x0)|0,J=J+Math.imul(U0,B0)|0,O=O+Math.imul(U0,x0)|0,F=F+Math.imul(y,S0)|0,J=J+Math.imul(y,g)|0,J=J+Math.imul(h,S0)|0,O=O+Math.imul(h,g)|0,F=F+Math.imul(n,e)|0,J=J+Math.imul(n,X0)|0,J=J+Math.imul(s,e)|0,O=O+Math.imul(s,X0)|0,F=F+Math.imul(a,H0)|0,J=J+Math.imul(a,A0)|0,J=J+Math.imul(l,H0)|0,O=O+Math.imul(l,A0)|0,F=F+Math.imul(c,P0)|0,J=J+Math.imul(c,N0)|0,J=J+Math.imul(o,P0)|0,O=O+Math.imul(o,N0)|0,F=F+Math.imul(R,k0)|0,J=J+Math.imul(R,q0)|0,J=J+Math.imul(_,k0)|0,O=O+Math.imul(_,q0)|0;var z1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(z1>>>26)|0,z1&=67108863,F=Math.imul(I0,T0),J=Math.imul(I0,j0),J=J+Math.imul(C0,T0)|0,O=Math.imul(C0,j0),F=F+Math.imul(F0,v0)|0,J=J+Math.imul(F0,R0)|0,J=J+Math.imul(O0,v0)|0,O=O+Math.imul(O0,R0)|0,F=F+Math.imul(r,_0)|0,J=J+Math.imul(r,E0)|0,J=J+Math.imul(J0,_0)|0,O=O+Math.imul(J0,E0)|0,F=F+Math.imul(p,B0)|0,J=J+Math.imul(p,x0)|0,J=J+Math.imul(m,B0)|0,O=O+Math.imul(m,x0)|0,F=F+Math.imul(t,S0)|0,J=J+Math.imul(t,g)|0,J=J+Math.imul(U0,S0)|0,O=O+Math.imul(U0,g)|0,F=F+Math.imul(y,e)|0,J=J+Math.imul(y,X0)|0,J=J+Math.imul(h,e)|0,O=O+Math.imul(h,X0)|0,F=F+Math.imul(n,H0)|0,J=J+Math.imul(n,A0)|0,J=J+Math.imul(s,H0)|0,O=O+Math.imul(s,A0)|0,F=F+Math.imul(a,P0)|0,J=J+Math.imul(a,N0)|0,J=J+Math.imul(l,P0)|0,O=O+Math.imul(l,N0)|0,F=F+Math.imul(c,k0)|0,J=J+Math.imul(c,q0)|0,J=J+Math.imul(o,k0)|0,O=O+Math.imul(o,q0)|0;var D1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(D1>>>26)|0,D1&=67108863,F=Math.imul(I0,v0),J=Math.imul(I0,R0),J=J+Math.imul(C0,v0)|0,O=Math.imul(C0,R0),F=F+Math.imul(F0,_0)|0,J=J+Math.imul(F0,E0)|0,J=J+Math.imul(O0,_0)|0,O=O+Math.imul(O0,E0)|0,F=F+Math.imul(r,B0)|0,J=J+Math.imul(r,x0)|0,J=J+Math.imul(J0,B0)|0,O=O+Math.imul(J0,x0)|0,F=F+Math.imul(p,S0)|0,J=J+Math.imul(p,g)|0,J=J+Math.imul(m,S0)|0,O=O+Math.imul(m,g)|0,F=F+Math.imul(t,e)|0,J=J+Math.imul(t,X0)|0,J=J+Math.imul(U0,e)|0,O=O+Math.imul(U0,X0)|0,F=F+Math.imul(y,H0)|0,J=J+Math.imul(y,A0)|0,J=J+Math.imul(h,H0)|0,O=O+Math.imul(h,A0)|0,F=F+Math.imul(n,P0)|0,J=J+Math.imul(n,N0)|0,J=J+Math.imul(s,P0)|0,O=O+Math.imul(s,N0)|0,F=F+Math.imul(a,k0)|0,J=J+Math.imul(a,q0)|0,J=J+Math.imul(l,k0)|0,O=O+Math.imul(l,q0)|0;var M1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(M1>>>26)|0,M1&=67108863,F=Math.imul(I0,_0),J=Math.imul(I0,E0),J=J+Math.imul(C0,_0)|0,O=Math.imul(C0,E0),F=F+Math.imul(F0,B0)|0,J=J+Math.imul(F0,x0)|0,J=J+Math.imul(O0,B0)|0,O=O+Math.imul(O0,x0)|0,F=F+Math.imul(r,S0)|0,J=J+Math.imul(r,g)|0,J=J+Math.imul(J0,S0)|0,O=O+Math.imul(J0,g)|0,F=F+Math.imul(p,e)|0,J=J+Math.imul(p,X0)|0,J=J+Math.imul(m,e)|0,O=O+Math.imul(m,X0)|0,F=F+Math.imul(t,H0)|0,J=J+Math.imul(t,A0)|0,J=J+Math.imul(U0,H0)|0,O=O+Math.imul(U0,A0)|0,F=F+Math.imul(y,P0)|0,J=J+Math.imul(y,N0)|0,J=J+Math.imul(h,P0)|0,O=O+Math.imul(h,N0)|0,F=F+Math.imul(n,k0)|0,J=J+Math.imul(n,q0)|0,J=J+Math.imul(s,k0)|0,O=O+Math.imul(s,q0)|0;var q1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(q1>>>26)|0,q1&=67108863,F=Math.imul(I0,B0),J=Math.imul(I0,x0),J=J+Math.imul(C0,B0)|0,O=Math.imul(C0,x0),F=F+Math.imul(F0,S0)|0,J=J+Math.imul(F0,g)|0,J=J+Math.imul(O0,S0)|0,O=O+Math.imul(O0,g)|0,F=F+Math.imul(r,e)|0,J=J+Math.imul(r,X0)|0,J=J+Math.imul(J0,e)|0,O=O+Math.imul(J0,X0)|0,F=F+Math.imul(p,H0)|0,J=J+Math.imul(p,A0)|0,J=J+Math.imul(m,H0)|0,O=O+Math.imul(m,A0)|0,F=F+Math.imul(t,P0)|0,J=J+Math.imul(t,N0)|0,J=J+Math.imul(U0,P0)|0,O=O+Math.imul(U0,N0)|0,F=F+Math.imul(y,k0)|0,J=J+Math.imul(y,q0)|0,J=J+Math.imul(h,k0)|0,O=O+Math.imul(h,q0)|0;var L1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(L1>>>26)|0,L1&=67108863,F=Math.imul(I0,S0),J=Math.imul(I0,g),J=J+Math.imul(C0,S0)|0,O=Math.imul(C0,g),F=F+Math.imul(F0,e)|0,J=J+Math.imul(F0,X0)|0,J=J+Math.imul(O0,e)|0,O=O+Math.imul(O0,X0)|0,F=F+Math.imul(r,H0)|0,J=J+Math.imul(r,A0)|0,J=J+Math.imul(J0,H0)|0,O=O+Math.imul(J0,A0)|0,F=F+Math.imul(p,P0)|0,J=J+Math.imul(p,N0)|0,J=J+Math.imul(m,P0)|0,O=O+Math.imul(m,N0)|0,F=F+Math.imul(t,k0)|0,J=J+Math.imul(t,q0)|0,J=J+Math.imul(U0,k0)|0,O=O+Math.imul(U0,q0)|0;var T1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(T1>>>26)|0,T1&=67108863,F=Math.imul(I0,e),J=Math.imul(I0,X0),J=J+Math.imul(C0,e)|0,O=Math.imul(C0,X0),F=F+Math.imul(F0,H0)|0,J=J+Math.imul(F0,A0)|0,J=J+Math.imul(O0,H0)|0,O=O+Math.imul(O0,A0)|0,F=F+Math.imul(r,P0)|0,J=J+Math.imul(r,N0)|0,J=J+Math.imul(J0,P0)|0,O=O+Math.imul(J0,N0)|0,F=F+Math.imul(p,k0)|0,J=J+Math.imul(p,q0)|0,J=J+Math.imul(m,k0)|0,O=O+Math.imul(m,q0)|0;var R1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(R1>>>26)|0,R1&=67108863,F=Math.imul(I0,H0),J=Math.imul(I0,A0),J=J+Math.imul(C0,H0)|0,O=Math.imul(C0,A0),F=F+Math.imul(F0,P0)|0,J=J+Math.imul(F0,N0)|0,J=J+Math.imul(O0,P0)|0,O=O+Math.imul(O0,N0)|0,F=F+Math.imul(r,k0)|0,J=J+Math.imul(r,q0)|0,J=J+Math.imul(J0,k0)|0,O=O+Math.imul(J0,q0)|0;var E1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(E1>>>26)|0,E1&=67108863,F=Math.imul(I0,P0),J=Math.imul(I0,N0),J=J+Math.imul(C0,P0)|0,O=Math.imul(C0,N0),F=F+Math.imul(F0,k0)|0,J=J+Math.imul(F0,q0)|0,J=J+Math.imul(O0,k0)|0,O=O+Math.imul(O0,q0)|0;var S1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(S1>>>26)|0,S1&=67108863,F=Math.imul(I0,k0),J=Math.imul(I0,q0),J=J+Math.imul(C0,k0)|0,O=Math.imul(C0,q0);var P1=(D+F|0)+((J&8191)<<13)|0;if(D=(O+(J>>>13)|0)+(P1>>>26)|0,P1&=67108863,C[0]=G1,C[1]=l0,C[2]=b0,C[3]=t0,C[4]=r0,C[5]=F1,C[6]=O1,C[7]=C1,C[8]=A1,C[9]=z1,C[10]=D1,C[11]=M1,C[12]=q1,C[13]=L1,C[14]=T1,C[15]=R1,C[16]=E1,C[17]=S1,C[18]=P1,D!==0)C[19]=D,I.length++;return I};if(!Math.imul)k=j;function B(Y,V,I){I.negative=V.negative^Y.negative,I.length=Y.length+V.length;var G=0,W=0;for(var C=0;C<I.length-1;C++){var D=W;W=0;var F=G&67108863,J=Math.min(C,V.length-1);for(var O=Math.max(0,C-Y.length+1);O<=J;O++){var P=C-O,R=Y.words[P]|0,_=V.words[O]|0,f=R*_,c=f&67108863;D=D+(f/67108864|0)|0,c=c+F|0,F=c&67108863,D=D+(c>>>26)|0,W+=D>>>26,D&=67108863}I.words[C]=F,G=D,D=W}if(G!==0)I.words[C]=G;else I.length--;return I.strip()}function v(Y,V,I){var G=new x;return G.mulp(Y,V,I)}$.prototype.mulTo=function(Y,V){var I,G=this.length+Y.length;if(this.length===10&&Y.length===10)I=k(this,Y,V);else if(G<63)I=j(this,Y,V);else if(G<1024)I=B(this,Y,V);else I=v(this,Y,V);return I};function x(Y,V){this.x=Y,this.y=V}x.prototype.makeRBT=function(Y){var V=Array(Y),I=$.prototype._countBits(Y)-1;for(var G=0;G<Y;G++)V[G]=this.revBin(G,I,Y);return V},x.prototype.revBin=function(Y,V,I){if(Y===0||Y===I-1)return Y;var G=0;for(var W=0;W<V;W++)G|=(Y&1)<<V-W-1,Y>>=1;return G},x.prototype.permute=function(Y,V,I,G,W,C){for(var D=0;D<C;D++)G[D]=V[Y[D]],W[D]=I[Y[D]]},x.prototype.transform=function(Y,V,I,G,W,C){this.permute(C,Y,V,I,G,W);for(var D=1;D<W;D<<=1){var F=D<<1,J=Math.cos(2*Math.PI/F),O=Math.sin(2*Math.PI/F);for(var P=0;P<W;P+=F){var R=J,_=O;for(var f=0;f<D;f++){var c=I[P+f],o=G[P+f],K0=I[P+f+D],a=G[P+f+D],l=R*K0-_*a;if(a=R*a+_*K0,K0=l,I[P+f]=c+K0,G[P+f]=o+a,I[P+f+D]=c-K0,G[P+f+D]=o-a,f!==F)l=J*R-O*_,_=J*_+O*R,R=l}}}},x.prototype.guessLen13b=function(Y,V){var I=Math.max(V,Y)|1,G=I&1,W=0;for(I=I/2|0;I;I=I>>>1)W++;return 1<<W+1+G},x.prototype.conjugate=function(Y,V,I){if(I<=1)return;for(var G=0;G<I/2;G++){var W=Y[G];Y[G]=Y[I-G-1],Y[I-G-1]=W,W=V[G],V[G]=-V[I-G-1],V[I-G-1]=-W}},x.prototype.normalize13b=function(Y,V){var I=0;for(var G=0;G<V/2;G++){var W=Math.round(Y[2*G+1]/V)*8192+Math.round(Y[2*G]/V)+I;if(Y[G]=W&67108863,W<67108864)I=0;else I=W/67108864|0}return Y},x.prototype.convert13b=function(Y,V,I,G){var W=0;for(var C=0;C<V;C++)W=W+(Y[C]|0),I[2*C]=W&8191,W=W>>>13,I[2*C+1]=W&8191,W=W>>>13;for(C=2*V;C<G;++C)I[C]=0;K(W===0),K((W&-8192)===0)},x.prototype.stub=function(Y){var V=Array(Y);for(var I=0;I<Y;I++)V[I]=0;return V},x.prototype.mulp=function(Y,V,I){var G=2*this.guessLen13b(Y.length,V.length),W=this.makeRBT(G),C=this.stub(G),D=Array(G),F=Array(G),J=Array(G),O=Array(G),P=Array(G),R=Array(G),_=I.words;_.length=G,this.convert13b(Y.words,Y.length,D,G),this.convert13b(V.words,V.length,O,G),this.transform(D,C,F,J,G,W),this.transform(O,C,P,R,G,W);for(var f=0;f<G;f++){var c=F[f]*P[f]-J[f]*R[f];J[f]=F[f]*R[f]+J[f]*P[f],F[f]=c}return this.conjugate(F,J,G),this.transform(F,J,_,C,G,W),this.conjugate(_,C,G),this.normalize13b(_,G),I.negative=Y.negative^V.negative,I.length=Y.length+V.length,I.strip()},$.prototype.mul=function(Y){var V=new $(null);return V.words=Array(this.length+Y.length),this.mulTo(Y,V)},$.prototype.mulf=function(Y){var V=new $(null);return V.words=Array(this.length+Y.length),v(this,Y,V)},$.prototype.imul=function(Y){return this.clone().mulTo(Y,this)},$.prototype.imuln=function(Y){K(typeof Y==="number"),K(Y<67108864);var V=0;for(var I=0;I<this.length;I++){var G=(this.words[I]|0)*Y,W=(G&67108863)+(V&67108863);V>>=26,V+=G/67108864|0,V+=W>>>26,this.words[I]=W&67108863}if(V!==0)this.words[I]=V,this.length++;return this.length=Y===0?1:this.length,this},$.prototype.muln=function(Y){return this.clone().imuln(Y)},$.prototype.sqr=function(){return this.mul(this)},$.prototype.isqr=function(){return this.imul(this.clone())},$.prototype.pow=function(Y){var V=S(Y);if(V.length===0)return new $(1);var I=this;for(var G=0;G<V.length;G++,I=I.sqr())if(V[G]!==0)break;if(++G<V.length)for(var W=I.sqr();G<V.length;G++,W=W.sqr()){if(V[G]===0)continue;I=I.mul(W)}return I},$.prototype.iushln=function(Y){K(typeof Y==="number"&&Y>=0);var V=Y%26,I=(Y-V)/26,G=67108863>>>26-V<<26-V,W;if(V!==0){var C=0;for(W=0;W<this.length;W++){var D=this.words[W]&G,F=(this.words[W]|0)-D<<V;this.words[W]=F|C,C=D>>>26-V}if(C)this.words[W]=C,this.length++}if(I!==0){for(W=this.length-1;W>=0;W--)this.words[W+I]=this.words[W];for(W=0;W<I;W++)this.words[W]=0;this.length+=I}return this.strip()},$.prototype.ishln=function(Y){return K(this.negative===0),this.iushln(Y)},$.prototype.iushrn=function(Y,V,I){K(typeof Y==="number"&&Y>=0);var G;if(V)G=(V-V%26)/26;else G=0;var W=Y%26,C=Math.min((Y-W)/26,this.length),D=67108863^67108863>>>W<<W,F=I;if(G-=C,G=Math.max(0,G),F){for(var J=0;J<C;J++)F.words[J]=this.words[J];F.length=C}if(C===0);else if(this.length>C){this.length-=C;for(J=0;J<this.length;J++)this.words[J]=this.words[J+C]}else this.words[0]=0,this.length=1;var O=0;for(J=this.length-1;J>=0&&(O!==0||J>=G);J--){var P=this.words[J]|0;this.words[J]=O<<26-W|P>>>W,O=P&D}if(F&&O!==0)F.words[F.length++]=O;if(this.length===0)this.words[0]=0,this.length=1;return this.strip()},$.prototype.ishrn=function(Y,V,I){return K(this.negative===0),this.iushrn(Y,V,I)},$.prototype.shln=function(Y){return this.clone().ishln(Y)},$.prototype.ushln=function(Y){return this.clone().iushln(Y)},$.prototype.shrn=function(Y){return this.clone().ishrn(Y)},$.prototype.ushrn=function(Y){return this.clone().iushrn(Y)},$.prototype.testn=function(Y){K(typeof Y==="number"&&Y>=0);var V=Y%26,I=(Y-V)/26,G=1<<V;if(this.length<=I)return!1;var W=this.words[I];return!!(W&G)},$.prototype.imaskn=function(Y){K(typeof Y==="number"&&Y>=0);var V=Y%26,I=(Y-V)/26;if(K(this.negative===0,"imaskn works only with positive numbers"),this.length<=I)return this;if(V!==0)I++;if(this.length=Math.min(I,this.length),V!==0){var G=67108863^67108863>>>V<<V;this.words[this.length-1]&=G}return this.strip()},$.prototype.maskn=function(Y){return this.clone().imaskn(Y)},$.prototype.iaddn=function(Y){if(K(typeof Y==="number"),K(Y<67108864),Y<0)return this.isubn(-Y);if(this.negative!==0){if(this.length===1&&(this.words[0]|0)<Y)return this.words[0]=Y-(this.words[0]|0),this.negative=0,this;return this.negative=0,this.isubn(Y),this.negative=1,this}return this._iaddn(Y)},$.prototype._iaddn=function(Y){this.words[0]+=Y;for(var V=0;V<this.length&&this.words[V]>=67108864;V++)if(this.words[V]-=67108864,V===this.length-1)this.words[V+1]=1;else this.words[V+1]++;return this.length=Math.max(this.length,V+1),this},$.prototype.isubn=function(Y){if(K(typeof Y==="number"),K(Y<67108864),Y<0)return this.iaddn(-Y);if(this.negative!==0)return this.negative=0,this.iaddn(Y),this.negative=1,this;if(this.words[0]-=Y,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var V=0;V<this.length&&this.words[V]<0;V++)this.words[V]+=67108864,this.words[V+1]-=1;return this.strip()},$.prototype.addn=function(Y){return this.clone().iaddn(Y)},$.prototype.subn=function(Y){return this.clone().isubn(Y)},$.prototype.iabs=function(){return this.negative=0,this},$.prototype.abs=function(){return this.clone().iabs()},$.prototype._ishlnsubmul=function(Y,V,I){var G=Y.length+I,W;this._expand(G);var C,D=0;for(W=0;W<Y.length;W++){C=(this.words[W+I]|0)+D;var F=(Y.words[W]|0)*V;C-=F&67108863,D=(C>>26)-(F/67108864|0),this.words[W+I]=C&67108863}for(;W<this.length-I;W++)C=(this.words[W+I]|0)+D,D=C>>26,this.words[W+I]=C&67108863;if(D===0)return this.strip();K(D===-1),D=0;for(W=0;W<this.length;W++)C=-(this.words[W]|0)+D,D=C>>26,this.words[W]=C&67108863;return this.negative=1,this.strip()},$.prototype._wordDiv=function(Y,V){var I=this.length-Y.length,G=this.clone(),W=Y,C=W.words[W.length-1]|0,D=this._countBits(C);if(I=26-D,I!==0)W=W.ushln(I),G.iushln(I),C=W.words[W.length-1]|0;var F=G.length-W.length,J;if(V!=="mod"){J=new $(null),J.length=F+1,J.words=Array(J.length);for(var O=0;O<J.length;O++)J.words[O]=0}var P=G.clone()._ishlnsubmul(W,1,F);if(P.negative===0){if(G=P,J)J.words[F]=1}for(var R=F-1;R>=0;R--){var _=(G.words[W.length+R]|0)*67108864+(G.words[W.length+R-1]|0);_=Math.min(_/C|0,67108863),G._ishlnsubmul(W,_,R);while(G.negative!==0)if(_--,G.negative=0,G._ishlnsubmul(W,1,R),!G.isZero())G.negative^=1;if(J)J.words[R]=_}if(J)J.strip();if(G.strip(),V!=="div"&&I!==0)G.iushrn(I);return{div:J||null,mod:G}},$.prototype.divmod=function(Y,V,I){if(K(!Y.isZero()),this.isZero())return{div:new $(0),mod:new $(0)};var G,W,C;if(this.negative!==0&&Y.negative===0){if(C=this.neg().divmod(Y,V),V!=="mod")G=C.div.neg();if(V!=="div"){if(W=C.mod.neg(),I&&W.negative!==0)W.iadd(Y)}return{div:G,mod:W}}if(this.negative===0&&Y.negative!==0){if(C=this.divmod(Y.neg(),V),V!=="mod")G=C.div.neg();return{div:G,mod:C.mod}}if((this.negative&Y.negative)!==0){if(C=this.neg().divmod(Y.neg(),V),V!=="div"){if(W=C.mod.neg(),I&&W.negative!==0)W.isub(Y)}return{div:C.div,mod:W}}if(Y.length>this.length||this.cmp(Y)<0)return{div:new $(0),mod:this};if(Y.length===1){if(V==="div")return{div:this.divn(Y.words[0]),mod:null};if(V==="mod")return{div:null,mod:new $(this.modn(Y.words[0]))};return{div:this.divn(Y.words[0]),mod:new $(this.modn(Y.words[0]))}}return this._wordDiv(Y,V)},$.prototype.div=function(Y){return this.divmod(Y,"div",!1).div},$.prototype.mod=function(Y){return this.divmod(Y,"mod",!1).mod},$.prototype.umod=function(Y){return this.divmod(Y,"mod",!0).mod},$.prototype.divRound=function(Y){var V=this.divmod(Y);if(V.mod.isZero())return V.div;var I=V.div.negative!==0?V.mod.isub(Y):V.mod,G=Y.ushrn(1),W=Y.andln(1),C=I.cmp(G);if(C<0||W===1&&C===0)return V.div;return V.div.negative!==0?V.div.isubn(1):V.div.iaddn(1)},$.prototype.modn=function(Y){K(Y<=67108863);var V=67108864%Y,I=0;for(var G=this.length-1;G>=0;G--)I=(V*I+(this.words[G]|0))%Y;return I},$.prototype.idivn=function(Y){K(Y<=67108863);var V=0;for(var I=this.length-1;I>=0;I--){var G=(this.words[I]|0)+V*67108864;this.words[I]=G/Y|0,V=G%Y}return this.strip()},$.prototype.divn=function(Y){return this.clone().idivn(Y)},$.prototype.egcd=function(Y){K(Y.negative===0),K(!Y.isZero());var V=this,I=Y.clone();if(V.negative!==0)V=V.umod(Y);else V=V.clone();var G=new $(1),W=new $(0),C=new $(0),D=new $(1),F=0;while(V.isEven()&&I.isEven())V.iushrn(1),I.iushrn(1),++F;var J=I.clone(),O=V.clone();while(!V.isZero()){for(var P=0,R=1;(V.words[0]&R)===0&&P<26;++P,R<<=1);if(P>0){V.iushrn(P);while(P-- >0){if(G.isOdd()||W.isOdd())G.iadd(J),W.isub(O);G.iushrn(1),W.iushrn(1)}}for(var _=0,f=1;(I.words[0]&f)===0&&_<26;++_,f<<=1);if(_>0){I.iushrn(_);while(_-- >0){if(C.isOdd()||D.isOdd())C.iadd(J),D.isub(O);C.iushrn(1),D.iushrn(1)}}if(V.cmp(I)>=0)V.isub(I),G.isub(C),W.isub(D);else I.isub(V),C.isub(G),D.isub(W)}return{a:C,b:D,gcd:I.iushln(F)}},$.prototype._invmp=function(Y){K(Y.negative===0),K(!Y.isZero());var V=this,I=Y.clone();if(V.negative!==0)V=V.umod(Y);else V=V.clone();var G=new $(1),W=new $(0),C=I.clone();while(V.cmpn(1)>0&&I.cmpn(1)>0){for(var D=0,F=1;(V.words[0]&F)===0&&D<26;++D,F<<=1);if(D>0){V.iushrn(D);while(D-- >0){if(G.isOdd())G.iadd(C);G.iushrn(1)}}for(var J=0,O=1;(I.words[0]&O)===0&&J<26;++J,O<<=1);if(J>0){I.iushrn(J);while(J-- >0){if(W.isOdd())W.iadd(C);W.iushrn(1)}}if(V.cmp(I)>=0)V.isub(I),G.isub(W);else I.isub(V),W.isub(G)}var P;if(V.cmpn(1)===0)P=G;else P=W;if(P.cmpn(0)<0)P.iadd(Y);return P},$.prototype.gcd=function(Y){if(this.isZero())return Y.abs();if(Y.isZero())return this.abs();var V=this.clone(),I=Y.clone();V.negative=0,I.negative=0;for(var G=0;V.isEven()&&I.isEven();G++)V.iushrn(1),I.iushrn(1);do{while(V.isEven())V.iushrn(1);while(I.isEven())I.iushrn(1);var W=V.cmp(I);if(W<0){var C=V;V=I,I=C}else if(W===0||I.cmpn(1)===0)break;V.isub(I)}while(!0);return I.iushln(G)},$.prototype.invm=function(Y){return this.egcd(Y).a.umod(Y)},$.prototype.isEven=function(){return(this.words[0]&1)===0},$.prototype.isOdd=function(){return(this.words[0]&1)===1},$.prototype.andln=function(Y){return this.words[0]&Y},$.prototype.bincn=function(Y){K(typeof Y==="number");var V=Y%26,I=(Y-V)/26,G=1<<V;if(this.length<=I)return this._expand(I+1),this.words[I]|=G,this;var W=G;for(var C=I;W!==0&&C<this.length;C++){var D=this.words[C]|0;D+=W,W=D>>>26,D&=67108863,this.words[C]=D}if(W!==0)this.words[C]=W,this.length++;return this},$.prototype.isZero=function(){return this.length===1&&this.words[0]===0},$.prototype.cmpn=function(Y){var V=Y<0;if(this.negative!==0&&!V)return-1;if(this.negative===0&&V)return 1;this.strip();var I;if(this.length>1)I=1;else{if(V)Y=-Y;K(Y<=67108863,"Number is too big");var G=this.words[0]|0;I=G===Y?0:G<Y?-1:1}if(this.negative!==0)return-I|0;return I},$.prototype.cmp=function(Y){if(this.negative!==0&&Y.negative===0)return-1;if(this.negative===0&&Y.negative!==0)return 1;var V=this.ucmp(Y);if(this.negative!==0)return-V|0;return V},$.prototype.ucmp=function(Y){if(this.length>Y.length)return 1;if(this.length<Y.length)return-1;var V=0;for(var I=this.length-1;I>=0;I--){var G=this.words[I]|0,W=Y.words[I]|0;if(G===W)continue;if(G<W)V=-1;else if(G>W)V=1;break}return V},$.prototype.gtn=function(Y){return this.cmpn(Y)===1},$.prototype.gt=function(Y){return this.cmp(Y)===1},$.prototype.gten=function(Y){return this.cmpn(Y)>=0},$.prototype.gte=function(Y){return this.cmp(Y)>=0},$.prototype.ltn=function(Y){return this.cmpn(Y)===-1},$.prototype.lt=function(Y){return this.cmp(Y)===-1},$.prototype.lten=function(Y){return this.cmpn(Y)<=0},$.prototype.lte=function(Y){return this.cmp(Y)<=0},$.prototype.eqn=function(Y){return this.cmpn(Y)===0},$.prototype.eq=function(Y){return this.cmp(Y)===0},$.red=function(Y){return new b(Y)},$.prototype.toRed=function(Y){return K(!this.red,"Already a number in reduction context"),K(this.negative===0,"red works only with positives"),Y.convertTo(this)._forceRed(Y)},$.prototype.fromRed=function(){return K(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},$.prototype._forceRed=function(Y){return this.red=Y,this},$.prototype.forceRed=function(Y){return K(!this.red,"Already a number in reduction context"),this._forceRed(Y)},$.prototype.redAdd=function(Y){return K(this.red,"redAdd works only with red numbers"),this.red.add(this,Y)},$.prototype.redIAdd=function(Y){return K(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,Y)},$.prototype.redSub=function(Y){return K(this.red,"redSub works only with red numbers"),this.red.sub(this,Y)},$.prototype.redISub=function(Y){return K(this.red,"redISub works only with red numbers"),this.red.isub(this,Y)},$.prototype.redShl=function(Y){return K(this.red,"redShl works only with red numbers"),this.red.shl(this,Y)},$.prototype.redMul=function(Y){return K(this.red,"redMul works only with red numbers"),this.red._verify2(this,Y),this.red.mul(this,Y)},$.prototype.redIMul=function(Y){return K(this.red,"redMul works only with red numbers"),this.red._verify2(this,Y),this.red.imul(this,Y)},$.prototype.redSqr=function(){return K(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},$.prototype.redISqr=function(){return K(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},$.prototype.redSqrt=function(){return K(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},$.prototype.redInvm=function(){return K(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},$.prototype.redNeg=function(){return K(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},$.prototype.redPow=function(Y){return K(this.red&&!Y.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,Y)};var N={k256:null,p224:null,p192:null,p25519:null};function w(Y,V){this.name=Y,this.p=new $(V,16),this.n=this.p.bitLength(),this.k=new $(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}w.prototype._tmp=function(){var Y=new $(null);return Y.words=Array(Math.ceil(this.n/13)),Y},w.prototype.ireduce=function(Y){var V=Y,I;do this.split(V,this.tmp),V=this.imulK(V),V=V.iadd(this.tmp),I=V.bitLength();while(I>this.n);var G=I<this.n?-1:V.ucmp(this.p);if(G===0)V.words[0]=0,V.length=1;else if(G>0)V.isub(this.p);else if(V.strip!==void 0)V.strip();else V._strip();return V},w.prototype.split=function(Y,V){Y.iushrn(this.n,0,V)},w.prototype.imulK=function(Y){return Y.imul(this.k)};function u(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}H(u,w),u.prototype.split=function(Y,V){var I=4194303,G=Math.min(Y.length,9);for(var W=0;W<G;W++)V.words[W]=Y.words[W];if(V.length=G,Y.length<=9){Y.words[0]=0,Y.length=1;return}var C=Y.words[9];V.words[V.length++]=C&I;for(W=10;W<Y.length;W++){var D=Y.words[W]|0;Y.words[W-10]=(D&I)<<4|C>>>22,C=D}if(C>>>=22,Y.words[W-10]=C,C===0&&Y.length>10)Y.length-=10;else Y.length-=9},u.prototype.imulK=function(Y){Y.words[Y.length]=0,Y.words[Y.length+1]=0,Y.length+=2;var V=0;for(var I=0;I<Y.length;I++){var G=Y.words[I]|0;V+=G*977,Y.words[I]=V&67108863,V=G*64+(V/67108864|0)}if(Y.words[Y.length-1]===0){if(Y.length--,Y.words[Y.length-1]===0)Y.length--}return Y};function Z0(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}H(Z0,w);function V0(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}H(V0,w);function Y0(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}H(Y0,w),Y0.prototype.imulK=function(Y){var V=0;for(var I=0;I<Y.length;I++){var G=(Y.words[I]|0)*19+V,W=G&67108863;G>>>=26,Y.words[I]=W,V=G}if(V!==0)Y.words[Y.length++]=V;return Y},$._prime=function(Y){if(N[Y])return N[Y];var V;if(Y==="k256")V=new u;else if(Y==="p224")V=new Z0;else if(Y==="p192")V=new V0;else if(Y==="p25519")V=new Y0;else throw Error("Unknown prime "+Y);return N[Y]=V,V};function b(Y){if(typeof Y==="string"){var V=$._prime(Y);this.m=V.p,this.prime=V}else K(Y.gtn(1),"modulus must be greater than 1"),this.m=Y,this.prime=null}b.prototype._verify1=function(Y){K(Y.negative===0,"red works only with positives"),K(Y.red,"red works only with red numbers")},b.prototype._verify2=function(Y,V){K((Y.negative|V.negative)===0,"red works only with positives"),K(Y.red&&Y.red===V.red,"red works only with red numbers")},b.prototype.imod=function(Y){if(this.prime)return this.prime.ireduce(Y)._forceRed(this);return Y.umod(this.m)._forceRed(this)},b.prototype.neg=function(Y){if(Y.isZero())return Y.clone();return this.m.sub(Y)._forceRed(this)},b.prototype.add=function(Y,V){this._verify2(Y,V);var I=Y.add(V);if(I.cmp(this.m)>=0)I.isub(this.m);return I._forceRed(this)},b.prototype.iadd=function(Y,V){this._verify2(Y,V);var I=Y.iadd(V);if(I.cmp(this.m)>=0)I.isub(this.m);return I},b.prototype.sub=function(Y,V){this._verify2(Y,V);var I=Y.sub(V);if(I.cmpn(0)<0)I.iadd(this.m);return I._forceRed(this)},b.prototype.isub=function(Y,V){this._verify2(Y,V);var I=Y.isub(V);if(I.cmpn(0)<0)I.iadd(this.m);return I},b.prototype.shl=function(Y,V){return this._verify1(Y),this.imod(Y.ushln(V))},b.prototype.imul=function(Y,V){return this._verify2(Y,V),this.imod(Y.imul(V))},b.prototype.mul=function(Y,V){return this._verify2(Y,V),this.imod(Y.mul(V))},b.prototype.isqr=function(Y){return this.imul(Y,Y.clone())},b.prototype.sqr=function(Y){return this.mul(Y,Y)},b.prototype.sqrt=function(Y){if(Y.isZero())return Y.clone();var V=this.m.andln(3);if(K(V%2===1),V===3){var I=this.m.add(new $(1)).iushrn(2);return this.pow(Y,I)}var G=this.m.subn(1),W=0;while(!G.isZero()&&G.andln(1)===0)W++,G.iushrn(1);K(!G.isZero());var C=new $(1).toRed(this),D=C.redNeg(),F=this.m.subn(1).iushrn(1),J=this.m.bitLength();J=new $(2*J*J).toRed(this);while(this.pow(J,F).cmp(D)!==0)J.redIAdd(D);var O=this.pow(J,G),P=this.pow(Y,G.addn(1).iushrn(1)),R=this.pow(Y,G),_=W;while(R.cmp(C)!==0){var f=R;for(var c=0;f.cmp(C)!==0;c++)f=f.redSqr();K(c<_);var o=this.pow(O,new $(1).iushln(_-c-1));P=P.redMul(o),O=o.redSqr(),R=R.redMul(O),_=c}return P},b.prototype.invm=function(Y){var V=Y._invmp(this.m);if(V.negative!==0)return V.negative=0,this.imod(V).redNeg();else return this.imod(V)},b.prototype.pow=function(Y,V){if(V.isZero())return new $(1).toRed(this);if(V.cmpn(1)===0)return Y.clone();var I=4,G=Array(1<<I);G[0]=new $(1).toRed(this),G[1]=Y;for(var W=2;W<G.length;W++)G[W]=this.mul(G[W-1],Y);var C=G[0],D=0,F=0,J=V.bitLength()%26;if(J===0)J=26;for(W=V.length-1;W>=0;W--){var O=V.words[W];for(var P=J-1;P>=0;P--){var R=O>>P&1;if(C!==G[0])C=this.sqr(C);if(R===0&&D===0){F=0;continue}if(D<<=1,D|=R,F++,F!==I&&(W!==0||P!==0))continue;C=this.mul(C,G[D]),F=0,D=0}J=26}return C},b.prototype.convertTo=function(Y){var V=Y.umod(this.m);return V===Y?V.clone():V},b.prototype.convertFrom=function(Y){var V=Y.clone();return V.red=null,V},$.mont=function(Y){return new i(Y)};function i(Y){if(b.call(this,Y),this.shift=this.m.bitLength(),this.shift%26!==0)this.shift+=26-this.shift%26;this.r=new $(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}H(i,b),i.prototype.convertTo=function(Y){return this.imod(Y.ushln(this.shift))},i.prototype.convertFrom=function(Y){var V=this.imod(Y.mul(this.rinv));return V.red=null,V},i.prototype.imul=function(Y,V){if(Y.isZero()||V.isZero())return Y.words[0]=0,Y.length=1,Y;var I=Y.imul(V),G=I.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),W=I.isub(G).iushrn(this.shift),C=W;if(W.cmp(this.m)>=0)C=W.isub(this.m);else if(W.cmpn(0)<0)C=W.iadd(this.m);return C._forceRed(this)},i.prototype.mul=function(Y,V){if(Y.isZero()||V.isZero())return new $(0)._forceRed(this);var I=Y.mul(V),G=I.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),W=I.isub(G).iushrn(this.shift),C=W;if(W.cmp(this.m)>=0)C=W.isub(this.m);else if(W.cmpn(0)<0)C=W.iadd(this.m);return C._forceRed(this)},i.prototype.invm=function(Y){var V=this.imod(Y._invmp(this.m).mul(this.r2));return V._forceRed(this)}})(typeof Z>"u"||Z,U)}),pH=$0((U)=>{var Z=uZ(),X=YU(),Q=U;Q.define=function(H,$){return new K(H,$)};function K(H,$){this.name=H,this.body=$,this.decoders={},this.encoders={}}K.prototype._createNamed=function(H){var $;try{$=(()=>{throw new Error("Cannot require module "+"vm");})().runInThisContext("(function "+this.name+`(entity) {
|
|
11
|
+
`)+" "+X[1];return X[0]+Z+" "+U.join(", ")+" "+X[1]}function GG(U){return Array.isArray(U)}function yY(U){return typeof U==="boolean"}function RX(U){return U===null}function XI(U){return U==null}function VG(U){return typeof U==="number"}function EX(U){return typeof U==="string"}function YI(U){return typeof U==="symbol"}function CZ(U){return U===void 0}function qX(U){return AZ(U)&&cY(U)==="[object RegExp]"}function AZ(U){return typeof U==="object"&&U!==null}function fY(U){return AZ(U)&&cY(U)==="[object Date]"}function MX(U){return AZ(U)&&(cY(U)==="[object Error]"||U instanceof Error)}function LX(U){return typeof U==="function"}function JI(U){return U===null||typeof U==="boolean"||typeof U==="number"||typeof U==="string"||typeof U==="symbol"||typeof U>"u"}function QI(U){return U instanceof Buffer}function cY(U){return Object.prototype.toString.call(U)}function NY(U){return U<10?"0"+U.toString(10):U.toString(10)}function VI(){var U=new Date,Z=[NY(U.getHours()),NY(U.getMinutes()),NY(U.getSeconds())].join(":");return[U.getDate(),GI[U.getMonth()],Z].join(" ")}function $G(...U){console.log("%s - %s",VI(),wY.apply(null,U))}function KG(U,Z){if(Z)U.super_=Z,U.prototype=Object.create(Z.prototype,{constructor:{value:U,enumerable:!1,writable:!0,configurable:!0}})}function pY(U,Z){if(!Z||!AZ(Z))return U;var X=Object.keys(Z),Q=X.length;while(Q--)U[X[Q]]=Z[X[Q]];return U}function WG(U,Z){return Object.prototype.hasOwnProperty.call(U,Z)}function hY(U,Z){if(!U){var X=Error("Promise was rejected with a falsy value");X.reason=U,U=X}return Z(U)}function FG(U){if(typeof U!=="function")throw TypeError('The "original" argument must be of type Function');function Z(...X){var Q=X.pop();if(typeof Q!=="function")throw TypeError("The last argument must be of type Function");var K=this,F=function(...$){return Q.apply(K,...$)};U.apply(this,X).then(function($){process.nextTick(F.bind(null,null,$))},function($){process.nextTick(hY.bind(null,$,F))})}return Object.setPrototypeOf(Z,Object.getPrototypeOf(U)),Object.defineProperties(Z,Object.getOwnPropertyDescriptors(U)),Z}var nW,sW,rU,ZI=()=>{},GI,IG,HG,OG,$I;var AG=IZ(()=>{nW=/%[sdj%]/g;sW=((U={},Z={},X)=>((X=typeof process<"u"&&!1)&&(X=X.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase()),Z=new RegExp("^"+X+"$","i"),(Q)=>{if(Q=Q.toUpperCase(),!U[Q])if(Z.test(Q))U[Q]=function(...K){console.error("%s: %s",Q,pid,wY.apply(null,...K))};else U[Q]=function(){};return U[Q]}))(),rU=((U)=>(U.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},U.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},U.custom=Symbol.for("nodejs.util.inspect.custom"),U))(function(U,Z,...X){var Q={seen:[],stylize:aW};if(X.length>=1)Q.depth=X[0];if(X.length>=2)Q.colors=X[1];if(yY(Z))Q.showHidden=Z;else if(Z)pY(Q,Z);if(CZ(Q.showHidden))Q.showHidden=!1;if(CZ(Q.depth))Q.depth=2;if(CZ(Q.colors))Q.colors=!1;if(Q.colors)Q.stylize=rW;return TX(Q,U,Q.depth)});GI=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];IG=((U)=>(U.custom=Symbol.for("nodejs.util.promisify.custom"),U))(function(U){if(typeof U!=="function")throw TypeError('The "original" argument must be of type Function');if(kCustomPromisifiedSymbol&&U[kCustomPromisifiedSymbol]){var Z=U[kCustomPromisifiedSymbol];if(typeof Z!=="function")throw TypeError('The "nodejs.util.promisify.custom" argument must be of type Function');return Object.defineProperty(Z,kCustomPromisifiedSymbol,{value:Z,enumerable:!1,writable:!1,configurable:!0}),Z}function Z(...X){var Q,K,F=new Promise(function($,q){Q=$,K=q});X.push(function($,q){if($)K($);else Q(q)});try{U.apply(this,X)}catch($){K($)}return F}if(Object.setPrototypeOf(Z,Object.getPrototypeOf(U)),kCustomPromisifiedSymbol)Object.defineProperty(Z,kCustomPromisifiedSymbol,{value:Z,enumerable:!1,writable:!1,configurable:!0});return Object.defineProperties(Z,Object.getOwnPropertyDescriptors(U))});({TextEncoder:HG,TextDecoder:OG}=globalThis),$I={TextEncoder:HG,TextDecoder:OG,promisify:IG,log:$G,inherits:KG,_extend:pY,callbackifyOnRejected:hY,callbackify:FG}});var xZ={};WZ(xZ,{setMaxListeners:()=>kG,once:()=>SG,listenerCount:()=>jG,init:()=>wU,getMaxListeners:()=>_G,getEventListeners:()=>PG,default:()=>zI,captureRejectionSymbol:()=>LG,addAbortListener:()=>BG,EventEmitter:()=>wU});function TG(U,Z){var{_events:X}=U;if(Z[0]??=Error("Unhandled error."),!X)throw Z[0];var Q=X[MG];if(Q)for(var K of DG.call(Q))K.apply(U,Z);var F=X.error;if(!F)throw Z[0];for(var K of DG.call(F))K.apply(U,Z);return!0}function II(U,Z,X,Q){Z.then(void 0,function(K){queueMicrotask(()=>FI(U,K,X,Q))})}function FI(U,Z,X,Q){if(typeof U[zG]==="function")U[zG](Z,X,...Q);else try{U[aU]=!1,U.emit("error",Z)}finally{U[aU]=!0}}function RG(U,Z,X){X.warned=!0;let Q=Error(`Possible EventEmitter memory leak detected. ${X.length} ${String(Z)} listeners added to [${U.constructor.name}]. Use emitter.setMaxListeners() to increase limit`);Q.name="MaxListenersExceededWarning",Q.emitter=U,Q.type=Z,Q.count=X.length,console.warn(Q)}function EG(U,Z,...X){this.removeListener(U,Z),Z.apply(this,X)}function SG(U,Z,X){var Q=X?.signal;if(vG(Q,"options.signal"),Q?.aborted)throw new uY(void 0,{cause:Q?.reason});let{resolve:K,reject:F,promise:$}=$newPromiseCapability(Promise),q=(T)=>{if(U.removeListener(Z,M),Q!=null)SX(Q,"abort",z);F(T)},M=(...T)=>{if(typeof U.removeListener==="function")U.removeListener("error",q);if(Q!=null)SX(Q,"abort",z);K(T)};if(qG(U,Z,M,{once:!0}),Z!=="error"&&typeof U.once==="function")U.once("error",q);function z(){SX(U,Z,M),SX(U,"error",q),F(new uY(void 0,{cause:Q?.reason}))}if(Q!=null)qG(Q,"abort",z,{once:!0});return $}function PG(U,Z){return U.listeners(Z)}function kG(U,...Z){dY(U,"setMaxListeners",0);var X;if(Z&&(X=Z.length))for(let Q=0;Q<X;Q++)Z[Q].setMaxListeners(U);else tU=U}function jG(U,Z){return U.listenerCount(Z)}function SX(U,Z,X,Q){if(typeof U.removeListener==="function")U.removeListener(Z,X);else U.removeEventListener(Z,X,Q)}function qG(U,Z,X,Q){if(typeof U.on==="function")if(Q.once)U.once(Z,X);else U.on(Z,X);else U.addEventListener(Z,X,Q)}function zZ(U,Z,X){let Q=TypeError(`The "${U}" argument must be of type ${Z}. Received ${X}`);return Q.code="ERR_INVALID_ARG_TYPE",Q}function CI(U,Z,X){let Q=RangeError(`The "${U}" argument is out of range. It must be ${Z}. Received ${X}`);return Q.code="ERR_OUT_OF_RANGE",Q}function vG(U,Z){if(U!==void 0&&(U===null||typeof U!=="object"||!("aborted"in U)))throw zZ(Z,"AbortSignal",U)}function dY(U,Z,X,Q){if(typeof U!=="number")throw zZ(Z,"number",U);if(X!=null&&U<X||Q!=null&&U>Q||(X!=null||Q!=null)&&Number.isNaN(U))throw CI(Z,`${X!=null?`>= ${X}`:""}${X!=null&&Q!=null?" && ":""}${Q!=null?`<= ${Q}`:""}`,U)}function BZ(U){if(typeof U!=="function")throw TypeError("The listener must be a function")}function AI(U,Z){if(typeof U!=="boolean")throw zZ(Z,"boolean",U)}function _G(U){return U?._maxListeners??tU}function BG(U,Z){if(U===void 0)throw zZ("signal","AbortSignal",U);if(vG(U,"signal"),typeof Z!=="function")throw zZ("listener","function",Z);let X;if(U.aborted)queueMicrotask(()=>Z());else U.addEventListener("abort",Z,{__proto__:null,once:!0}),X=()=>{U.removeEventListener("abort",Z)};return{__proto__:null,[Symbol.dispose](){X?.()}}}var bY,aU,MG,KI,WI,zG,LG,DG,tU=10,wU=function(U){if(this._events===void 0||this._events===this.__proto__._events)this._events={__proto__:null},this._eventsCount=0;if(this._maxListeners??=void 0,this[aU]=U?.captureRejections?Boolean(U?.captureRejections):i0[aU])this.emit=OI},i0,HI=function(U,...Z){if(U==="error")return TG(this,Z);var{_events:X}=this;if(X===void 0)return!1;var Q=X[U];if(Q===void 0)return!1;let K=Q.length>1?Q.slice():Q;for(let F=0,{length:$}=K;F<$;F++){let q=K[F];switch(Z.length){case 0:q.call(this);break;case 1:q.call(this,Z[0]);break;case 2:q.call(this,Z[0],Z[1]);break;case 3:q.call(this,Z[0],Z[1],Z[2]);break;default:q.apply(this,Z);break}}return!0},OI=function(U,...Z){if(U==="error")return TG(this,Z);var{_events:X}=this;if(X===void 0)return!1;var Q=X[U];if(Q===void 0)return!1;let K=Q.length>1?Q.slice():Q;for(let F=0,{length:$}=K;F<$;F++){let q=K[F],M;switch(Z.length){case 0:M=q.call(this);break;case 1:M=q.call(this,Z[0]);break;case 2:M=q.call(this,Z[0],Z[1]);break;case 3:M=q.call(this,Z[0],Z[1],Z[2]);break;default:M=q.apply(this,Z);break}if(M!==void 0&&typeof M?.then==="function"&&M.then===Promise.prototype.then)II(this,M,U,Z)}return!0},uY,zI;var NZ=IZ(()=>{bY=Symbol.for,aU=Symbol("kCapture"),MG=bY("events.errorMonitor"),KI=Symbol("events.maxEventTargetListeners"),WI=Symbol("events.maxEventTargetListenersWarned"),zG=bY("nodejs.rejection"),LG=bY("nodejs.rejection"),DG=Array.prototype.slice,i0=wU.prototype={};i0._events=void 0;i0._eventsCount=0;i0._maxListeners=void 0;i0.setMaxListeners=function(U){return dY(U,"setMaxListeners",0),this._maxListeners=U,this};i0.constructor=wU;i0.getMaxListeners=function(){return this?._maxListeners??tU};i0.emit=HI;i0.addListener=function(U,Z){BZ(Z);var X=this._events;if(!X)X=this._events={__proto__:null},this._eventsCount=0;else if(X.newListener)this.emit("newListener",U,Z.listener??Z);var Q=X[U];if(!Q)X[U]=[Z],this._eventsCount++;else{Q.push(Z);var K=this._maxListeners??tU;if(K>0&&Q.length>K&&!Q.warned)RG(this,U,Q)}return this};i0.on=i0.addListener;i0.prependListener=function(U,Z){BZ(Z);var X=this._events;if(!X)X=this._events={__proto__:null},this._eventsCount=0;else if(X.newListener)this.emit("newListener",U,Z.listener??Z);var Q=X[U];if(!Q)X[U]=[Z],this._eventsCount++;else{Q.unshift(Z);var K=this._maxListeners??tU;if(K>0&&Q.length>K&&!Q.warned)RG(this,U,Q)}return this};i0.once=function(U,Z){BZ(Z);let X=EG.bind(this,U,Z);return X.listener=Z,this.addListener(U,X),this};i0.prependOnceListener=function(U,Z){BZ(Z);let X=EG.bind(this,U,Z);return X.listener=Z,this.prependListener(U,X),this};i0.removeListener=function(U,Z){BZ(Z);var{_events:X}=this;if(!X)return this;var Q=X[U];if(!Q)return this;var K=Q.length;let F=-1;for(let $=K-1;$>=0;$--)if(Q[$]===Z||Q[$].listener===Z){F=$;break}if(F<0)return this;if(F===0)Q.shift();else Q.splice(F,1);if(Q.length===0)delete X[U],this._eventsCount--;return this};i0.off=i0.removeListener;i0.removeAllListeners=function(U){var{_events:Z}=this;if(U&&Z){if(Z[U])delete Z[U],this._eventsCount--}else this._events={__proto__:null};return this};i0.listeners=function(U){var{_events:Z}=this;if(!Z)return[];var X=Z[U];if(!X)return[];return X.map((Q)=>Q.listener??Q)};i0.rawListeners=function(U){var{_events:Z}=this;if(!Z)return[];var X=Z[U];if(!X)return[];return X.slice()};i0.listenerCount=function(U){var{_events:Z}=this;if(!Z)return 0;return Z[U]?.length??0};i0.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};i0[aU]=!1;uY=class uY extends Error{constructor(U="The operation was aborted",Z=void 0){if(Z!==void 0&&typeof Z!=="object")throw zZ("options","Object",Z);super(U,Z);this.code="ABORT_ERR",this.name="AbortError"}};Object.defineProperties(wU,{captureRejections:{get(){return i0[aU]},set(U){AI(U,"EventEmitter.captureRejections"),i0[aU]=U},enumerable:!0},defaultMaxListeners:{enumerable:!0,get:()=>{return tU},set:(U)=>{dY(U,"defaultMaxListeners",0),tU=U}},kMaxEventTargetListeners:{value:KI,enumerable:!1,configurable:!1,writable:!1},kMaxEventTargetListenersWarned:{value:WI,enumerable:!1,configurable:!1,writable:!1}});Object.assign(wU,{once:SG,getEventListeners:PG,getMaxListeners:_G,setMaxListeners:kG,EventEmitter:wU,usingDomains:!1,captureRejectionSymbol:LG,errorMonitor:MG,addAbortListener:BG,init:wU,listenerCount:jG});zI=wU});var mY=mK((iC,pG)=>{var s0=(U,Z)=>()=>(Z||U((Z={exports:{}}).exports,Z),Z.exports),Z1=s0((U,Z)=>{class X extends Error{constructor(Q){if(!Array.isArray(Q))throw TypeError(`Expected input to be an Array, got ${typeof Q}`);let K="";for(let F=0;F<Q.length;F++)K+=` ${Q[F].stack}
|
|
12
|
+
`;super(K);this.name="AggregateError",this.errors=Q}}Z.exports={AggregateError:X,ArrayIsArray(Q){return Array.isArray(Q)},ArrayPrototypeIncludes(Q,K){return Q.includes(K)},ArrayPrototypeIndexOf(Q,K){return Q.indexOf(K)},ArrayPrototypeJoin(Q,K){return Q.join(K)},ArrayPrototypeMap(Q,K){return Q.map(K)},ArrayPrototypePop(Q,K){return Q.pop(K)},ArrayPrototypePush(Q,K){return Q.push(K)},ArrayPrototypeSlice(Q,K,F){return Q.slice(K,F)},Error,FunctionPrototypeCall(Q,K,...F){return Q.call(K,...F)},FunctionPrototypeSymbolHasInstance(Q,K){return Function.prototype[Symbol.hasInstance].call(Q,K)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties(Q,K){return Object.defineProperties(Q,K)},ObjectDefineProperty(Q,K,F){return Object.defineProperty(Q,K,F)},ObjectGetOwnPropertyDescriptor(Q,K){return Object.getOwnPropertyDescriptor(Q,K)},ObjectKeys(Q){return Object.keys(Q)},ObjectSetPrototypeOf(Q,K){return Object.setPrototypeOf(Q,K)},Promise,PromisePrototypeCatch(Q,K){return Q.catch(K)},PromisePrototypeThen(Q,K,F){return Q.then(K,F)},PromiseReject(Q){return Promise.reject(Q)},PromiseResolve(Q){return Promise.resolve(Q)},ReflectApply:Reflect.apply,RegExpPrototypeTest(Q,K){return Q.test(K)},SafeSet:Set,String,StringPrototypeSlice(Q,K,F){return Q.slice(K,F)},StringPrototypeToLowerCase(Q){return Q.toLowerCase()},StringPrototypeToUpperCase(Q){return Q.toUpperCase()},StringPrototypeTrim(Q){return Q.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol("Symbol.dispose"),SymbolAsyncDispose:Symbol.asyncDispose||Symbol("Symbol.asyncDispose"),TypedArrayPrototypeSet(Q,K,F){return Q.set(K,F)},Boolean,Uint8Array}}),xG=s0((U,Z)=>{Z.exports={format(X,...Q){return X.replace(/%([sdifj])/g,function(...[K,F]){let $=Q.shift();if(F==="f")return $.toFixed(6);else if(F==="j")return JSON.stringify($);else if(F==="s"&&typeof $==="object")return`${$.constructor!==Object?$.constructor.name:""} {}`.trim();else return $.toString()})},inspect(X){switch(typeof X){case"string":if(X.includes("'")){if(!X.includes('"'))return`"${X}"`;else if(!X.includes("`")&&!X.includes("${"))return`\`${X}\``}return`'${X}'`;case"number":if(isNaN(X))return"NaN";else if(Object.is(X,-0))return String(X);return X;case"bigint":return`${String(X)}n`;case"boolean":case"undefined":return String(X);case"object":return"{}"}}}}),n1=s0((U,Z)=>{var{format:X,inspect:Q}=xG(),{AggregateError:K}=Z1(),F=globalThis.AggregateError||K,$=Symbol("kIsNodeError"),q=["string","function","number","object","Function","Object","boolean","bigint","symbol"],M=/^([A-Z][a-z0-9]*)+$/,z={};function T(B,v){if(!B)throw new z.ERR_INTERNAL_ASSERTION(v)}function A(B){let v="",x=B.length,N=B[0]==="-"?1:0;for(;x>=N+4;x-=3)v=`_${B.slice(x-3,x)}${v}`;return`${B.slice(0,x)}${v}`}function L(B,v,x){if(typeof v==="function")return T(v.length<=x.length,`Code: ${B}; The provided arguments length (${x.length}) does not match the required ones (${v.length}).`),v(...x);let N=(v.match(/%[dfijoOs]/g)||[]).length;if(T(N===x.length,`Code: ${B}; The provided arguments length (${x.length}) does not match the required ones (${N}).`),x.length===0)return v;return X(v,...x)}function E(B,v,x){if(!x)x=Error;class N extends x{constructor(...w){super(L(B,v,w))}toString(){return`${this.name} [${B}]: ${this.message}`}}Object.defineProperties(N.prototype,{name:{value:x.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${B}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),N.prototype.code=B,N.prototype[$]=!0,z[B]=N}function S(B){let v="__node_internal_"+B.name;return Object.defineProperty(B,"name",{value:v}),B}function j(B,v){if(B&&v&&B!==v){if(Array.isArray(v.errors))return v.errors.push(B),v;let x=new F([v,B],v.message);return x.code=v.code,x}return B||v}class k extends Error{constructor(B="The operation was aborted",v=void 0){if(v!==void 0&&typeof v!=="object")throw new z.ERR_INVALID_ARG_TYPE("options","Object",v);super(B,v);this.code="ABORT_ERR",this.name="AbortError"}}E("ERR_ASSERTION","%s",Error),E("ERR_INVALID_ARG_TYPE",(B,v,x)=>{if(T(typeof B==="string","'name' must be a string"),!Array.isArray(v))v=[v];let N="The ";if(B.endsWith(" argument"))N+=`${B} `;else N+=`"${B}" ${B.includes(".")?"property":"argument"} `;N+="must be ";let w=[],u=[],Z0=[];for(let Y0 of v)if(T(typeof Y0==="string","All expected entries have to be of type string"),q.includes(Y0))w.push(Y0.toLowerCase());else if(M.test(Y0))u.push(Y0);else T(Y0!=="object",'The value "object" should be written as "Object"'),Z0.push(Y0);if(u.length>0){let Y0=w.indexOf("object");if(Y0!==-1)w.splice(w,Y0,1),u.push("Object")}if(w.length>0){switch(w.length){case 1:N+=`of type ${w[0]}`;break;case 2:N+=`one of type ${w[0]} or ${w[1]}`;break;default:{let Y0=w.pop();N+=`one of type ${w.join(", ")}, or ${Y0}`}}if(u.length>0||Z0.length>0)N+=" or "}if(u.length>0){switch(u.length){case 1:N+=`an instance of ${u[0]}`;break;case 2:N+=`an instance of ${u[0]} or ${u[1]}`;break;default:{let Y0=u.pop();N+=`an instance of ${u.join(", ")}, or ${Y0}`}}if(Z0.length>0)N+=" or "}switch(Z0.length){case 0:break;case 1:if(Z0[0].toLowerCase()!==Z0[0])N+="an ";N+=`${Z0[0]}`;break;case 2:N+=`one of ${Z0[0]} or ${Z0[1]}`;break;default:{let Y0=Z0.pop();N+=`one of ${Z0.join(", ")}, or ${Y0}`}}if(x==null)N+=`. Received ${x}`;else if(typeof x==="function"&&x.name)N+=`. Received function ${x.name}`;else if(typeof x==="object"){var V0;if((V0=x.constructor)!==null&&V0!==void 0&&V0.name)N+=`. Received an instance of ${x.constructor.name}`;else{let Y0=Q(x,{depth:-1});N+=`. Received ${Y0}`}}else{let Y0=Q(x,{colors:!1});if(Y0.length>25)Y0=`${Y0.slice(0,25)}...`;N+=`. Received type ${typeof x} (${Y0})`}return N},TypeError),E("ERR_INVALID_ARG_VALUE",(B,v,x="is invalid")=>{let N=Q(v);if(N.length>128)N=N.slice(0,128)+"...";return`The ${B.includes(".")?"property":"argument"} '${B}' ${x}. Received ${N}`},TypeError),E("ERR_INVALID_RETURN_VALUE",(B,v,x)=>{var N;let w=x!==null&&x!==void 0&&(N=x.constructor)!==null&&N!==void 0&&N.name?`instance of ${x.constructor.name}`:`type ${typeof x}`;return`Expected ${B} to be returned from the "${v}" function but got ${w}.`},TypeError),E("ERR_MISSING_ARGS",(...B)=>{T(B.length>0,"At least one arg needs to be specified");let v,x=B.length;switch(B=(Array.isArray(B)?B:[B]).map((N)=>`"${N}"`).join(" or "),x){case 1:v+=`The ${B[0]} argument`;break;case 2:v+=`The ${B[0]} and ${B[1]} arguments`;break;default:{let N=B.pop();v+=`The ${B.join(", ")}, and ${N} arguments`}break}return`${v} must be specified`},TypeError),E("ERR_OUT_OF_RANGE",(B,v,x)=>{T(v,'Missing "range" argument');let N;if(Number.isInteger(x)&&Math.abs(x)>4294967296)N=A(String(x));else if(typeof x==="bigint"){N=String(x);let w=BigInt(2)**BigInt(32);if(x>w||x<-w)N=A(N);N+="n"}else N=Q(x);return`The value of "${B}" is out of range. It must be ${v}. Received ${N}`},RangeError),E("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),E("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),E("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),E("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),E("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),E("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),E("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),E("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),E("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),E("ERR_STREAM_WRITE_AFTER_END","write after end",Error),E("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),Z.exports={AbortError:k,aggregateTwoErrors:S(j),hideStackFrames:S,codes:z}}),DI=s0((U,Z)=>{Object.defineProperty(U,"__esModule",{value:!0});var X=new WeakMap,Q=new WeakMap;function K(b){let i=X.get(b);return console.assert(i!=null,"'this' is expected an Event object, but got",b),i}function F(b){if(b.passiveListener!=null){if(typeof console<"u"&&typeof console.error==="function")console.error("Unable to preventDefault inside passive event listener invocation.",b.passiveListener);return}if(!b.event.cancelable)return;if(b.canceled=!0,typeof b.event.preventDefault==="function")b.event.preventDefault()}function $(b,i){X.set(this,{eventTarget:b,event:i,eventPhase:2,currentTarget:b,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:i.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});let Y=Object.keys(i);for(let V=0;V<Y.length;++V){let I=Y[V];if(!(I in this))Object.defineProperty(this,I,q(I))}}if($.prototype={get type(){return K(this).event.type},get target(){return K(this).eventTarget},get currentTarget(){return K(this).currentTarget},composedPath(){let b=K(this).currentTarget;if(b==null)return[];return[b]},get NONE(){return 0},get CAPTURING_PHASE(){return 1},get AT_TARGET(){return 2},get BUBBLING_PHASE(){return 3},get eventPhase(){return K(this).eventPhase},stopPropagation(){let b=K(this);if(b.stopped=!0,typeof b.event.stopPropagation==="function")b.event.stopPropagation()},stopImmediatePropagation(){let b=K(this);if(b.stopped=!0,b.immediateStopped=!0,typeof b.event.stopImmediatePropagation==="function")b.event.stopImmediatePropagation()},get bubbles(){return Boolean(K(this).event.bubbles)},get cancelable(){return Boolean(K(this).event.cancelable)},preventDefault(){F(K(this))},get defaultPrevented(){return K(this).canceled},get composed(){return Boolean(K(this).event.composed)},get timeStamp(){return K(this).timeStamp},get srcElement(){return K(this).eventTarget},get cancelBubble(){return K(this).stopped},set cancelBubble(b){if(!b)return;let i=K(this);if(i.stopped=!0,typeof i.event.cancelBubble==="boolean")i.event.cancelBubble=!0},get returnValue(){return!K(this).canceled},set returnValue(b){if(!b)F(K(this))},initEvent(){}},Object.defineProperty($.prototype,"constructor",{value:$,configurable:!0,writable:!0}),typeof window<"u"&&typeof window.Event<"u")Object.setPrototypeOf($.prototype,window.Event.prototype),Q.set(window.Event.prototype,$);function q(b){return{get(){return K(this).event[b]},set(i){K(this).event[b]=i},configurable:!0,enumerable:!0}}function M(b){return{value(){let i=K(this).event;return i[b].apply(i,arguments)},configurable:!0,enumerable:!0}}function z(b,i){let Y=Object.keys(i);if(Y.length===0)return b;function V(I,G){b.call(this,I,G)}V.prototype=Object.create(b.prototype,{constructor:{value:V,configurable:!0,writable:!0}});for(let I=0;I<Y.length;++I){let G=Y[I];if(!(G in b.prototype)){let W=typeof Object.getOwnPropertyDescriptor(i,G).value==="function";Object.defineProperty(V.prototype,G,W?M(G):q(G))}}return V}function T(b){if(b==null||b===Object.prototype)return $;let i=Q.get(b);if(i==null)i=z(T(Object.getPrototypeOf(b)),b),Q.set(b,i);return i}function A(b,i){return new(T(Object.getPrototypeOf(i)))(b,i)}function L(b){return K(b).immediateStopped}function E(b,i){K(b).eventPhase=i}function S(b,i){K(b).currentTarget=i}function j(b,i){K(b).passiveListener=i}var k=new WeakMap,B=1,v=2,x=3;function N(b){return b!==null&&typeof b==="object"}function w(b){let i=k.get(b);if(i==null)throw TypeError("'this' is expected an EventTarget object, but got another value.");return i}function u(b){return{get(){let i=w(this).get(b);while(i!=null){if(i.listenerType===x)return i.listener;i=i.next}return null},set(i){if(typeof i!=="function"&&!N(i))i=null;let Y=w(this),V=null,I=Y.get(b);while(I!=null){if(I.listenerType===x)if(V!==null)V.next=I.next;else if(I.next!==null)Y.set(b,I.next);else Y.delete(b);else V=I;I=I.next}if(i!==null){let G={listener:i,listenerType:x,passive:!1,once:!1,next:null};if(V===null)Y.set(b,G);else V.next=G}},configurable:!0,enumerable:!0}}function Z0(b,i){Object.defineProperty(b,`on${i}`,u(i))}function V0(b){function i(){Y0.call(this)}i.prototype=Object.create(Y0.prototype,{constructor:{value:i,configurable:!0,writable:!0}});for(let Y=0;Y<b.length;++Y)Z0(i.prototype,b[Y]);return i}function Y0(){if(this instanceof Y0){k.set(this,new Map);return}if(arguments.length===1&&Array.isArray(arguments[0]))return V0(arguments[0]);if(arguments.length>0){let b=Array(arguments.length);for(let i=0;i<arguments.length;++i)b[i]=arguments[i];return V0(b)}throw TypeError("Cannot call a class as a function")}if(Y0.prototype={addEventListener(b,i,Y){if(i==null)return;if(typeof i!=="function"&&!N(i))throw TypeError("'listener' should be a function or an object.");let V=w(this),I=N(Y),G=(I?Boolean(Y.capture):Boolean(Y))?B:v,W={listener:i,listenerType:G,passive:I&&Boolean(Y.passive),once:I&&Boolean(Y.once),next:null},C=V.get(b);if(C===void 0){V.set(b,W);return}let D=null;while(C!=null){if(C.listener===i&&C.listenerType===G)return;D=C,C=C.next}D.next=W},removeEventListener(b,i,Y){if(i==null)return;let V=w(this),I=(N(Y)?Boolean(Y.capture):Boolean(Y))?B:v,G=null,W=V.get(b);while(W!=null){if(W.listener===i&&W.listenerType===I){if(G!==null)G.next=W.next;else if(W.next!==null)V.set(b,W.next);else V.delete(b);return}G=W,W=W.next}},dispatchEvent(b){if(b==null||typeof b.type!=="string")throw TypeError('"event.type" should be a string.');let i=w(this),Y=b.type,V=i.get(Y);if(V==null)return!0;let I=A(this,b),G=null;while(V!=null){if(V.once)if(G!==null)G.next=V.next;else if(V.next!==null)i.set(Y,V.next);else i.delete(Y);else G=V;if(j(I,V.passive?V.listener:null),typeof V.listener==="function")try{V.listener.call(this,I)}catch(W){if(typeof console<"u"&&typeof console.error==="function")console.error(W)}else if(V.listenerType!==x&&typeof V.listener.handleEvent==="function")V.listener.handleEvent(I);if(L(I))break;V=V.next}return j(I,null),E(I,0),S(I,null),!I.defaultPrevented}},Object.defineProperty(Y0.prototype,"constructor",{value:Y0,configurable:!0,writable:!0}),typeof window<"u"&&typeof window.EventTarget<"u")Object.setPrototypeOf(Y0.prototype,window.EventTarget.prototype);U.defineEventAttribute=Z0,U.EventTarget=Y0,U.default=Y0,Z.exports=Y0,Z.exports.EventTarget=Z.exports.default=Y0,Z.exports.defineEventAttribute=Z0}),gZ=s0((U,Z)=>{Object.defineProperty(U,"__esModule",{value:!0});var X=DI();class Q extends X.EventTarget{constructor(){super();throw TypeError("AbortSignal cannot be constructed directly")}get aborted(){let T=$.get(this);if(typeof T!=="boolean")throw TypeError(`Expected 'this' to be an 'AbortSignal' object, but got ${this===null?"null":typeof this}`);return T}}X.defineEventAttribute(Q.prototype,"abort");function K(){let T=Object.create(Q.prototype);return X.EventTarget.call(T),$.set(T,!1),T}function F(T){if($.get(T)!==!1)return;$.set(T,!0),T.dispatchEvent({type:"abort"})}var $=new WeakMap;if(Object.defineProperties(Q.prototype,{aborted:{enumerable:!0}}),typeof Symbol==="function"&&typeof Symbol.toStringTag==="symbol")Object.defineProperty(Q.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortSignal"});class q{constructor(){M.set(this,K())}get signal(){return z(this)}abort(){F(z(this))}}var M=new WeakMap;function z(T){let A=M.get(T);if(A==null)throw TypeError(`Expected 'this' to be an 'AbortController' object, but got ${T===null?"null":typeof T}`);return A}if(Object.defineProperties(q.prototype,{signal:{enumerable:!0},abort:{enumerable:!0}}),typeof Symbol==="function"&&typeof Symbol.toStringTag==="symbol")Object.defineProperty(q.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortController"});U.AbortController=q,U.AbortSignal=Q,U.default=q,Z.exports=q,Z.exports.AbortController=Z.exports.default=q,Z.exports.AbortSignal=Q}),i1=s0((U,Z)=>{var X=(g1(),m0(N1)),{format:Q,inspect:K}=xG(),{codes:{ERR_INVALID_ARG_TYPE:F}}=n1(),{kResistStopPropagation:$,AggregateError:q,SymbolDispose:M}=Z1(),z=globalThis.AbortSignal||gZ().AbortSignal,T=globalThis.AbortController||gZ().AbortController,A=Object.getPrototypeOf(async function(){}).constructor,L=globalThis.Blob||X.Blob,E=typeof L<"u"?function(k){return k instanceof L}:function(k){return!1},S=(k,B)=>{if(k!==void 0&&(k===null||typeof k!=="object"||!("aborted"in k)))throw new F(B,"AbortSignal",k)},j=(k,B)=>{if(typeof k!=="function")throw new F(B,"Function",k)};Z.exports={AggregateError:q,kEmptyObject:Object.freeze({}),once(k){let B=!1;return function(...v){if(B)return;B=!0,k.apply(this,v)}},createDeferredPromise:function(){let k,B;return{promise:new Promise((v,x)=>{k=v,B=x}),resolve:k,reject:B}},promisify(k){return new Promise((B,v)=>{k((x,...N)=>{if(x)return v(x);return B(...N)})})},debuglog(){return function(){}},format:Q,inspect:K,types:{isAsyncFunction(k){return k instanceof A},isArrayBufferView(k){return ArrayBuffer.isView(k)}},isBlob:E,deprecate(k,B){return k},addAbortListener:(NZ(),m0(xZ)).addAbortListener||function(k,B){if(k===void 0)throw new F("signal","AbortSignal",k);S(k,"signal"),j(B,"listener");let v;if(k.aborted)queueMicrotask(()=>B());else k.addEventListener("abort",B,{__proto__:null,once:!0,[$]:!0}),v=()=>{k.removeEventListener("abort",B)};return{__proto__:null,[M](){var x;(x=v)===null||x===void 0||x()}}},AbortSignalAny:z.any||function(k){if(k.length===1)return k[0];let B=new T,v=()=>B.abort();return k.forEach((x)=>{S(x,"signals"),x.addEventListener("abort",v,{once:!0})}),B.signal.addEventListener("abort",()=>{k.forEach((x)=>x.removeEventListener("abort",v))},{once:!0}),B.signal}},Z.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")}),fZ=s0((U,Z)=>{var{ArrayIsArray:X,ArrayPrototypeIncludes:Q,ArrayPrototypeJoin:K,ArrayPrototypeMap:F,NumberIsInteger:$,NumberIsNaN:q,NumberMAX_SAFE_INTEGER:M,NumberMIN_SAFE_INTEGER:z,NumberParseInt:T,ObjectPrototypeHasOwnProperty:A,RegExpPrototypeExec:L,String:E,StringPrototypeToUpperCase:S,StringPrototypeTrim:j}=Z1(),{hideStackFrames:k,codes:{ERR_SOCKET_BAD_PORT:B,ERR_INVALID_ARG_TYPE:v,ERR_INVALID_ARG_VALUE:x,ERR_OUT_OF_RANGE:N,ERR_UNKNOWN_SIGNAL:w}}=n1(),{normalizeEncoding:u}=i1(),{isAsyncFunction:Z0,isArrayBufferView:V0}=i1().types,Y0={};function b(p){return p===(p|0)}function i(p){return p===p>>>0}var Y=/^[0-7]+$/,V="must be a 32-bit unsigned integer or an octal string";function I(p,m,g0){if(typeof p>"u")p=g0;if(typeof p==="string"){if(L(Y,p)===null)throw new x(m,p,V);p=T(p,8)}return C(p,m),p}var G=k((p,m,g0=z,r=M)=>{if(typeof p!=="number")throw new v(m,"number",p);if(!$(p))throw new N(m,"an integer",p);if(p<g0||p>r)throw new N(m,`>= ${g0} && <= ${r}`,p)}),W=k((p,m,g0=-2147483648,r=2147483647)=>{if(typeof p!=="number")throw new v(m,"number",p);if(!$(p))throw new N(m,"an integer",p);if(p<g0||p>r)throw new N(m,`>= ${g0} && <= ${r}`,p)}),C=k((p,m,g0=!1)=>{if(typeof p!=="number")throw new v(m,"number",p);if(!$(p))throw new N(m,"an integer",p);let r=g0?1:0,J0=4294967295;if(p<r||p>J0)throw new N(m,`>= ${r} && <= ${J0}`,p)});function D(p,m){if(typeof p!=="string")throw new v(m,"string",p)}function H(p,m,g0=void 0,r){if(typeof p!=="number")throw new v(m,"number",p);if(g0!=null&&p<g0||r!=null&&p>r||(g0!=null||r!=null)&&q(p))throw new N(m,`${g0!=null?`>= ${g0}`:""}${g0!=null&&r!=null?" && ":""}${r!=null?`<= ${r}`:""}`,p)}var J=k((p,m,g0)=>{if(!Q(g0,p)){let r="must be one of: "+K(F(g0,(J0)=>typeof J0==="string"?`'${J0}'`:E(J0)),", ");throw new x(m,p,r)}});function O(p,m){if(typeof p!=="boolean")throw new v(m,"boolean",p)}function P(p,m,g0){return p==null||!A(p,m)?g0:p[m]}var R=k((p,m,g0=null)=>{let r=P(g0,"allowArray",!1),J0=P(g0,"allowFunction",!1);if(!P(g0,"nullable",!1)&&p===null||!r&&X(p)||typeof p!=="object"&&(!J0||typeof p!=="function"))throw new v(m,"Object",p)}),_=k((p,m)=>{if(p!=null&&typeof p!=="object"&&typeof p!=="function")throw new v(m,"a dictionary",p)}),f=k((p,m,g0=0)=>{if(!X(p))throw new v(m,"Array",p);if(p.length<g0){let r=`must be longer than ${g0}`;throw new x(m,p,r)}});function c(p,m){f(p,m);for(let g0=0;g0<p.length;g0++)D(p[g0],`${m}[${g0}]`)}function o(p,m){f(p,m);for(let g0=0;g0<p.length;g0++)O(p[g0],`${m}[${g0}]`)}function K0(p,m){f(p,m);for(let g0=0;g0<p.length;g0++){let r=p[g0],J0=`${m}[${g0}]`;if(r==null)throw new v(J0,"AbortSignal",r);s(r,J0)}}function a(p,m="signal"){if(D(p,m),Y0[p]===void 0){if(Y0[S(p)]!==void 0)throw new w(p+" (signals must use all capital letters)");throw new w(p)}}var l=k((p,m="buffer")=>{if(!V0(p))throw new v(m,["Buffer","TypedArray","DataView"],p)});function Q0(p,m){let g0=u(m),r=p.length;if(g0==="hex"&&r%2!==0)throw new x("encoding",m,`is invalid for data of length ${r}`)}function n(p,m="Port",g0=!0){if(typeof p!=="number"&&typeof p!=="string"||typeof p==="string"&&j(p).length===0||+p!==+p>>>0||p>65535||p===0&&!g0)throw new B(m,p,g0);return p|0}var s=k((p,m)=>{if(p!==void 0&&(p===null||typeof p!=="object"||!("aborted"in p)))throw new v(m,"AbortSignal",p)}),f0=k((p,m)=>{if(typeof p!=="function")throw new v(m,"Function",p)}),y=k((p,m)=>{if(typeof p!=="function"||Z0(p))throw new v(m,"Function",p)}),h=k((p,m)=>{if(p!==void 0)throw new v(m,"undefined",p)});function G0(p,m,g0){if(!Q(g0,p))throw new v(m,`('${K(g0,"|")}')`,p)}var t=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function U0(p,m){if(typeof p>"u"||!L(t,p))throw new x(m,p,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function L0(p){if(typeof p==="string")return U0(p,"hints"),p;else if(X(p)){let m=p.length,g0="";if(m===0)return g0;for(let r=0;r<m;r++){let J0=p[r];if(U0(J0,"hints"),g0+=J0,r!==m-1)g0+=", "}return g0}throw new x("hints",p,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}Z.exports={isInt32:b,isUint32:i,parseFileMode:I,validateArray:f,validateStringArray:c,validateBooleanArray:o,validateAbortSignalArray:K0,validateBoolean:O,validateBuffer:l,validateDictionary:_,validateEncoding:Q0,validateFunction:f0,validateInt32:W,validateInteger:G,validateNumber:H,validateObject:R,validateOneOf:J,validatePlainFunction:y,validatePort:n,validateSignalName:a,validateString:D,validateUint32:C,validateUndefined:h,validateUnion:G0,validateAbortSignal:s,validateLinkHeaderValue:L0}}),iU=s0((U,Z)=>{Z.exports=globalThis.process}),kU=s0((U,Z)=>{var{SymbolAsyncIterator:X,SymbolIterator:Q,SymbolFor:K}=Z1(),F=K("nodejs.stream.destroyed"),$=K("nodejs.stream.errored"),q=K("nodejs.stream.readable"),M=K("nodejs.stream.writable"),z=K("nodejs.stream.disturbed"),T=K("nodejs.webstream.isClosedPromise"),A=K("nodejs.webstream.controllerErrorFunction");function L(P,R=!1){var _;return!!(P&&typeof P.pipe==="function"&&typeof P.on==="function"&&(!R||typeof P.pause==="function"&&typeof P.resume==="function")&&(!P._writableState||((_=P._readableState)===null||_===void 0?void 0:_.readable)!==!1)&&(!P._writableState||P._readableState))}function E(P){var R;return!!(P&&typeof P.write==="function"&&typeof P.on==="function"&&(!P._readableState||((R=P._writableState)===null||R===void 0?void 0:R.writable)!==!1))}function S(P){return!!(P&&typeof P.pipe==="function"&&P._readableState&&typeof P.on==="function"&&typeof P.write==="function")}function j(P){return P&&(P._readableState||P._writableState||typeof P.write==="function"&&typeof P.on==="function"||typeof P.pipe==="function"&&typeof P.on==="function")}function k(P){return!!(P&&!j(P)&&typeof P.pipeThrough==="function"&&typeof P.getReader==="function"&&typeof P.cancel==="function")}function B(P){return!!(P&&!j(P)&&typeof P.getWriter==="function"&&typeof P.abort==="function")}function v(P){return!!(P&&!j(P)&&typeof P.readable==="object"&&typeof P.writable==="object")}function x(P){return k(P)||B(P)||v(P)}function N(P,R){if(P==null)return!1;if(R===!0)return typeof P[X]==="function";if(R===!1)return typeof P[Q]==="function";return typeof P[X]==="function"||typeof P[Q]==="function"}function w(P){if(!j(P))return null;let{_writableState:R,_readableState:_}=P,f=R||_;return!!(P.destroyed||P[F]||f!==null&&f!==void 0&&f.destroyed)}function u(P){if(!E(P))return null;if(P.writableEnded===!0)return!0;let R=P._writableState;if(R!==null&&R!==void 0&&R.errored)return!1;if(typeof(R===null||R===void 0?void 0:R.ended)!=="boolean")return null;return R.ended}function Z0(P,R){if(!E(P))return null;if(P.writableFinished===!0)return!0;let _=P._writableState;if(_!==null&&_!==void 0&&_.errored)return!1;if(typeof(_===null||_===void 0?void 0:_.finished)!=="boolean")return null;return!!(_.finished||R===!1&&_.ended===!0&&_.length===0)}function V0(P){if(!L(P))return null;if(P.readableEnded===!0)return!0;let R=P._readableState;if(!R||R.errored)return!1;if(typeof(R===null||R===void 0?void 0:R.ended)!=="boolean")return null;return R.ended}function Y0(P,R){if(!L(P))return null;let _=P._readableState;if(_!==null&&_!==void 0&&_.errored)return!1;if(typeof(_===null||_===void 0?void 0:_.endEmitted)!=="boolean")return null;return!!(_.endEmitted||R===!1&&_.ended===!0&&_.length===0)}function b(P){if(P&&P[q]!=null)return P[q];if(typeof(P===null||P===void 0?void 0:P.readable)!=="boolean")return null;if(w(P))return!1;return L(P)&&P.readable&&!Y0(P)}function i(P){if(P&&P[M]!=null)return P[M];if(typeof(P===null||P===void 0?void 0:P.writable)!=="boolean")return null;if(w(P))return!1;return E(P)&&P.writable&&!u(P)}function Y(P,R){if(!j(P))return null;if(w(P))return!0;if((R===null||R===void 0?void 0:R.readable)!==!1&&b(P))return!1;if((R===null||R===void 0?void 0:R.writable)!==!1&&i(P))return!1;return!0}function V(P){var R,_;if(!j(P))return null;if(P.writableErrored)return P.writableErrored;return(R=(_=P._writableState)===null||_===void 0?void 0:_.errored)!==null&&R!==void 0?R:null}function I(P){var R,_;if(!j(P))return null;if(P.readableErrored)return P.readableErrored;return(R=(_=P._readableState)===null||_===void 0?void 0:_.errored)!==null&&R!==void 0?R:null}function G(P){if(!j(P))return null;if(typeof P.closed==="boolean")return P.closed;let{_writableState:R,_readableState:_}=P;if(typeof(R===null||R===void 0?void 0:R.closed)==="boolean"||typeof(_===null||_===void 0?void 0:_.closed)==="boolean")return(R===null||R===void 0?void 0:R.closed)||(_===null||_===void 0?void 0:_.closed);if(typeof P._closed==="boolean"&&W(P))return P._closed;return null}function W(P){return typeof P._closed==="boolean"&&typeof P._defaultKeepAlive==="boolean"&&typeof P._removedConnection==="boolean"&&typeof P._removedContLen==="boolean"}function C(P){return typeof P._sent100==="boolean"&&W(P)}function D(P){var R;return typeof P._consuming==="boolean"&&typeof P._dumped==="boolean"&&((R=P.req)===null||R===void 0?void 0:R.upgradeOrConnect)===void 0}function H(P){if(!j(P))return null;let{_writableState:R,_readableState:_}=P,f=R||_;return!f&&C(P)||!!(f&&f.autoDestroy&&f.emitClose&&f.closed===!1)}function J(P){var R;return!!(P&&((R=P[z])!==null&&R!==void 0?R:P.readableDidRead||P.readableAborted))}function O(P){var R,_,f,c,o,K0,a,l,Q0,n;return!!(P&&((R=(_=(f=(c=(o=(K0=P[$])!==null&&K0!==void 0?K0:P.readableErrored)!==null&&o!==void 0?o:P.writableErrored)!==null&&c!==void 0?c:(a=P._readableState)===null||a===void 0?void 0:a.errorEmitted)!==null&&f!==void 0?f:(l=P._writableState)===null||l===void 0?void 0:l.errorEmitted)!==null&&_!==void 0?_:(Q0=P._readableState)===null||Q0===void 0?void 0:Q0.errored)!==null&&R!==void 0?R:(n=P._writableState)===null||n===void 0?void 0:n.errored))}Z.exports={isDestroyed:w,kIsDestroyed:F,isDisturbed:J,kIsDisturbed:z,isErrored:O,kIsErrored:$,isReadable:b,kIsReadable:q,kIsClosedPromise:T,kControllerErrorFunction:A,kIsWritable:M,isClosed:G,isDuplexNodeStream:S,isFinished:Y,isIterable:N,isReadableNodeStream:L,isReadableStream:k,isReadableEnded:V0,isReadableFinished:Y0,isReadableErrored:I,isNodeStream:j,isWebStream:x,isWritable:i,isWritableNodeStream:E,isWritableStream:B,isWritableEnded:u,isWritableFinished:Z0,isWritableErrored:V,isServerRequest:D,isServerResponse:C,willEmitClose:H,isTransformStream:v}}),yU=s0((U,Z)=>{var X=iU(),{AbortError:Q,codes:K}=n1(),{ERR_INVALID_ARG_TYPE:F,ERR_STREAM_PREMATURE_CLOSE:$}=K,{kEmptyObject:q,once:M}=i1(),{validateAbortSignal:z,validateFunction:T,validateObject:A,validateBoolean:L}=fZ(),{Promise:E,PromisePrototypeThen:S,SymbolDispose:j}=Z1(),{isClosed:k,isReadable:B,isReadableNodeStream:v,isReadableStream:x,isReadableFinished:N,isReadableErrored:w,isWritable:u,isWritableNodeStream:Z0,isWritableStream:V0,isWritableFinished:Y0,isWritableErrored:b,isNodeStream:i,willEmitClose:Y,kIsClosedPromise:V}=kU(),I;function G(J){return J.setHeader&&typeof J.abort==="function"}var W=()=>{};function C(J,O,P){var R,_;if(arguments.length===2)P=O,O=q;else if(O==null)O=q;else A(O,"options");if(T(P,"callback"),z(O.signal,"options.signal"),P=M(P),x(J)||V0(J))return D(J,O,P);if(!i(J))throw new F("stream",["ReadableStream","WritableStream","Stream"],J);let f=(R=O.readable)!==null&&R!==void 0?R:v(J),c=(_=O.writable)!==null&&_!==void 0?_:Z0(J),o=J._writableState,K0=J._readableState,a=()=>{if(!J.writable)n()},l=Y(J)&&v(J)===f&&Z0(J)===c,Q0=Y0(J,!1),n=()=>{if(Q0=!0,J.destroyed)l=!1;if(l&&(!J.readable||f))return;if(!f||s)P.call(J)},s=N(J,!1),f0=()=>{if(s=!0,J.destroyed)l=!1;if(l&&(!J.writable||c))return;if(!c||Q0)P.call(J)},y=(p)=>{P.call(J,p)},h=k(J),G0=()=>{h=!0;let p=b(J)||w(J);if(p&&typeof p!=="boolean")return P.call(J,p);if(f&&!s&&v(J,!0)){if(!N(J,!1))return P.call(J,new $)}if(c&&!Q0){if(!Y0(J,!1))return P.call(J,new $)}P.call(J)},t=()=>{h=!0;let p=b(J)||w(J);if(p&&typeof p!=="boolean")return P.call(J,p);P.call(J)},U0=()=>{J.req.on("finish",n)};if(G(J)){if(J.on("complete",n),!l)J.on("abort",G0);if(J.req)U0();else J.on("request",U0)}else if(c&&!o)J.on("end",a),J.on("close",a);if(!l&&typeof J.aborted==="boolean")J.on("aborted",G0);if(J.on("end",f0),J.on("finish",n),O.error!==!1)J.on("error",y);if(J.on("close",G0),h)X.nextTick(G0);else if(o!==null&&o!==void 0&&o.errorEmitted||K0!==null&&K0!==void 0&&K0.errorEmitted){if(!l)X.nextTick(t)}else if(!f&&(!l||B(J))&&(Q0||u(J)===!1))X.nextTick(t);else if(!c&&(!l||u(J))&&(s||B(J)===!1))X.nextTick(t);else if(K0&&J.req&&J.aborted)X.nextTick(t);let L0=()=>{if(P=W,J.removeListener("aborted",G0),J.removeListener("complete",n),J.removeListener("abort",G0),J.removeListener("request",U0),J.req)J.req.removeListener("finish",n);J.removeListener("end",a),J.removeListener("close",a),J.removeListener("finish",n),J.removeListener("end",f0),J.removeListener("error",y),J.removeListener("close",G0)};if(O.signal&&!h){let p=()=>{let m=P;L0(),m.call(J,new Q(void 0,{cause:O.signal.reason}))};if(O.signal.aborted)X.nextTick(p);else{I=I||i1().addAbortListener;let m=I(O.signal,p),g0=P;P=M((...r)=>{m[j](),g0.apply(J,r)})}}return L0}function D(J,O,P){let R=!1,_=W;if(O.signal)if(_=()=>{R=!0,P.call(J,new Q(void 0,{cause:O.signal.reason}))},O.signal.aborted)X.nextTick(_);else{I=I||i1().addAbortListener;let c=I(O.signal,_),o=P;P=M((...K0)=>{c[j](),o.apply(J,K0)})}let f=(...c)=>{if(!R)X.nextTick(()=>P.apply(J,c))};return S(J[V].promise,f,f),W}function H(J,O){var P;let R=!1;if(O===null)O=q;if((P=O)!==null&&P!==void 0&&P.cleanup)L(O.cleanup,"cleanup"),R=O.cleanup;return new E((_,f)=>{let c=C(J,O,(o)=>{if(R)c();if(o)f(o);else _()})})}Z.exports=C,Z.exports.finished=H}),DZ=s0((U,Z)=>{var X=iU(),{aggregateTwoErrors:Q,codes:{ERR_MULTIPLE_CALLBACK:K},AbortError:F}=n1(),{Symbol:$}=Z1(),{kIsDestroyed:q,isDestroyed:M,isFinished:z,isServerRequest:T}=kU(),A=$("kDestroy"),L=$("kConstruct");function E(Y,V,I){if(Y){if(Y.stack,V&&!V.errored)V.errored=Y;if(I&&!I.errored)I.errored=Y}}function S(Y,V){let I=this._readableState,G=this._writableState,W=G||I;if(G!==null&&G!==void 0&&G.destroyed||I!==null&&I!==void 0&&I.destroyed){if(typeof V==="function")V();return this}if(E(Y,G,I),G)G.destroyed=!0;if(I)I.destroyed=!0;if(!W.constructed)this.once(A,function(C){j(this,Q(C,Y),V)});else j(this,Y,V);return this}function j(Y,V,I){let G=!1;function W(C){if(G)return;G=!0;let{_readableState:D,_writableState:H}=Y;if(E(C,H,D),H)H.closed=!0;if(D)D.closed=!0;if(typeof I==="function")I(C);if(C)X.nextTick(k,Y,C);else X.nextTick(B,Y)}try{Y._destroy(V||null,W)}catch(C){W(C)}}function k(Y,V){v(Y,V),B(Y)}function B(Y){let{_readableState:V,_writableState:I}=Y;if(I)I.closeEmitted=!0;if(V)V.closeEmitted=!0;if(I!==null&&I!==void 0&&I.emitClose||V!==null&&V!==void 0&&V.emitClose)Y.emit("close")}function v(Y,V){let{_readableState:I,_writableState:G}=Y;if(G!==null&&G!==void 0&&G.errorEmitted||I!==null&&I!==void 0&&I.errorEmitted)return;if(G)G.errorEmitted=!0;if(I)I.errorEmitted=!0;Y.emit("error",V)}function x(){let Y=this._readableState,V=this._writableState;if(Y)Y.constructed=!0,Y.closed=!1,Y.closeEmitted=!1,Y.destroyed=!1,Y.errored=null,Y.errorEmitted=!1,Y.reading=!1,Y.ended=Y.readable===!1,Y.endEmitted=Y.readable===!1;if(V)V.constructed=!0,V.destroyed=!1,V.closed=!1,V.closeEmitted=!1,V.errored=null,V.errorEmitted=!1,V.finalCalled=!1,V.prefinished=!1,V.ended=V.writable===!1,V.ending=V.writable===!1,V.finished=V.writable===!1}function N(Y,V,I){let{_readableState:G,_writableState:W}=Y;if(W!==null&&W!==void 0&&W.destroyed||G!==null&&G!==void 0&&G.destroyed)return this;if(G!==null&&G!==void 0&&G.autoDestroy||W!==null&&W!==void 0&&W.autoDestroy)Y.destroy(V);else if(V){if(V.stack,W&&!W.errored)W.errored=V;if(G&&!G.errored)G.errored=V;if(I)X.nextTick(v,Y,V);else v(Y,V)}}function w(Y,V){if(typeof Y._construct!=="function")return;let{_readableState:I,_writableState:G}=Y;if(I)I.constructed=!1;if(G)G.constructed=!1;if(Y.once(L,V),Y.listenerCount(L)>1)return;X.nextTick(u,Y)}function u(Y){let V=!1;function I(G){if(V){N(Y,G!==null&&G!==void 0?G:new K);return}V=!0;let{_readableState:W,_writableState:C}=Y,D=C||W;if(W)W.constructed=!0;if(C)C.constructed=!0;if(D.destroyed)Y.emit(A,G);else if(G)N(Y,G,!0);else X.nextTick(Z0,Y)}try{Y._construct((G)=>{X.nextTick(I,G)})}catch(G){X.nextTick(I,G)}}function Z0(Y){Y.emit(L)}function V0(Y){return(Y===null||Y===void 0?void 0:Y.setHeader)&&typeof Y.abort==="function"}function Y0(Y){Y.emit("close")}function b(Y,V){Y.emit("error",V),X.nextTick(Y0,Y)}function i(Y,V){if(!Y||M(Y))return;if(!V&&!z(Y))V=new F;if(T(Y))Y.socket=null,Y.destroy(V);else if(V0(Y))Y.abort();else if(V0(Y.req))Y.req.abort();else if(typeof Y.destroy==="function")Y.destroy(V);else if(typeof Y.close==="function")Y.close();else if(V)X.nextTick(b,Y,V);else X.nextTick(Y0,Y);if(!Y.destroyed)Y[q]=!0}Z.exports={construct:w,destroyer:i,destroy:S,undestroy:x,errorOrDestroy:N}}),lY=s0((U,Z)=>{var{ArrayIsArray:X,ObjectSetPrototypeOf:Q}=Z1(),{EventEmitter:K}=(NZ(),m0(xZ));function F(q){K.call(this,q)}Q(F.prototype,K.prototype),Q(F,K),F.prototype.pipe=function(q,M){let z=this;function T(B){if(q.writable&&q.write(B)===!1&&z.pause)z.pause()}z.on("data",T);function A(){if(z.readable&&z.resume)z.resume()}if(q.on("drain",A),!q._isStdio&&(!M||M.end!==!1))z.on("end",E),z.on("close",S);let L=!1;function E(){if(L)return;L=!0,q.end()}function S(){if(L)return;if(L=!0,typeof q.destroy==="function")q.destroy()}function j(B){if(k(),K.listenerCount(this,"error")===0)this.emit("error",B)}$(z,"error",j),$(q,"error",j);function k(){z.removeListener("data",T),q.removeListener("drain",A),z.removeListener("end",E),z.removeListener("close",S),z.removeListener("error",j),q.removeListener("error",j),z.removeListener("end",k),z.removeListener("close",k),q.removeListener("close",k)}return z.on("end",k),z.on("close",k),q.on("close",k),q.emit("pipe",z),q};function $(q,M,z){if(typeof q.prependListener==="function")return q.prependListener(M,z);if(!q._events||!q._events[M])q.on(M,z);else if(X(q._events[M]))q._events[M].unshift(z);else q._events[M]=[z,q._events[M]]}Z.exports={Stream:F,prependListener:$}}),PX=s0((U,Z)=>{var{SymbolDispose:X}=Z1(),{AbortError:Q,codes:K}=n1(),{isNodeStream:F,isWebStream:$,kControllerErrorFunction:q}=kU(),M=yU(),{ERR_INVALID_ARG_TYPE:z}=K,T,A=(L,E)=>{if(typeof L!=="object"||!("aborted"in L))throw new z(E,"AbortSignal",L)};Z.exports.addAbortSignal=function(L,E){if(A(L,"signal"),!F(E)&&!$(E))throw new z("stream",["ReadableStream","WritableStream","Stream"],E);return Z.exports.addAbortSignalNoValidate(L,E)},Z.exports.addAbortSignalNoValidate=function(L,E){if(typeof L!=="object"||!("aborted"in L))return E;let S=F(E)?()=>{E.destroy(new Q(void 0,{cause:L.reason}))}:()=>{E[q](new Q(void 0,{cause:L.reason}))};if(L.aborted)S();else{T=T||i1().addAbortListener;let j=T(L,S);M(E,j[X])}return E}}),qI=s0((U,Z)=>{var{StringPrototypeSlice:X,SymbolIterator:Q,TypedArrayPrototypeSet:K,Uint8Array:F}=Z1(),{Buffer:$}=(g1(),m0(N1)),{inspect:q}=i1();Z.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(M){let z={data:M,next:null};if(this.length>0)this.tail.next=z;else this.head=z;this.tail=z,++this.length}unshift(M){let z={data:M,next:this.head};if(this.length===0)this.tail=z;this.head=z,++this.length}shift(){if(this.length===0)return;let M=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,M}clear(){this.head=this.tail=null,this.length=0}join(M){if(this.length===0)return"";let z=this.head,T=""+z.data;while((z=z.next)!==null)T+=M+z.data;return T}concat(M){if(this.length===0)return $.alloc(0);let z=$.allocUnsafe(M>>>0),T=this.head,A=0;while(T)K(z,T.data,A),A+=T.data.length,T=T.next;return z}consume(M,z){let T=this.head.data;if(M<T.length){let A=T.slice(0,M);return this.head.data=T.slice(M),A}if(M===T.length)return this.shift();return z?this._getString(M):this._getBuffer(M)}first(){return this.head.data}*[Q](){for(let M=this.head;M;M=M.next)yield M.data}_getString(M){let z="",T=this.head,A=0;do{let L=T.data;if(M>L.length)z+=L,M-=L.length;else{if(M===L.length)if(z+=L,++A,T.next)this.head=T.next;else this.head=this.tail=null;else z+=X(L,0,M),this.head=T,T.data=X(L,M);break}++A}while((T=T.next)!==null);return this.length-=A,z}_getBuffer(M){let z=$.allocUnsafe(M),T=M,A=this.head,L=0;do{let E=A.data;if(M>E.length)K(z,E,T-M),M-=E.length;else{if(M===E.length)if(K(z,E,T-M),++L,A.next)this.head=A.next;else this.head=this.tail=null;else K(z,new F(E.buffer,E.byteOffset,M),T-M),this.head=A,A.data=E.slice(M);break}++L}while((A=A.next)!==null);return this.length-=L,z}[Symbol.for("nodejs.util.inspect.custom")](M,z){return q(this,{...z,depth:0,customInspect:!1})}}}),kX=s0((U,Z)=>{var{MathFloor:X,NumberIsInteger:Q}=Z1(),{validateInteger:K}=fZ(),{ERR_INVALID_ARG_VALUE:F}=n1().codes,$=16384,q=16;function M(L,E,S){return L.highWaterMark!=null?L.highWaterMark:E?L[S]:null}function z(L){return L?q:$}function T(L,E){if(K(E,"value",0),L)q=E;else $=E}function A(L,E,S,j){let k=M(E,j,S);if(k!=null){if(!Q(k)||k<0){let B=j?`options.${S}`:"options.highWaterMark";throw new F(B,k)}return X(k)}return z(L.objectMode)}Z.exports={getHighWaterMark:A,getDefaultHighWaterMark:z,setDefaultHighWaterMark:T}}),MI=s0((U,Z)=>{/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var X=(g1(),m0(N1)),Q=X.Buffer;function K($,q){for(var M in $)q[M]=$[M]}if(Q.from&&Q.alloc&&Q.allocUnsafe&&Q.allocUnsafeSlow)Z.exports=X;else K(X,U),U.Buffer=F;function F($,q,M){return Q($,q,M)}F.prototype=Object.create(Q.prototype),K(Q,F),F.from=function($,q,M){if(typeof $==="number")throw TypeError("Argument must not be a number");return Q($,q,M)},F.alloc=function($,q,M){if(typeof $!=="number")throw TypeError("Argument must be a number");var z=Q($);if(q!==void 0)if(typeof M==="string")z.fill(q,M);else z.fill(q);else z.fill(0);return z},F.allocUnsafe=function($){if(typeof $!=="number")throw TypeError("Argument must be a number");return Q($)},F.allocUnsafeSlow=function($){if(typeof $!=="number")throw TypeError("Argument must be a number");return X.SlowBuffer($)}}),LI=s0((U)=>{var Z=MI().Buffer,X=Z.isEncoding||function(v){switch(v=""+v,v&&v.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function Q(v){if(!v)return"utf8";var x;while(!0)switch(v){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return v;default:if(x)return;v=(""+v).toLowerCase(),x=!0}}function K(v){var x=Q(v);if(typeof x!=="string"&&(Z.isEncoding===X||!X(v)))throw Error("Unknown encoding: "+v);return x||v}U.StringDecoder=F;function F(v){this.encoding=K(v);var x;switch(this.encoding){case"utf16le":this.text=L,this.end=E,x=4;break;case"utf8":this.fillLast=z,x=4;break;case"base64":this.text=S,this.end=j,x=3;break;default:this.write=k,this.end=B;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Z.allocUnsafe(x)}F.prototype.write=function(v){if(v.length===0)return"";var x,N;if(this.lastNeed){if(x=this.fillLast(v),x===void 0)return"";N=this.lastNeed,this.lastNeed=0}else N=0;if(N<v.length)return x?x+this.text(v,N):this.text(v,N);return x||""},F.prototype.end=A,F.prototype.text=T,F.prototype.fillLast=function(v){if(this.lastNeed<=v.length)return v.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);v.copy(this.lastChar,this.lastTotal-this.lastNeed,0,v.length),this.lastNeed-=v.length};function $(v){if(v<=127)return 0;else if(v>>5===6)return 2;else if(v>>4===14)return 3;else if(v>>3===30)return 4;return v>>6===2?-1:-2}function q(v,x,N){var w=x.length-1;if(w<N)return 0;var u=$(x[w]);if(u>=0){if(u>0)v.lastNeed=u-1;return u}if(--w<N||u===-2)return 0;if(u=$(x[w]),u>=0){if(u>0)v.lastNeed=u-2;return u}if(--w<N||u===-2)return 0;if(u=$(x[w]),u>=0){if(u>0)if(u===2)u=0;else v.lastNeed=u-3;return u}return 0}function M(v,x,N){if((x[0]&192)!==128)return v.lastNeed=0,"�";if(v.lastNeed>1&&x.length>1){if((x[1]&192)!==128)return v.lastNeed=1,"�";if(v.lastNeed>2&&x.length>2){if((x[2]&192)!==128)return v.lastNeed=2,"�"}}}function z(v){var x=this.lastTotal-this.lastNeed,N=M(this,v,x);if(N!==void 0)return N;if(this.lastNeed<=v.length)return v.copy(this.lastChar,x,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);v.copy(this.lastChar,x,0,v.length),this.lastNeed-=v.length}function T(v,x){var N=q(this,v,x);if(!this.lastNeed)return v.toString("utf8",x);this.lastTotal=N;var w=v.length-(N-this.lastNeed);return v.copy(this.lastChar,0,w),v.toString("utf8",x,w)}function A(v){var x=v&&v.length?this.write(v):"";if(this.lastNeed)return x+"�";return x}function L(v,x){if((v.length-x)%2===0){var N=v.toString("utf16le",x);if(N){var w=N.charCodeAt(N.length-1);if(w>=55296&&w<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=v[v.length-2],this.lastChar[1]=v[v.length-1],N.slice(0,-1)}return N}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=v[v.length-1],v.toString("utf16le",x,v.length-1)}function E(v){var x=v&&v.length?this.write(v):"";if(this.lastNeed){var N=this.lastTotal-this.lastNeed;return x+this.lastChar.toString("utf16le",0,N)}return x}function S(v,x){var N=(v.length-x)%3;if(N===0)return v.toString("base64",x);if(this.lastNeed=3-N,this.lastTotal=3,N===1)this.lastChar[0]=v[v.length-1];else this.lastChar[0]=v[v.length-2],this.lastChar[1]=v[v.length-1];return v.toString("base64",x,v.length-N)}function j(v){var x=v&&v.length?this.write(v):"";if(this.lastNeed)return x+this.lastChar.toString("base64",0,3-this.lastNeed);return x}function k(v){return v.toString(this.encoding)}function B(v){return v&&v.length?this.write(v):""}}),NG=s0((U,Z)=>{var X=iU(),{PromisePrototypeThen:Q,SymbolAsyncIterator:K,SymbolIterator:F}=Z1(),{Buffer:$}=(g1(),m0(N1)),{ERR_INVALID_ARG_TYPE:q,ERR_STREAM_NULL_VALUES:M}=n1().codes;function z(T,A,L){let E;if(typeof A==="string"||A instanceof $)return new T({objectMode:!0,...L,read(){this.push(A),this.push(null)}});let S;if(A&&A[K])S=!0,E=A[K]();else if(A&&A[F])S=!1,E=A[F]();else throw new q("iterable",["Iterable"],A);let j=new T({objectMode:!0,highWaterMark:1,...L}),k=!1;j._read=function(){if(!k)k=!0,v()},j._destroy=function(x,N){Q(B(x),()=>X.nextTick(N,x),(w)=>X.nextTick(N,w||x))};async function B(x){let N=x!==void 0&&x!==null,w=typeof E.throw==="function";if(N&&w){let{value:u,done:Z0}=await E.throw(x);if(await u,Z0)return}if(typeof E.return==="function"){let{value:u}=await E.return();await u}}async function v(){for(;;){try{let{value:x,done:N}=S?await E.next():E.next();if(N)j.push(null);else{let w=x&&typeof x.then==="function"?await x:x;if(w===null)throw k=!1,new M;else if(j.push(w))continue;else k=!1}}catch(x){j.destroy(x)}break}}return j}Z.exports=z}),jX=s0((U,Z)=>{var X=iU(),{ArrayPrototypeIndexOf:Q,NumberIsInteger:K,NumberIsNaN:F,NumberParseInt:$,ObjectDefineProperties:q,ObjectKeys:M,ObjectSetPrototypeOf:z,Promise:T,SafeSet:A,SymbolAsyncDispose:L,SymbolAsyncIterator:E,Symbol:S}=Z1();Z.exports=r,r.ReadableState=g0;var{EventEmitter:j}=(NZ(),m0(xZ)),{Stream:k,prependListener:B}=lY(),{Buffer:v}=(g1(),m0(N1)),{addAbortSignal:x}=PX(),N=yU(),w=i1().debuglog("stream",(g)=>{w=g}),u=qI(),Z0=DZ(),{getHighWaterMark:V0,getDefaultHighWaterMark:Y0}=kX(),{aggregateTwoErrors:b,codes:{ERR_INVALID_ARG_TYPE:i,ERR_METHOD_NOT_IMPLEMENTED:Y,ERR_OUT_OF_RANGE:V,ERR_STREAM_PUSH_AFTER_EOF:I,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:G},AbortError:W}=n1(),{validateObject:C}=fZ(),D=S("kPaused"),{StringDecoder:H}=LI(),J=NG();z(r.prototype,k.prototype),z(r,k);var O=()=>{},{errorOrDestroy:P}=Z0,R=1,_=2,f=4,c=8,o=16,K0=32,a=64,l=128,Q0=256,n=512,s=1024,f0=2048,y=4096,h=8192,G0=16384,t=32768,U0=65536,L0=131072,p=262144;function m(g){return{enumerable:!1,get(){return(this.state&g)!==0},set(d){if(d)this.state|=g;else this.state&=~g}}}q(g0.prototype,{objectMode:m(R),ended:m(_),endEmitted:m(f),reading:m(c),constructed:m(o),sync:m(K0),needReadable:m(a),emittedReadable:m(l),readableListening:m(Q0),resumeScheduled:m(n),errorEmitted:m(s),emitClose:m(f0),autoDestroy:m(y),destroyed:m(h),closed:m(G0),closeEmitted:m(t),multiAwaitDrain:m(U0),readingMore:m(L0),dataEmitted:m(p)});function g0(g,d,e){if(typeof e!=="boolean")e=d instanceof PU();if(this.state=f0|y|o|K0,g&&g.objectMode)this.state|=R;if(e&&g&&g.readableObjectMode)this.state|=R;if(this.highWaterMark=g?V0(this,g,"readableHighWaterMark",e):Y0(!1),this.buffer=new u,this.length=0,this.pipes=[],this.flowing=null,this[D]=null,g&&g.emitClose===!1)this.state&=~f0;if(g&&g.autoDestroy===!1)this.state&=~y;if(this.errored=null,this.defaultEncoding=g&&g.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,g&&g.encoding)this.decoder=new H(g.encoding),this.encoding=g.encoding}function r(g){if(!(this instanceof r))return new r(g);let d=this instanceof PU();if(this._readableState=new g0(g,this,d),g){if(typeof g.read==="function")this._read=g.read;if(typeof g.destroy==="function")this._destroy=g.destroy;if(typeof g.construct==="function")this._construct=g.construct;if(g.signal&&!d)x(g.signal,this)}k.call(this,g),Z0.construct(this,()=>{if(this._readableState.needReadable)q0(this,this._readableState)})}r.prototype.destroy=Z0.destroy,r.prototype._undestroy=Z0.undestroy,r.prototype._destroy=function(g,d){d(g)},r.prototype[j.captureRejectionSymbol]=function(g){this.destroy(g)},r.prototype[L]=function(){let g;if(!this.destroyed)g=this.readableEnded?null:new W,this.destroy(g);return new T((d,e)=>N(this,(X0)=>X0&&X0!==g?e(X0):d(null)))},r.prototype.push=function(g,d){return J0(this,g,d,!1)},r.prototype.unshift=function(g,d){return J0(this,g,d,!0)};function J0(g,d,e,X0){w("readableAddChunk",d);let y0=g._readableState,F0;if((y0.state&R)===0){if(typeof d==="string"){if(e=e||y0.defaultEncoding,y0.encoding!==e)if(X0&&y0.encoding)d=v.from(d,e).toString(y0.encoding);else d=v.from(d,e),e=""}else if(d instanceof v)e="";else if(k._isUint8Array(d))d=k._uint8ArrayToBuffer(d),e="";else if(d!=null)F0=new i("chunk",["string","Buffer","Uint8Array"],d)}if(F0)P(g,F0);else if(d===null)y0.state&=~c,I0(g,y0);else if((y0.state&R)!==0||d&&d.length>0)if(X0)if((y0.state&f)!==0)P(g,new G);else if(y0.destroyed||y0.errored)return!1;else h0(g,y0,d,!0);else if(y0.ended)P(g,new I);else if(y0.destroyed||y0.errored)return!1;else if(y0.state&=~c,y0.decoder&&!e)if(d=y0.decoder.write(d),y0.objectMode||d.length!==0)h0(g,y0,d,!1);else q0(g,y0);else h0(g,y0,d,!1);else if(!X0)y0.state&=~c,q0(g,y0);return!y0.ended&&(y0.length<y0.highWaterMark||y0.length===0)}function h0(g,d,e,X0){if(d.flowing&&d.length===0&&!d.sync&&g.listenerCount("data")>0){if((d.state&U0)!==0)d.awaitDrainWriters.clear();else d.awaitDrainWriters=null;d.dataEmitted=!0,g.emit("data",e)}else{if(d.length+=d.objectMode?1:e.length,X0)d.buffer.unshift(e);else d.buffer.push(e);if((d.state&a)!==0)C0(g)}q0(g,d)}r.prototype.isPaused=function(){let g=this._readableState;return g[D]===!0||g.flowing===!1},r.prototype.setEncoding=function(g){let d=new H(g);this._readableState.decoder=d,this._readableState.encoding=this._readableState.decoder.encoding;let e=this._readableState.buffer,X0="";for(let y0 of e)X0+=d.write(y0);if(e.clear(),X0!=="")e.push(X0);return this._readableState.length=X0.length,this};var H0=1073741824;function O0(g){if(g>H0)throw new V("size","<= 1GiB",g);else g--,g|=g>>>1,g|=g>>>2,g|=g>>>4,g|=g>>>8,g|=g>>>16,g++;return g}function J1(g,d){if(g<=0||d.length===0&&d.ended)return 0;if((d.state&R)!==0)return 1;if(F(g)){if(d.flowing&&d.length)return d.buffer.first().length;return d.length}if(g<=d.length)return g;return d.ended?d.length:0}r.prototype.read=function(g){if(w("read",g),g===void 0)g=NaN;else if(!K(g))g=$(g,10);let d=this._readableState,e=g;if(g>d.highWaterMark)d.highWaterMark=O0(g);if(g!==0)d.state&=~l;if(g===0&&d.needReadable&&((d.highWaterMark!==0?d.length>=d.highWaterMark:d.length>0)||d.ended)){if(w("read: emitReadable",d.length,d.ended),d.length===0&&d.ended)_1(this);else C0(this);return null}if(g=J1(g,d),g===0&&d.ended){if(d.length===0)_1(this);return null}let X0=(d.state&a)!==0;if(w("need readable",X0),d.length===0||d.length-g<d.highWaterMark)X0=!0,w("length less than watermark",X0);if(d.ended||d.reading||d.destroyed||d.errored||!d.constructed)X0=!1,w("reading, ended or constructing",X0);else if(X0){if(w("do read"),d.state|=c|K0,d.length===0)d.state|=a;try{this._read(d.highWaterMark)}catch(F0){P(this,F0)}if(d.state&=~K0,!d.reading)g=J1(e,d)}let y0;if(g>0)y0=E0(g,d);else y0=null;if(y0===null)d.needReadable=d.length<=d.highWaterMark,g=0;else if(d.length-=g,d.multiAwaitDrain)d.awaitDrainWriters.clear();else d.awaitDrainWriters=null;if(d.length===0){if(!d.ended)d.needReadable=!0;if(e!==g&&d.ended)_1(this)}if(y0!==null&&!d.errorEmitted&&!d.closeEmitted)d.dataEmitted=!0,this.emit("data",y0);return y0};function I0(g,d){if(w("onEofChunk"),d.ended)return;if(d.decoder){let e=d.decoder.end();if(e&&e.length)d.buffer.push(e),d.length+=d.objectMode?1:e.length}if(d.ended=!0,d.sync)C0(g);else d.needReadable=!1,d.emittedReadable=!0,K1(g)}function C0(g){let d=g._readableState;if(w("emitReadable",d.needReadable,d.emittedReadable),d.needReadable=!1,!d.emittedReadable)w("emitReadable",d.flowing),d.emittedReadable=!0,X.nextTick(K1,g)}function K1(g){let d=g._readableState;if(w("emitReadable_",d.destroyed,d.length,d.ended),!d.destroyed&&!d.errored&&(d.length||d.ended))g.emit("readable"),d.emittedReadable=!1;d.needReadable=!d.flowing&&!d.ended&&d.length<=d.highWaterMark,R0(g)}function q0(g,d){if(!d.readingMore&&d.constructed)d.readingMore=!0,X.nextTick(z0,g,d)}function z0(g,d){while(!d.reading&&!d.ended&&(d.length<d.highWaterMark||d.flowing&&d.length===0)){let e=d.length;if(w("maybeReadMore read 0"),g.read(0),e===d.length)break}d.readingMore=!1}r.prototype._read=function(g){throw new Y("_read()")},r.prototype.pipe=function(g,d){let e=this,X0=this._readableState;if(X0.pipes.length===1){if(!X0.multiAwaitDrain)X0.multiAwaitDrain=!0,X0.awaitDrainWriters=new A(X0.awaitDrainWriters?[X0.awaitDrainWriters]:[])}X0.pipes.push(g),w("pipe count=%d opts=%j",X0.pipes.length,d);let y0=(!d||d.end!==!1)&&g!==X.stdout&&g!==X.stderr?A0:b0;if(X0.endEmitted)X.nextTick(y0);else e.once("end",y0);g.on("unpipe",F0);function F0(t0,r0){if(w("onunpipe"),t0===e){if(r0&&r0.hasUnpiped===!1)r0.hasUnpiped=!0,N0()}}function A0(){w("onend"),g.end()}let Q1,P0=!1;function N0(){if(w("cleanup"),g.removeListener("close",G1),g.removeListener("finish",l0),Q1)g.removeListener("drain",Q1);if(g.removeListener("error",M0),g.removeListener("unpipe",F0),e.removeListener("end",A0),e.removeListener("end",b0),e.removeListener("data",k0),P0=!0,Q1&&X0.awaitDrainWriters&&(!g._writableState||g._writableState.needDrain))Q1()}function u1(){if(!P0){if(X0.pipes.length===1&&X0.pipes[0]===g)w("false write response, pause",0),X0.awaitDrainWriters=g,X0.multiAwaitDrain=!1;else if(X0.pipes.length>1&&X0.pipes.includes(g))w("false write response, pause",X0.awaitDrainWriters.size),X0.awaitDrainWriters.add(g);e.pause()}if(!Q1)Q1=d1(e,g),g.on("drain",Q1)}e.on("data",k0);function k0(t0){w("ondata");let r0=g.write(t0);if(w("dest.write",r0),r0===!1)u1()}function M0(t0){if(w("onerror",t0),b0(),g.removeListener("error",M0),g.listenerCount("error")===0){let r0=g._writableState||g._readableState;if(r0&&!r0.errorEmitted)P(g,t0);else g.emit("error",t0)}}B(g,"error",M0);function G1(){g.removeListener("finish",l0),b0()}g.once("close",G1);function l0(){w("onfinish"),g.removeListener("close",G1),b0()}g.once("finish",l0);function b0(){w("unpipe"),e.unpipe(g)}if(g.emit("pipe",e),g.writableNeedDrain===!0)u1();else if(!X0.flowing)w("pipe resume"),e.resume();return g};function d1(g,d){return function(){let e=g._readableState;if(e.awaitDrainWriters===d)w("pipeOnDrain",1),e.awaitDrainWriters=null;else if(e.multiAwaitDrain)w("pipeOnDrain",e.awaitDrainWriters.size),e.awaitDrainWriters.delete(d);if((!e.awaitDrainWriters||e.awaitDrainWriters.size===0)&&g.listenerCount("data"))g.resume()}}r.prototype.unpipe=function(g){let d=this._readableState,e={hasUnpiped:!1};if(d.pipes.length===0)return this;if(!g){let y0=d.pipes;d.pipes=[],this.pause();for(let F0=0;F0<y0.length;F0++)y0[F0].emit("unpipe",this,{hasUnpiped:!1});return this}let X0=Q(d.pipes,g);if(X0===-1)return this;if(d.pipes.splice(X0,1),d.pipes.length===0)this.pause();return g.emit("unpipe",this,e),this},r.prototype.on=function(g,d){let e=k.prototype.on.call(this,g,d),X0=this._readableState;if(g==="data"){if(X0.readableListening=this.listenerCount("readable")>0,X0.flowing!==!1)this.resume()}else if(g==="readable"){if(!X0.endEmitted&&!X0.readableListening){if(X0.readableListening=X0.needReadable=!0,X0.flowing=!1,X0.emittedReadable=!1,w("on readable",X0.length,X0.reading),X0.length)C0(this);else if(!X0.reading)X.nextTick(j0,this)}}return e},r.prototype.addListener=r.prototype.on,r.prototype.removeListener=function(g,d){let e=k.prototype.removeListener.call(this,g,d);if(g==="readable")X.nextTick(T0,this);return e},r.prototype.off=r.prototype.removeListener,r.prototype.removeAllListeners=function(g){let d=k.prototype.removeAllListeners.apply(this,arguments);if(g==="readable"||g===void 0)X.nextTick(T0,this);return d};function T0(g){let d=g._readableState;if(d.readableListening=g.listenerCount("readable")>0,d.resumeScheduled&&d[D]===!1)d.flowing=!0;else if(g.listenerCount("data")>0)g.resume();else if(!d.readableListening)d.flowing=null}function j0(g){w("readable nexttick read 0"),g.read(0)}r.prototype.resume=function(){let g=this._readableState;if(!g.flowing)w("resume"),g.flowing=!g.readableListening,l1(this,g);return g[D]=!1,this};function l1(g,d){if(!d.resumeScheduled)d.resumeScheduled=!0,X.nextTick(v0,g,d)}function v0(g,d){if(w("resume",d.reading),!d.reading)g.read(0);if(d.resumeScheduled=!1,g.emit("resume"),R0(g),d.flowing&&!d.reading)g.read(0)}r.prototype.pause=function(){if(w("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1)w("pause"),this._readableState.flowing=!1,this.emit("pause");return this._readableState[D]=!0,this};function R0(g){let d=g._readableState;w("flow",d.flowing);while(d.flowing&&g.read()!==null);}r.prototype.wrap=function(g){let d=!1;g.on("data",(X0)=>{if(!this.push(X0)&&g.pause)d=!0,g.pause()}),g.on("end",()=>{this.push(null)}),g.on("error",(X0)=>{P(this,X0)}),g.on("close",()=>{this.destroy()}),g.on("destroy",()=>{this.destroy()}),this._read=()=>{if(d&&g.resume)d=!1,g.resume()};let e=M(g);for(let X0=1;X0<e.length;X0++){let y0=e[X0];if(this[y0]===void 0&&typeof g[y0]==="function")this[y0]=g[y0].bind(g)}return this},r.prototype[E]=function(){return h1(this)},r.prototype.iterator=function(g){if(g!==void 0)C(g,"options");return h1(this,g)};function h1(g,d){if(typeof g.read!=="function")g=r.wrap(g,{objectMode:!0});let e=_0(g,d);return e.stream=g,e}async function*_0(g,d){let e=O;function X0(A0){if(this===g)e(),e=O;else e=A0}g.on("readable",X0);let y0,F0=N(g,{writable:!1},(A0)=>{y0=A0?b(y0,A0):null,e(),e=O});try{while(!0){let A0=g.destroyed?null:g.read();if(A0!==null)yield A0;else if(y0)throw y0;else if(y0===null)return;else await new T(X0)}}catch(A0){throw y0=b(y0,A0),y0}finally{if((y0||(d===null||d===void 0?void 0:d.destroyOnReturn)!==!1)&&(y0===void 0||g._readableState.autoDestroy))Z0.destroyer(g,null);else g.off("readable",X0),F0()}}q(r.prototype,{readable:{__proto__:null,get(){let g=this._readableState;return!!g&&g.readable!==!1&&!g.destroyed&&!g.errorEmitted&&!g.endEmitted},set(g){if(this._readableState)this._readableState.readable=!!g}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(g){if(this._readableState)this._readableState.flowing=g}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(g){if(!this._readableState)return;this._readableState.destroyed=g}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),q(g0.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[D]!==!1},set(g){this[D]=!!g}}}),r._fromList=E0;function E0(g,d){if(d.length===0)return null;let e;if(d.objectMode)e=d.buffer.shift();else if(!g||g>=d.length){if(d.decoder)e=d.buffer.join("");else if(d.buffer.length===1)e=d.buffer.first();else e=d.buffer.concat(d.length);d.buffer.clear()}else e=d.buffer.consume(g,d.decoder);return e}function _1(g){let d=g._readableState;if(w("endReadable",d.endEmitted),!d.endEmitted)d.ended=!0,X.nextTick(B0,d,g)}function B0(g,d){if(w("endReadableNT",g.endEmitted,g.length),!g.errored&&!g.closeEmitted&&!g.endEmitted&&g.length===0){if(g.endEmitted=!0,d.emit("end"),d.writable&&d.allowHalfOpen===!1)X.nextTick(x0,d);else if(g.autoDestroy){let e=d._writableState;if(!e||e.autoDestroy&&(e.finished||e.writable===!1))d.destroy()}}}function x0(g){if(g.writable&&!g.writableEnded&&!g.destroyed)g.end()}r.from=function(g,d){return J(r,g,d)};var B1;function S0(){if(B1===void 0)B1={};return B1}r.fromWeb=function(g,d){return S0().newStreamReadableFromReadableStream(g,d)},r.toWeb=function(g,d){return S0().newReadableStreamFromStreamReadable(g,d)},r.wrap=function(g,d){var e,X0;return new r({objectMode:(e=(X0=g.readableObjectMode)!==null&&X0!==void 0?X0:g.objectMode)!==null&&e!==void 0?e:!0,...d,destroy(y0,F0){Z0.destroyer(g,y0),F0(y0)}}).wrap(g)}}),oY=s0((U,Z)=>{var X=iU(),{ArrayPrototypeSlice:Q,Error:K,FunctionPrototypeSymbolHasInstance:F,ObjectDefineProperty:$,ObjectDefineProperties:q,ObjectSetPrototypeOf:M,StringPrototypeToLowerCase:z,Symbol:T,SymbolHasInstance:A}=Z1();Z.exports=C,C.WritableState=G;var{EventEmitter:L}=(NZ(),m0(xZ)),E=lY().Stream,{Buffer:S}=(g1(),m0(N1)),j=DZ(),{addAbortSignal:k}=PX(),{getHighWaterMark:B,getDefaultHighWaterMark:v}=kX(),{ERR_INVALID_ARG_TYPE:x,ERR_METHOD_NOT_IMPLEMENTED:N,ERR_MULTIPLE_CALLBACK:w,ERR_STREAM_CANNOT_PIPE:u,ERR_STREAM_DESTROYED:Z0,ERR_STREAM_ALREADY_FINISHED:V0,ERR_STREAM_NULL_VALUES:Y0,ERR_STREAM_WRITE_AFTER_END:b,ERR_UNKNOWN_ENCODING:i}=n1().codes,{errorOrDestroy:Y}=j;M(C.prototype,E.prototype),M(C,E);function V(){}var I=T("kOnFinished");function G(y,h,G0){if(typeof G0!=="boolean")G0=h instanceof PU();if(this.objectMode=!!(y&&y.objectMode),G0)this.objectMode=this.objectMode||!!(y&&y.writableObjectMode);this.highWaterMark=y?B(this,y,"writableHighWaterMark",G0):v(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let t=!!(y&&y.decodeStrings===!1);this.decodeStrings=!t,this.defaultEncoding=y&&y.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=P.bind(void 0,h),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,W(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!y||y.emitClose!==!1,this.autoDestroy=!y||y.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[I]=[]}function W(y){y.buffered=[],y.bufferedIndex=0,y.allBuffers=!0,y.allNoop=!0}G.prototype.getBuffer=function(){return Q(this.buffered,this.bufferedIndex)},$(G.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function C(y){let h=this instanceof PU();if(!h&&!F(C,this))return new C(y);if(this._writableState=new G(y,this,h),y){if(typeof y.write==="function")this._write=y.write;if(typeof y.writev==="function")this._writev=y.writev;if(typeof y.destroy==="function")this._destroy=y.destroy;if(typeof y.final==="function")this._final=y.final;if(typeof y.construct==="function")this._construct=y.construct;if(y.signal)k(y.signal,this)}E.call(this,y),j.construct(this,()=>{let G0=this._writableState;if(!G0.writing)c(this,G0);l(this,G0)})}$(C,A,{__proto__:null,value:function(y){if(F(this,y))return!0;if(this!==C)return!1;return y&&y._writableState instanceof G}}),C.prototype.pipe=function(){Y(this,new u)};function D(y,h,G0,t){let U0=y._writableState;if(typeof G0==="function")t=G0,G0=U0.defaultEncoding;else{if(!G0)G0=U0.defaultEncoding;else if(G0!=="buffer"&&!S.isEncoding(G0))throw new i(G0);if(typeof t!=="function")t=V}if(h===null)throw new Y0;else if(!U0.objectMode)if(typeof h==="string"){if(U0.decodeStrings!==!1)h=S.from(h,G0),G0="buffer"}else if(h instanceof S)G0="buffer";else if(E._isUint8Array(h))h=E._uint8ArrayToBuffer(h),G0="buffer";else throw new x("chunk",["string","Buffer","Uint8Array"],h);let L0;if(U0.ending)L0=new b;else if(U0.destroyed)L0=new Z0("write");if(L0)return X.nextTick(t,L0),Y(y,L0,!0),L0;return U0.pendingcb++,H(y,U0,h,G0,t)}C.prototype.write=function(y,h,G0){return D(this,y,h,G0)===!0},C.prototype.cork=function(){this._writableState.corked++},C.prototype.uncork=function(){let y=this._writableState;if(y.corked){if(y.corked--,!y.writing)c(this,y)}},C.prototype.setDefaultEncoding=function(y){if(typeof y==="string")y=z(y);if(!S.isEncoding(y))throw new i(y);return this._writableState.defaultEncoding=y,this};function H(y,h,G0,t,U0){let L0=h.objectMode?1:G0.length;h.length+=L0;let p=h.length<h.highWaterMark;if(!p)h.needDrain=!0;if(h.writing||h.corked||h.errored||!h.constructed){if(h.buffered.push({chunk:G0,encoding:t,callback:U0}),h.allBuffers&&t!=="buffer")h.allBuffers=!1;if(h.allNoop&&U0!==V)h.allNoop=!1}else h.writelen=L0,h.writecb=U0,h.writing=!0,h.sync=!0,y._write(G0,t,h.onwrite),h.sync=!1;return p&&!h.errored&&!h.destroyed}function J(y,h,G0,t,U0,L0,p){if(h.writelen=t,h.writecb=p,h.writing=!0,h.sync=!0,h.destroyed)h.onwrite(new Z0("write"));else if(G0)y._writev(U0,h.onwrite);else y._write(U0,L0,h.onwrite);h.sync=!1}function O(y,h,G0,t){--h.pendingcb,t(G0),f(h),Y(y,G0)}function P(y,h){let G0=y._writableState,t=G0.sync,U0=G0.writecb;if(typeof U0!=="function"){Y(y,new w);return}if(G0.writing=!1,G0.writecb=null,G0.length-=G0.writelen,G0.writelen=0,h){if(h.stack,!G0.errored)G0.errored=h;if(y._readableState&&!y._readableState.errored)y._readableState.errored=h;if(t)X.nextTick(O,y,G0,h,U0);else O(y,G0,h,U0)}else{if(G0.buffered.length>G0.bufferedIndex)c(y,G0);if(t)if(G0.afterWriteTickInfo!==null&&G0.afterWriteTickInfo.cb===U0)G0.afterWriteTickInfo.count++;else G0.afterWriteTickInfo={count:1,cb:U0,stream:y,state:G0},X.nextTick(R,G0.afterWriteTickInfo);else _(y,G0,1,U0)}}function R({stream:y,state:h,count:G0,cb:t}){return h.afterWriteTickInfo=null,_(y,h,G0,t)}function _(y,h,G0,t){if(!h.ending&&!y.destroyed&&h.length===0&&h.needDrain)h.needDrain=!1,y.emit("drain");while(G0-- >0)h.pendingcb--,t();if(h.destroyed)f(h);l(y,h)}function f(y){if(y.writing)return;for(let U0=y.bufferedIndex;U0<y.buffered.length;++U0){var h;let{chunk:L0,callback:p}=y.buffered[U0],m=y.objectMode?1:L0.length;y.length-=m,p((h=y.errored)!==null&&h!==void 0?h:new Z0("write"))}let G0=y[I].splice(0);for(let U0=0;U0<G0.length;U0++){var t;G0[U0]((t=y.errored)!==null&&t!==void 0?t:new Z0("end"))}W(y)}function c(y,h){if(h.corked||h.bufferProcessing||h.destroyed||!h.constructed)return;let{buffered:G0,bufferedIndex:t,objectMode:U0}=h,L0=G0.length-t;if(!L0)return;let p=t;if(h.bufferProcessing=!0,L0>1&&y._writev){h.pendingcb-=L0-1;let m=h.allNoop?V:(r)=>{for(let J0=p;J0<G0.length;++J0)G0[J0].callback(r)},g0=h.allNoop&&p===0?G0:Q(G0,p);g0.allBuffers=h.allBuffers,J(y,h,!0,h.length,g0,"",m),W(h)}else{do{let{chunk:m,encoding:g0,callback:r}=G0[p];G0[p++]=null;let J0=U0?1:m.length;J(y,h,!1,J0,m,g0,r)}while(p<G0.length&&!h.writing);if(p===G0.length)W(h);else if(p>256)G0.splice(0,p),h.bufferedIndex=0;else h.bufferedIndex=p}h.bufferProcessing=!1}C.prototype._write=function(y,h,G0){if(this._writev)this._writev([{chunk:y,encoding:h}],G0);else throw new N("_write()")},C.prototype._writev=null,C.prototype.end=function(y,h,G0){let t=this._writableState;if(typeof y==="function")G0=y,y=null,h=null;else if(typeof h==="function")G0=h,h=null;let U0;if(y!==null&&y!==void 0){let L0=D(this,y,h);if(L0 instanceof K)U0=L0}if(t.corked)t.corked=1,this.uncork();if(U0);else if(!t.errored&&!t.ending)t.ending=!0,l(this,t,!0),t.ended=!0;else if(t.finished)U0=new V0("end");else if(t.destroyed)U0=new Z0("end");if(typeof G0==="function")if(U0||t.finished)X.nextTick(G0,U0);else t[I].push(G0);return this};function o(y){return y.ending&&!y.destroyed&&y.constructed&&y.length===0&&!y.errored&&y.buffered.length===0&&!y.finished&&!y.writing&&!y.errorEmitted&&!y.closeEmitted}function K0(y,h){let G0=!1;function t(U0){if(G0){Y(y,U0!==null&&U0!==void 0?U0:w());return}if(G0=!0,h.pendingcb--,U0){let L0=h[I].splice(0);for(let p=0;p<L0.length;p++)L0[p](U0);Y(y,U0,h.sync)}else if(o(h))h.prefinished=!0,y.emit("prefinish"),h.pendingcb++,X.nextTick(Q0,y,h)}h.sync=!0,h.pendingcb++;try{y._final(t)}catch(U0){t(U0)}h.sync=!1}function a(y,h){if(!h.prefinished&&!h.finalCalled)if(typeof y._final==="function"&&!h.destroyed)h.finalCalled=!0,K0(y,h);else h.prefinished=!0,y.emit("prefinish")}function l(y,h,G0){if(o(h)){if(a(y,h),h.pendingcb===0){if(G0)h.pendingcb++,X.nextTick((t,U0)=>{if(o(U0))Q0(t,U0);else U0.pendingcb--},y,h);else if(o(h))h.pendingcb++,Q0(y,h)}}}function Q0(y,h){h.pendingcb--,h.finished=!0;let G0=h[I].splice(0);for(let t=0;t<G0.length;t++)G0[t]();if(y.emit("finish"),h.autoDestroy){let t=y._readableState;if(!t||t.autoDestroy&&(t.endEmitted||t.readable===!1))y.destroy()}}q(C.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(y){if(this._writableState)this._writableState.destroyed=y}},writable:{__proto__:null,get(){let y=this._writableState;return!!y&&y.writable!==!1&&!y.destroyed&&!y.errored&&!y.ending&&!y.ended},set(y){if(this._writableState)this._writableState.writable=!!y}},writableFinished:{__proto__:null,get(){return this._writableState?this._writableState.finished:!1}},writableObjectMode:{__proto__:null,get(){return this._writableState?this._writableState.objectMode:!1}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return this._writableState?this._writableState.ending:!1}},writableNeedDrain:{__proto__:null,get(){let y=this._writableState;if(!y)return!1;return!y.destroyed&&!y.ending&&y.needDrain}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._writableState.writable!==!1&&(this._writableState.destroyed||this._writableState.errored)&&!this._writableState.finished)}}});var n=j.destroy;C.prototype.destroy=function(y,h){let G0=this._writableState;if(!G0.destroyed&&(G0.bufferedIndex<G0.buffered.length||G0[I].length))X.nextTick(f,G0);return n.call(this,y,h),this},C.prototype._undestroy=j.undestroy,C.prototype._destroy=function(y,h){h(y)},C.prototype[L.captureRejectionSymbol]=function(y){this.destroy(y)};var s;function f0(){if(s===void 0)s={};return s}C.fromWeb=function(y,h){return f0().newStreamWritableFromWritableStream(y,h)},C.toWeb=function(y){return f0().newWritableStreamFromStreamWritable(y)}}),TI=s0((U,Z)=>{var X=iU(),Q=(g1(),m0(N1)),{isReadable:K,isWritable:F,isIterable:$,isNodeStream:q,isReadableNodeStream:M,isWritableNodeStream:z,isDuplexNodeStream:T,isReadableStream:A,isWritableStream:L}=kU(),E=yU(),{AbortError:S,codes:{ERR_INVALID_ARG_TYPE:j,ERR_INVALID_RETURN_VALUE:k}}=n1(),{destroyer:B}=DZ(),v=PU(),x=jX(),N=oY(),{createDeferredPromise:w}=i1(),u=NG(),Z0=globalThis.Blob||Q.Blob,V0=typeof Z0<"u"?function(I){return I instanceof Z0}:function(I){return!1},Y0=globalThis.AbortController||gZ().AbortController,{FunctionPrototypeCall:b}=Z1();class i extends v{constructor(I){super(I);if((I===null||I===void 0?void 0:I.readable)===!1)this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0;if((I===null||I===void 0?void 0:I.writable)===!1)this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0}}Z.exports=function I(G,W){if(T(G))return G;if(M(G))return V({readable:G});if(z(G))return V({writable:G});if(q(G))return V({writable:!1,readable:!1});if(A(G))return V({readable:x.fromWeb(G)});if(L(G))return V({writable:N.fromWeb(G)});if(typeof G==="function"){let{value:D,write:H,final:J,destroy:O}=Y(G);if($(D))return u(i,D,{objectMode:!0,write:H,final:J,destroy:O});let P=D===null||D===void 0?void 0:D.then;if(typeof P==="function"){let R,_=b(P,D,(f)=>{if(f!=null)throw new k("nully","body",f)},(f)=>{B(R,f)});return R=new i({objectMode:!0,readable:!1,write:H,final(f){J(async()=>{try{await _,X.nextTick(f,null)}catch(c){X.nextTick(f,c)}})},destroy:O})}throw new k("Iterable, AsyncIterable or AsyncFunction",W,D)}if(V0(G))return I(G.arrayBuffer());if($(G))return u(i,G,{objectMode:!0,writable:!1});if(A(G===null||G===void 0?void 0:G.readable)&&L(G===null||G===void 0?void 0:G.writable))return i.fromWeb(G);if(typeof(G===null||G===void 0?void 0:G.writable)==="object"||typeof(G===null||G===void 0?void 0:G.readable)==="object"){let D=G!==null&&G!==void 0&&G.readable?M(G===null||G===void 0?void 0:G.readable)?G===null||G===void 0?void 0:G.readable:I(G.readable):void 0,H=G!==null&&G!==void 0&&G.writable?z(G===null||G===void 0?void 0:G.writable)?G===null||G===void 0?void 0:G.writable:I(G.writable):void 0;return V({readable:D,writable:H})}let C=G===null||G===void 0?void 0:G.then;if(typeof C==="function"){let D;return b(C,G,(H)=>{if(H!=null)D.push(H);D.push(null)},(H)=>{B(D,H)}),D=new i({objectMode:!0,writable:!1,read(){}})}throw new j(W,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],G)};function Y(I){let{promise:G,resolve:W}=w(),C=new Y0,D=C.signal;return{value:I(async function*(){while(!0){let H=G;G=null;let{chunk:J,done:O,cb:P}=await H;if(X.nextTick(P),O)return;if(D.aborted)throw new S(void 0,{cause:D.reason});({promise:G,resolve:W}=w()),yield J}}(),{signal:D}),write(H,J,O){let P=W;W=null,P({chunk:H,done:!1,cb:O})},final(H){let J=W;W=null,J({done:!0,cb:H})},destroy(H,J){C.abort(),J(H)}}}function V(I){let G=I.readable&&typeof I.readable.read!=="function"?x.wrap(I.readable):I.readable,W=I.writable,C=!!K(G),D=!!F(W),H,J,O,P,R;function _(f){let c=P;if(P=null,c)c(f);else if(f)R.destroy(f)}if(R=new i({readableObjectMode:!!(G!==null&&G!==void 0&&G.readableObjectMode),writableObjectMode:!!(W!==null&&W!==void 0&&W.writableObjectMode),readable:C,writable:D}),D)E(W,(f)=>{if(D=!1,f)B(G,f);_(f)}),R._write=function(f,c,o){if(W.write(f,c))o();else H=o},R._final=function(f){W.end(),J=f},W.on("drain",function(){if(H){let f=H;H=null,f()}}),W.on("finish",function(){if(J){let f=J;J=null,f()}});if(C)E(G,(f)=>{if(C=!1,f)B(G,f);_(f)}),G.on("readable",function(){if(O){let f=O;O=null,f()}}),G.on("end",function(){R.push(null)}),R._read=function(){while(!0){let f=G.read();if(f===null){O=R._read;return}if(!R.push(f))return}};return R._destroy=function(f,c){if(!f&&P!==null)f=new S;if(O=null,H=null,J=null,P===null)c(f);else P=c,B(W,f),B(G,f)},R}}),PU=s0((U,Z)=>{var{ObjectDefineProperties:X,ObjectGetOwnPropertyDescriptor:Q,ObjectKeys:K,ObjectSetPrototypeOf:F}=Z1();Z.exports=M;var $=jX(),q=oY();F(M.prototype,$.prototype),F(M,$);{let L=K(q.prototype);for(let E=0;E<L.length;E++){let S=L[E];if(!M.prototype[S])M.prototype[S]=q.prototype[S]}}function M(L){if(!(this instanceof M))return new M(L);if($.call(this,L),q.call(this,L),L){if(this.allowHalfOpen=L.allowHalfOpen!==!1,L.readable===!1)this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0;if(L.writable===!1)this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0}else this.allowHalfOpen=!0}X(M.prototype,{writable:{__proto__:null,...Q(q.prototype,"writable")},writableHighWaterMark:{__proto__:null,...Q(q.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...Q(q.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...Q(q.prototype,"writableBuffer")},writableLength:{__proto__:null,...Q(q.prototype,"writableLength")},writableFinished:{__proto__:null,...Q(q.prototype,"writableFinished")},writableCorked:{__proto__:null,...Q(q.prototype,"writableCorked")},writableEnded:{__proto__:null,...Q(q.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...Q(q.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){if(this._readableState===void 0||this._writableState===void 0)return!1;return this._readableState.destroyed&&this._writableState.destroyed},set(L){if(this._readableState&&this._writableState)this._readableState.destroyed=L,this._writableState.destroyed=L}}});var z;function T(){if(z===void 0)z={};return z}M.fromWeb=function(L,E){return T().newStreamDuplexFromReadableWritablePair(L,E)},M.toWeb=function(L){return T().newReadableWritablePairFromDuplex(L)};var A;M.from=function(L){if(!A)A=TI();return A(L,"body")}}),gG=s0((U,Z)=>{var{ObjectSetPrototypeOf:X,Symbol:Q}=Z1();Z.exports=M;var{ERR_METHOD_NOT_IMPLEMENTED:K}=n1().codes,F=PU(),{getHighWaterMark:$}=kX();X(M.prototype,F.prototype),X(M,F);var q=Q("kCallback");function M(A){if(!(this instanceof M))return new M(A);let L=A?$(this,A,"readableHighWaterMark",!0):null;if(L===0)A={...A,highWaterMark:null,readableHighWaterMark:L,writableHighWaterMark:A.writableHighWaterMark||0};if(F.call(this,A),this._readableState.sync=!1,this[q]=null,A){if(typeof A.transform==="function")this._transform=A.transform;if(typeof A.flush==="function")this._flush=A.flush}this.on("prefinish",T)}function z(A){if(typeof this._flush==="function"&&!this.destroyed)this._flush((L,E)=>{if(L){if(A)A(L);else this.destroy(L);return}if(E!=null)this.push(E);if(this.push(null),A)A()});else if(this.push(null),A)A()}function T(){if(this._final!==z)z.call(this)}M.prototype._final=z,M.prototype._transform=function(A,L,E){throw new K("_transform()")},M.prototype._write=function(A,L,E){let S=this._readableState,j=this._writableState,k=S.length;this._transform(A,L,(B,v)=>{if(B){E(B);return}if(v!=null)this.push(v);if(j.ended||k===S.length||S.length<S.highWaterMark)E();else this[q]=E})},M.prototype._read=function(){if(this[q]){let A=this[q];this[q]=null,A()}}}),fG=s0((U,Z)=>{var{ObjectSetPrototypeOf:X}=Z1();Z.exports=K;var Q=gG();X(K.prototype,Q.prototype),X(K,Q);function K(F){if(!(this instanceof K))return new K(F);Q.call(this,F)}K.prototype._transform=function(F,$,q){q(null,F)}}),nY=s0((U,Z)=>{var X=iU(),{ArrayIsArray:Q,Promise:K,SymbolAsyncIterator:F,SymbolDispose:$}=Z1(),q=yU(),{once:M}=i1(),z=DZ(),T=PU(),{aggregateTwoErrors:A,codes:{ERR_INVALID_ARG_TYPE:L,ERR_INVALID_RETURN_VALUE:E,ERR_MISSING_ARGS:S,ERR_STREAM_DESTROYED:j,ERR_STREAM_PREMATURE_CLOSE:k},AbortError:B}=n1(),{validateFunction:v,validateAbortSignal:x}=fZ(),{isIterable:N,isReadable:w,isReadableNodeStream:u,isNodeStream:Z0,isTransformStream:V0,isWebStream:Y0,isReadableStream:b,isReadableFinished:i}=kU(),Y=globalThis.AbortController||gZ().AbortController,V,I,G;function W(f,c,o){let K0=!1;f.on("close",()=>{K0=!0});let a=q(f,{readable:c,writable:o},(l)=>{K0=!l});return{destroy:(l)=>{if(K0)return;K0=!0,z.destroyer(f,l||new j("pipe"))},cleanup:a}}function C(f){return v(f[f.length-1],"streams[stream.length - 1]"),f.pop()}function D(f){if(N(f))return f;else if(u(f))return H(f);throw new L("val",["Readable","Iterable","AsyncIterable"],f)}async function*H(f){if(!I)I=jX();yield*I.prototype[F].call(f)}async function J(f,c,o,{end:K0}){let a,l=null,Q0=(f0)=>{if(f0)a=f0;if(l){let y=l;l=null,y()}},n=()=>new K((f0,y)=>{if(a)y(a);else l=()=>{if(a)y(a);else f0()}});c.on("drain",Q0);let s=q(c,{readable:!1},Q0);try{if(c.writableNeedDrain)await n();for await(let f0 of f)if(!c.write(f0))await n();if(K0)c.end(),await n();o()}catch(f0){o(a!==f0?A(a,f0):f0)}finally{s(),c.off("drain",Q0)}}async function O(f,c,o,{end:K0}){if(V0(c))c=c.writable;let a=c.getWriter();try{for await(let l of f)await a.ready,a.write(l).catch(()=>{});if(await a.ready,K0)await a.close();o()}catch(l){try{await a.abort(l),o(l)}catch(Q0){o(Q0)}}}function P(...f){return R(f,M(C(f)))}function R(f,c,o){if(f.length===1&&Q(f[0]))f=f[0];if(f.length<2)throw new S("streams");let K0=new Y,a=K0.signal,l=o===null||o===void 0?void 0:o.signal,Q0=[];x(l,"options.signal");function n(){U0(new B)}G=G||i1().addAbortListener;let s;if(l)s=G(l,n);let f0,y,h=[],G0=0;function t(r){U0(r,--G0===0)}function U0(r,J0){var h0;if(r&&(!f0||f0.code==="ERR_STREAM_PREMATURE_CLOSE"))f0=r;if(!f0&&!J0)return;while(h.length)h.shift()(f0);if((h0=s)===null||h0===void 0||h0[$](),K0.abort(),J0){if(!f0)Q0.forEach((H0)=>H0());X.nextTick(c,f0,y)}}let L0;for(let r=0;r<f.length;r++){let J0=f[r],h0=r<f.length-1,H0=r>0,O0=h0||(o===null||o===void 0?void 0:o.end)!==!1,J1=r===f.length-1;if(Z0(J0)){let I0=function(C0){if(C0&&C0.name!=="AbortError"&&C0.code!=="ERR_STREAM_PREMATURE_CLOSE")t(C0)};var p=I0;if(O0){let{destroy:C0,cleanup:K1}=W(J0,h0,H0);if(h.push(C0),w(J0)&&J1)Q0.push(K1)}if(J0.on("error",I0),w(J0)&&J1)Q0.push(()=>{J0.removeListener("error",I0)})}if(r===0)if(typeof J0==="function"){if(L0=J0({signal:a}),!N(L0))throw new E("Iterable, AsyncIterable or Stream","source",L0)}else if(N(J0)||u(J0)||V0(J0))L0=J0;else L0=T.from(J0);else if(typeof J0==="function"){if(V0(L0)){var m;L0=D((m=L0)===null||m===void 0?void 0:m.readable)}else L0=D(L0);if(L0=J0(L0,{signal:a}),h0){if(!N(L0,!0))throw new E("AsyncIterable",`transform[${r-1}]`,L0)}else{var g0;if(!V)V=fG();let I0=new V({objectMode:!0}),C0=(g0=L0)===null||g0===void 0?void 0:g0.then;if(typeof C0==="function")G0++,C0.call(L0,(z0)=>{if(y=z0,z0!=null)I0.write(z0);if(O0)I0.end();X.nextTick(t)},(z0)=>{I0.destroy(z0),X.nextTick(t,z0)});else if(N(L0,!0))G0++,J(L0,I0,t,{end:O0});else if(b(L0)||V0(L0)){let z0=L0.readable||L0;G0++,J(z0,I0,t,{end:O0})}else throw new E("AsyncIterable or Promise","destination",L0);L0=I0;let{destroy:K1,cleanup:q0}=W(L0,!1,!0);if(h.push(K1),J1)Q0.push(q0)}}else if(Z0(J0)){if(u(L0)){G0+=2;let I0=_(L0,J0,t,{end:O0});if(w(J0)&&J1)Q0.push(I0)}else if(V0(L0)||b(L0)){let I0=L0.readable||L0;G0++,J(I0,J0,t,{end:O0})}else if(N(L0))G0++,J(L0,J0,t,{end:O0});else throw new L("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],L0);L0=J0}else if(Y0(J0)){if(u(L0))G0++,O(D(L0),J0,t,{end:O0});else if(b(L0)||N(L0))G0++,O(L0,J0,t,{end:O0});else if(V0(L0))G0++,O(L0.readable,J0,t,{end:O0});else throw new L("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],L0);L0=J0}else L0=T.from(J0)}if(a!==null&&a!==void 0&&a.aborted||l!==null&&l!==void 0&&l.aborted)X.nextTick(n);return L0}function _(f,c,o,{end:K0}){let a=!1;if(c.on("close",()=>{if(!a)o(new k)}),f.pipe(c,{end:!1}),K0){let Q0=function(){a=!0,c.end()};var l=Q0;if(i(f))X.nextTick(Q0);else f.once("end",Q0)}else o();return q(f,{readable:!0,writable:!1},(Q0)=>{let n=f._readableState;if(Q0&&Q0.code==="ERR_STREAM_PREMATURE_CLOSE"&&n&&n.ended&&!n.errored&&!n.errorEmitted)f.once("end",o).once("error",o);else o(Q0)}),q(c,{readable:!1,writable:!0},o)}Z.exports={pipelineImpl:R,pipeline:P}}),wG=s0((U,Z)=>{var{pipeline:X}=nY(),Q=PU(),{destroyer:K}=DZ(),{isNodeStream:F,isReadable:$,isWritable:q,isWebStream:M,isTransformStream:z,isWritableStream:T,isReadableStream:A}=kU(),{AbortError:L,codes:{ERR_INVALID_ARG_VALUE:E,ERR_MISSING_ARGS:S}}=n1(),j=yU();Z.exports=function(...k){if(k.length===0)throw new S("streams");if(k.length===1)return Q.from(k[0]);let B=[...k];if(typeof k[0]==="function")k[0]=Q.from(k[0]);if(typeof k[k.length-1]==="function"){let Y=k.length-1;k[Y]=Q.from(k[Y])}for(let Y=0;Y<k.length;++Y){if(!F(k[Y])&&!M(k[Y]))continue;if(Y<k.length-1&&!($(k[Y])||A(k[Y])||z(k[Y])))throw new E(`streams[${Y}]`,B[Y],"must be readable");if(Y>0&&!(q(k[Y])||T(k[Y])||z(k[Y])))throw new E(`streams[${Y}]`,B[Y],"must be writable")}let v,x,N,w,u;function Z0(Y){let V=w;if(w=null,V)V(Y);else if(Y)u.destroy(Y);else if(!i&&!b)u.destroy()}let V0=k[0],Y0=X(k,Z0),b=!!(q(V0)||T(V0)||z(V0)),i=!!($(Y0)||A(Y0)||z(Y0));if(u=new Q({writableObjectMode:!!(V0!==null&&V0!==void 0&&V0.writableObjectMode),readableObjectMode:!!(Y0!==null&&Y0!==void 0&&Y0.readableObjectMode),writable:b,readable:i}),b){if(F(V0))u._write=function(V,I,G){if(V0.write(V,I))G();else v=G},u._final=function(V){V0.end(),x=V},V0.on("drain",function(){if(v){let V=v;v=null,V()}});else if(M(V0)){let V=(z(V0)?V0.writable:V0).getWriter();u._write=async function(I,G,W){try{await V.ready,V.write(I).catch(()=>{}),W()}catch(C){W(C)}},u._final=async function(I){try{await V.ready,V.close().catch(()=>{}),x=I}catch(G){I(G)}}}let Y=z(Y0)?Y0.readable:Y0;j(Y,()=>{if(x){let V=x;x=null,V()}})}if(i){if(F(Y0))Y0.on("readable",function(){if(N){let Y=N;N=null,Y()}}),Y0.on("end",function(){u.push(null)}),u._read=function(){while(!0){let Y=Y0.read();if(Y===null){N=u._read;return}if(!u.push(Y))return}};else if(M(Y0)){let Y=(z(Y0)?Y0.readable:Y0).getReader();u._read=async function(){while(!0)try{let{value:V,done:I}=await Y.read();if(!u.push(V))return;if(I){u.push(null);return}}catch{return}}}}return u._destroy=function(Y,V){if(!Y&&w!==null)Y=new L;if(N=null,v=null,x=null,w===null)V(Y);else if(w=V,F(Y0))K(Y0,Y)},u}}),RI=s0((U,Z)=>{var X=globalThis.AbortController||gZ().AbortController,{codes:{ERR_INVALID_ARG_VALUE:Q,ERR_INVALID_ARG_TYPE:K,ERR_MISSING_ARGS:F,ERR_OUT_OF_RANGE:$},AbortError:q}=n1(),{validateAbortSignal:M,validateInteger:z,validateObject:T}=fZ(),A=Z1().Symbol("kWeak"),L=Z1().Symbol("kResistStopPropagation"),{finished:E}=yU(),S=wG(),{addAbortSignalNoValidate:j}=PX(),{isWritable:k,isNodeStream:B}=kU(),{deprecate:v}=i1(),{ArrayPrototypePush:x,Boolean:N,MathFloor:w,Number:u,NumberIsNaN:Z0,Promise:V0,PromiseReject:Y0,PromiseResolve:b,PromisePrototypeThen:i,Symbol:Y}=Z1(),V=Y("kEmpty"),I=Y("kEof");function G(l,Q0){if(Q0!=null)T(Q0,"options");if((Q0===null||Q0===void 0?void 0:Q0.signal)!=null)M(Q0.signal,"options.signal");if(B(l)&&!k(l))throw new Q("stream",l,"must be writable");let n=S(this,l);if(Q0!==null&&Q0!==void 0&&Q0.signal)j(Q0.signal,n);return n}function W(l,Q0){if(typeof l!=="function")throw new K("fn",["Function","AsyncFunction"],l);if(Q0!=null)T(Q0,"options");if((Q0===null||Q0===void 0?void 0:Q0.signal)!=null)M(Q0.signal,"options.signal");let n=1;if((Q0===null||Q0===void 0?void 0:Q0.concurrency)!=null)n=w(Q0.concurrency);let s=n-1;if((Q0===null||Q0===void 0?void 0:Q0.highWaterMark)!=null)s=w(Q0.highWaterMark);return z(n,"options.concurrency",1),z(s,"options.highWaterMark",0),s+=n,async function*(){let f0=i1().AbortSignalAny([Q0===null||Q0===void 0?void 0:Q0.signal].filter(N)),y=this,h=[],G0={signal:f0},t,U0,L0=!1,p=0;function m(){L0=!0,g0()}function g0(){p-=1,r()}function r(){if(U0&&!L0&&p<n&&h.length<s)U0(),U0=null}async function J0(){try{for await(let h0 of y){if(L0)return;if(f0.aborted)throw new q;try{if(h0=l(h0,G0),h0===V)continue;h0=b(h0)}catch(H0){h0=Y0(H0)}if(p+=1,i(h0,g0,m),h.push(h0),t)t(),t=null;if(!L0&&(h.length>=s||p>=n))await new V0((H0)=>{U0=H0})}h.push(I)}catch(h0){let H0=Y0(h0);i(H0,g0,m),h.push(H0)}finally{if(L0=!0,t)t(),t=null}}J0();try{while(!0){while(h.length>0){let h0=await h[0];if(h0===I)return;if(f0.aborted)throw new q;if(h0!==V)yield h0;h.shift(),r()}await new V0((h0)=>{t=h0})}}finally{if(L0=!0,U0)U0(),U0=null}}.call(this)}function C(l=void 0){if(l!=null)T(l,"options");if((l===null||l===void 0?void 0:l.signal)!=null)M(l.signal,"options.signal");return async function*(){let Q0=0;for await(let s of this){var n;if(l!==null&&l!==void 0&&(n=l.signal)!==null&&n!==void 0&&n.aborted)throw new q({cause:l.signal.reason});yield[Q0++,s]}}.call(this)}async function D(l,Q0=void 0){for await(let n of P.call(this,l,Q0))return!0;return!1}async function H(l,Q0=void 0){if(typeof l!=="function")throw new K("fn",["Function","AsyncFunction"],l);return!await D.call(this,async(...n)=>{return!await l(...n)},Q0)}async function J(l,Q0){for await(let n of P.call(this,l,Q0))return n;return}async function O(l,Q0){if(typeof l!=="function")throw new K("fn",["Function","AsyncFunction"],l);async function n(s,f0){return await l(s,f0),V}for await(let s of W.call(this,n,Q0));}function P(l,Q0){if(typeof l!=="function")throw new K("fn",["Function","AsyncFunction"],l);async function n(s,f0){if(await l(s,f0))return s;return V}return W.call(this,n,Q0)}class R extends F{constructor(){super("reduce");this.message="Reduce of an empty stream requires an initial value"}}async function _(l,Q0,n){var s;if(typeof l!=="function")throw new K("reducer",["Function","AsyncFunction"],l);if(n!=null)T(n,"options");if((n===null||n===void 0?void 0:n.signal)!=null)M(n.signal,"options.signal");let f0=arguments.length>1;if(n!==null&&n!==void 0&&(s=n.signal)!==null&&s!==void 0&&s.aborted){let U0=new q(void 0,{cause:n.signal.reason});throw this.once("error",()=>{}),await E(this.destroy(U0)),U0}let y=new X,h=y.signal;if(n!==null&&n!==void 0&&n.signal){let U0={once:!0,[A]:this,[L]:!0};n.signal.addEventListener("abort",()=>y.abort(),U0)}let G0=!1;try{for await(let U0 of this){var t;if(G0=!0,n!==null&&n!==void 0&&(t=n.signal)!==null&&t!==void 0&&t.aborted)throw new q;if(!f0)Q0=U0,f0=!0;else Q0=await l(Q0,U0,{signal:h})}if(!G0&&!f0)throw new R}finally{y.abort()}return Q0}async function f(l){if(l!=null)T(l,"options");if((l===null||l===void 0?void 0:l.signal)!=null)M(l.signal,"options.signal");let Q0=[];for await(let s of this){var n;if(l!==null&&l!==void 0&&(n=l.signal)!==null&&n!==void 0&&n.aborted)throw new q(void 0,{cause:l.signal.reason});x(Q0,s)}return Q0}function c(l,Q0){let n=W.call(this,l,Q0);return async function*(){for await(let s of n)yield*s}.call(this)}function o(l){if(l=u(l),Z0(l))return 0;if(l<0)throw new $("number",">= 0",l);return l}function K0(l,Q0=void 0){if(Q0!=null)T(Q0,"options");if((Q0===null||Q0===void 0?void 0:Q0.signal)!=null)M(Q0.signal,"options.signal");return l=o(l),async function*(){var n;if(Q0!==null&&Q0!==void 0&&(n=Q0.signal)!==null&&n!==void 0&&n.aborted)throw new q;for await(let f0 of this){var s;if(Q0!==null&&Q0!==void 0&&(s=Q0.signal)!==null&&s!==void 0&&s.aborted)throw new q;if(l--<=0)yield f0}}.call(this)}function a(l,Q0=void 0){if(Q0!=null)T(Q0,"options");if((Q0===null||Q0===void 0?void 0:Q0.signal)!=null)M(Q0.signal,"options.signal");return l=o(l),async function*(){var n;if(Q0!==null&&Q0!==void 0&&(n=Q0.signal)!==null&&n!==void 0&&n.aborted)throw new q;for await(let f0 of this){var s;if(Q0!==null&&Q0!==void 0&&(s=Q0.signal)!==null&&s!==void 0&&s.aborted)throw new q;if(l-- >0)yield f0;if(l<=0)return}}.call(this)}Z.exports.streamReturningOperators={asIndexedPairs:v(C,"readable.asIndexedPairs will be removed in a future version."),drop:K0,filter:P,flatMap:c,map:W,take:a,compose:G},Z.exports.promiseReturningOperators={every:H,forEach:O,reduce:_,toArray:f,some:D,find:J}}),yG=s0((U,Z)=>{var{ArrayPrototypePop:X,Promise:Q}=Z1(),{isIterable:K,isNodeStream:F,isWebStream:$}=kU(),{pipelineImpl:q}=nY(),{finished:M}=yU();cG();function z(...T){return new Q((A,L)=>{let E,S,j=T[T.length-1];if(j&&typeof j==="object"&&!F(j)&&!K(j)&&!$(j)){let k=X(T);E=k.signal,S=k.end}q(T,(k,B)=>{if(k)L(k);else A(B)},{signal:E,end:S})})}Z.exports={finished:M,pipeline:z}}),cG=s0((U,Z)=>{var{Buffer:X}=(g1(),m0(N1)),{ObjectDefineProperty:Q,ObjectKeys:K,ReflectApply:F}=Z1(),{promisify:{custom:$}}=i1(),{streamReturningOperators:q,promiseReturningOperators:M}=RI(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:z}}=n1(),T=wG(),{setDefaultHighWaterMark:A,getDefaultHighWaterMark:L}=kX(),{pipeline:E}=nY(),{destroyer:S}=DZ(),j=yU(),k=yG(),B=kU(),v=Z.exports=lY().Stream;v.isDestroyed=B.isDestroyed,v.isDisturbed=B.isDisturbed,v.isErrored=B.isErrored,v.isReadable=B.isReadable,v.isWritable=B.isWritable,v.Readable=jX();for(let N of K(q)){let w=function(...Z0){if(new.target)throw z();return v.Readable.from(F(u,this,Z0))},u=q[N];Q(w,"name",{__proto__:null,value:u.name}),Q(w,"length",{__proto__:null,value:u.length}),Q(v.Readable.prototype,N,{__proto__:null,value:w,enumerable:!1,configurable:!0,writable:!0})}for(let N of K(M)){let w=function(...Z0){if(new.target)throw z();return F(u,this,Z0)},u=M[N];Q(w,"name",{__proto__:null,value:u.name}),Q(w,"length",{__proto__:null,value:u.length}),Q(v.Readable.prototype,N,{__proto__:null,value:w,enumerable:!1,configurable:!0,writable:!0})}v.Writable=oY(),v.Duplex=PU(),v.Transform=gG(),v.PassThrough=fG(),v.pipeline=E;var{addAbortSignal:x}=PX();v.addAbortSignal=x,v.finished=j,v.destroy=S,v.compose=T,v.setDefaultHighWaterMark=A,v.getDefaultHighWaterMark=L,Q(v,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return k}}),Q(E,$,{__proto__:null,enumerable:!0,get(){return k.pipeline}}),Q(j,$,{__proto__:null,enumerable:!0,get(){return k.finished}}),v.Stream=v,v._isUint8Array=function(N){return N instanceof Uint8Array},v._uint8ArrayToBuffer=function(N){return X.from(N.buffer,N.byteOffset,N.byteLength)}}),EI=s0((U,Z)=>{var X=mY();{let Q=cG(),K=yG(),F=Q.Readable.destroy;Z.exports=Q.Readable,Z.exports._uint8ArrayToBuffer=Q._uint8ArrayToBuffer,Z.exports._isUint8Array=Q._isUint8Array,Z.exports.isDisturbed=Q.isDisturbed,Z.exports.isErrored=Q.isErrored,Z.exports.isReadable=Q.isReadable,Z.exports.Readable=Q.Readable,Z.exports.Writable=Q.Writable,Z.exports.Duplex=Q.Duplex,Z.exports.Transform=Q.Transform,Z.exports.PassThrough=Q.PassThrough,Z.exports.addAbortSignal=Q.addAbortSignal,Z.exports.finished=Q.finished,Z.exports.destroy=Q.destroy,Z.exports.destroy=F,Z.exports.pipeline=Q.pipeline,Z.exports.compose=Q.compose,Object.defineProperty(Q,"promises",{configurable:!0,enumerable:!0,get(){return K}}),Z.exports.Stream=Q.Stream}Z.exports.default=Z.exports});pG.exports=EI()});var e1={};WZ(e1,{webcrypto:()=>tH,rng:()=>KH,randomUUID:()=>sH,randomFillSync:()=>dH,randomFill:()=>bH,randomBytes:()=>WH,publicEncrypt:()=>cH,publicDecrypt:()=>hH,pseudoRandomBytes:()=>$H,prng:()=>VH,privateEncrypt:()=>pH,privateDecrypt:()=>uH,pbkdf2Sync:()=>zH,pbkdf2:()=>AH,listCiphers:()=>kH,getRandomValues:()=>mH,getHashes:()=>CH,getDiffieHellman:()=>_H,getCurves:()=>aH,getCiphers:()=>PH,default:()=>iH,createVerify:()=>fH,createSign:()=>NH,createHmac:()=>OH,createHash:()=>FH,createECDH:()=>yH,createDiffieHellmanGroup:()=>vH,createDiffieHellman:()=>BH,createDecipheriv:()=>SH,createDecipher:()=>RH,createCredentials:()=>lH,createCipheriv:()=>LH,createCipher:()=>qH,constants:()=>oH,Verify:()=>wH,Sign:()=>gH,Hmac:()=>HH,Hash:()=>IH,DiffieHellmanGroup:()=>jH,DiffieHellman:()=>xH,Decipheriv:()=>EH,Decipher:()=>TH,DEFAULT_ENCODING:()=>nH,Cipheriv:()=>MH,Cipher:()=>DH});function aH(){return rH}var SI,PI,hG,kI,jI,vI=(U,Z,X)=>{X=U!=null?SI(PI(U)):{};let Q=Z||!U||!U.__esModule?hG(X,"default",{value:U,enumerable:!0}):X;for(let K of kI(U))if(!jI.call(Q,K))hG(Q,K,{get:()=>U[K],enumerable:!0});return Q},$0=(U,Z)=>()=>(Z||U((Z={exports:{}}).exports,Z),Z.exports),vX,_X,bG,_I,rY,aY,m1,BI,yZ,dG,xI,NI,gI,fI,lG,wI,yI,cI,pI,hI,uI,bI,dI,lI,oI,cZ,BX,oG,nI,nG,mG,mI,pZ,tY,iY,sI,sG,eY,rI,rG,aI,aG,tG,tI,iI,eI,UF,ZF,XF,YF,JF,QF,GF,VF,$F,KF,WF,UJ,iG,IF,eG,FF,HF,OF,CF,jU,cU,UV,WU,ZV,xX,AF,YU,zF,DF,qF,XV,DU,hZ,YV,MF,JV,LF,QV,TF,RF,EF,SF,ZJ,PF,XJ,kF,jF,vF,_F,BF,xF,NF,gF,fF,wF,yF,cF,pF,hF,uG,uF,wZ,bF,GV,VV,dF,lF,$V,oF,nF,uZ,mF,sF,rF,aF,tF,iF,KV,eF,WV,IV,FV,YJ,HV,UH,OV,ZH,XH,sY,YH,JH,QH,GH,o0,VH,$H,KH,WH,IH,FH,HH,OH,CH,AH,zH,DH,qH,MH,LH,TH,RH,EH,SH,PH,kH,jH,vH,_H,BH,xH,NH,gH,fH,wH,yH,cH,pH,hH,uH,bH,dH,lH,oH,nH="buffer",mH=(U)=>{return crypto.getRandomValues(U)},sH=()=>{return crypto.randomUUID()},rH,tH,iH;var UU=IZ(()=>{SI=Object.create,{getPrototypeOf:PI,defineProperty:hG,getOwnPropertyNames:kI}=Object,jI=Object.prototype.hasOwnProperty,vX=$0((U,Z)=>{Z.exports=(UU(),m0(e1)).randomBytes}),_X=$0((U,Z)=>{Z.exports=(UU(),m0(e1)).createHash}),bG=$0((U,Z)=>{Z.exports=(UU(),m0(e1)).createHmac}),_I=$0((U,Z)=>{Z.exports={sha224WithRSAEncryption:{sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption:{sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption:{sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption:{sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA512":{sign:"ecdsa/rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA1":{sign:"rsa",hash:"sha1",id:"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{sign:"ecdsa",hash:"sha1",id:""},sha256:{sign:"ecdsa",hash:"sha256",id:""},sha224:{sign:"ecdsa",hash:"sha224",id:""},sha384:{sign:"ecdsa",hash:"sha384",id:""},sha512:{sign:"ecdsa",hash:"sha512",id:""},"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA:{sign:"dsa",hash:"sha1",id:""},"DSA-WITH-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-WITH-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-WITH-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-WITH-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-RIPEMD160":{sign:"dsa",hash:"rmd160",id:""},ripemd160WithRSA:{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption:{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}}}),rY=$0((U,Z)=>{var X=isFinite,Q=Math.pow(2,30)-1;Z.exports=function(K,F){if(typeof K!=="number")throw TypeError("Iterations not a number");if(K<0||!X(K))throw TypeError("Bad iterations");if(typeof F!=="number")throw TypeError("Key length not a number");if(F<0||F>Q||F!==F)throw TypeError("Bad key length")}}),aY=$0((U,Z)=>{var X;if(globalThis.process&&globalThis.process.browser)X="utf-8";else if(globalThis.process&&globalThis.process.version)Q=parseInt(process.version.split(".")[0].slice(1),10),X=Q>=6?"utf-8":"binary";else X="utf-8";var Q;Z.exports=X}),m1=$0((U,Z)=>{/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var X=(g1(),m0(N1)),Q=X.Buffer;function K($,q){for(var M in $)q[M]=$[M]}if(Q.from&&Q.alloc&&Q.allocUnsafe&&Q.allocUnsafeSlow)Z.exports=X;else K(X,U),U.Buffer=F;function F($,q,M){return Q($,q,M)}F.prototype=Object.create(Q.prototype),K(Q,F),F.from=function($,q,M){if(typeof $==="number")throw TypeError("Argument must not be a number");return Q($,q,M)},F.alloc=function($,q,M){if(typeof $!=="number")throw TypeError("Argument must be a number");var z=Q($);if(q!==void 0)if(typeof M==="string")z.fill(q,M);else z.fill(q);else z.fill(0);return z},F.allocUnsafe=function($){if(typeof $!=="number")throw TypeError("Argument must be a number");return Q($)},F.allocUnsafeSlow=function($){if(typeof $!=="number")throw TypeError("Argument must be a number");return X.SlowBuffer($)}}),BI=$0((U,Z)=>{var X={}.toString;Z.exports=Array.isArray||function(Q){return X.call(Q)=="[object Array]"}}),yZ=$0((U,Z)=>{Z.exports=TypeError}),dG=$0((U,Z)=>{Z.exports=Object}),xI=$0((U,Z)=>{Z.exports=Error}),NI=$0((U,Z)=>{Z.exports=EvalError}),gI=$0((U,Z)=>{Z.exports=RangeError}),fI=$0((U,Z)=>{Z.exports=ReferenceError}),lG=$0((U,Z)=>{Z.exports=SyntaxError}),wI=$0((U,Z)=>{Z.exports=URIError}),yI=$0((U,Z)=>{Z.exports=Math.abs}),cI=$0((U,Z)=>{Z.exports=Math.floor}),pI=$0((U,Z)=>{Z.exports=Math.max}),hI=$0((U,Z)=>{Z.exports=Math.min}),uI=$0((U,Z)=>{Z.exports=Math.pow}),bI=$0((U,Z)=>{Z.exports=Math.round}),dI=$0((U,Z)=>{Z.exports=Number.isNaN||function(X){return X!==X}}),lI=$0((U,Z)=>{var X=dI();Z.exports=function(Q){if(X(Q)||Q===0)return Q;return Q<0?-1:1}}),oI=$0((U,Z)=>{Z.exports=Object.getOwnPropertyDescriptor}),cZ=$0((U,Z)=>{var X=oI();if(X)try{X([],"length")}catch(Q){X=null}Z.exports=X}),BX=$0((U,Z)=>{var X=Object.defineProperty||!1;if(X)try{X({},"a",{value:1})}catch(Q){X=!1}Z.exports=X}),oG=$0((U,Z)=>{Z.exports=function(){if(typeof Symbol!=="function"||typeof Object.getOwnPropertySymbols!=="function")return!1;if(typeof Symbol.iterator==="symbol")return!0;var X={},Q=Symbol("test"),K=Object(Q);if(typeof Q==="string")return!1;if(Object.prototype.toString.call(Q)!=="[object Symbol]")return!1;if(Object.prototype.toString.call(K)!=="[object Symbol]")return!1;var F=42;X[Q]=F;for(var $ in X)return!1;if(typeof Object.keys==="function"&&Object.keys(X).length!==0)return!1;if(typeof Object.getOwnPropertyNames==="function"&&Object.getOwnPropertyNames(X).length!==0)return!1;var q=Object.getOwnPropertySymbols(X);if(q.length!==1||q[0]!==Q)return!1;if(!Object.prototype.propertyIsEnumerable.call(X,Q))return!1;if(typeof Object.getOwnPropertyDescriptor==="function"){var M=Object.getOwnPropertyDescriptor(X,Q);if(M.value!==F||M.enumerable!==!0)return!1}return!0}}),nI=$0((U,Z)=>{var X=typeof Symbol<"u"&&Symbol,Q=oG();Z.exports=function(){if(typeof X!=="function")return!1;if(typeof Symbol!=="function")return!1;if(typeof X("foo")!=="symbol")return!1;if(typeof Symbol("bar")!=="symbol")return!1;return Q()}}),nG=$0((U,Z)=>{Z.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null}),mG=$0((U,Z)=>{var X=dG();Z.exports=X.getPrototypeOf||null}),mI=$0((U,Z)=>{var X="Function.prototype.bind called on incompatible ",Q=Object.prototype.toString,K=Math.max,F="[object Function]",$=function(z,T){var A=[];for(var L=0;L<z.length;L+=1)A[L]=z[L];for(var E=0;E<T.length;E+=1)A[E+z.length]=T[E];return A},q=function(z,T){var A=[];for(var L=T||0,E=0;L<z.length;L+=1,E+=1)A[E]=z[L];return A},M=function(z,T){var A="";for(var L=0;L<z.length;L+=1)if(A+=z[L],L+1<z.length)A+=T;return A};Z.exports=function(z){var T=this;if(typeof T!=="function"||Q.apply(T)!==F)throw TypeError(X+T);var A=q(arguments,1),L,E=function(){if(this instanceof L){var v=T.apply(this,$(A,arguments));if(Object(v)===v)return v;return this}return T.apply(z,$(A,arguments))},S=K(0,T.length-A.length),j=[];for(var k=0;k<S;k++)j[k]="$"+k;if(L=Function("binder","return function ("+M(j,",")+"){ return binder.apply(this,arguments); }")(E),T.prototype){var B=function(){};B.prototype=T.prototype,L.prototype=new B,B.prototype=null}return L}}),pZ=$0((U,Z)=>{var X=mI();Z.exports=Function.prototype.bind||X}),tY=$0((U,Z)=>{Z.exports=Function.prototype.call}),iY=$0((U,Z)=>{Z.exports=Function.prototype.apply}),sI=$0((U,Z)=>{Z.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply}),sG=$0((U,Z)=>{var X=pZ(),Q=iY(),K=tY(),F=sI();Z.exports=F||X.call(K,Q)}),eY=$0((U,Z)=>{var X=pZ(),Q=yZ(),K=tY(),F=sG();Z.exports=function($){if($.length<1||typeof $[0]!=="function")throw new Q("a function is required");return F(X,K,$)}}),rI=$0((U,Z)=>{var X=eY(),Q=cZ(),K;try{K=[].__proto__===Array.prototype}catch(M){if(!M||typeof M!=="object"||!("code"in M)||M.code!=="ERR_PROTO_ACCESS")throw M}var F=!!K&&Q&&Q(Object.prototype,"__proto__"),$=Object,q=$.getPrototypeOf;Z.exports=F&&typeof F.get==="function"?X([F.get]):typeof q==="function"?function(M){return q(M==null?M:$(M))}:!1}),rG=$0((U,Z)=>{var X=nG(),Q=mG(),K=rI();Z.exports=X?function(F){return X(F)}:Q?function(F){if(!F||typeof F!=="object"&&typeof F!=="function")throw TypeError("getProto: not an object");return Q(F)}:K?function(F){return K(F)}:null}),aI=$0((U,Z)=>{var X=Function.prototype.call,Q=Object.prototype.hasOwnProperty,K=pZ();Z.exports=K.call(X,Q)}),aG=$0((U,Z)=>{var X,Q=dG(),K=xI(),F=NI(),$=gI(),q=fI(),M=lG(),z=yZ(),T=wI(),A=yI(),L=cI(),E=pI(),S=hI(),j=uI(),k=bI(),B=lI(),v=Function,x=function(Q0){try{return v('"use strict"; return ('+Q0+").constructor;")()}catch(n){}},N=cZ(),w=BX(),u=function(){throw new z},Z0=N?function(){try{return arguments.callee,u}catch(Q0){try{return N(arguments,"callee").get}catch(n){return u}}}():u,V0=nI()(),Y0=rG(),b=mG(),i=nG(),Y=iY(),V=tY(),I={},G=typeof Uint8Array>"u"||!Y0?X:Y0(Uint8Array),W={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?X:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?X:ArrayBuffer,"%ArrayIteratorPrototype%":V0&&Y0?Y0([][Symbol.iterator]()):X,"%AsyncFromSyncIteratorPrototype%":X,"%AsyncFunction%":I,"%AsyncGenerator%":I,"%AsyncGeneratorFunction%":I,"%AsyncIteratorPrototype%":I,"%Atomics%":typeof Atomics>"u"?X:Atomics,"%BigInt%":typeof BigInt>"u"?X:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?X:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?X:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?X:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":K,"%eval%":eval,"%EvalError%":F,"%Float16Array%":typeof Float16Array>"u"?X:Float16Array,"%Float32Array%":typeof Float32Array>"u"?X:Float32Array,"%Float64Array%":typeof Float64Array>"u"?X:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?X:FinalizationRegistry,"%Function%":v,"%GeneratorFunction%":I,"%Int8Array%":typeof Int8Array>"u"?X:Int8Array,"%Int16Array%":typeof Int16Array>"u"?X:Int16Array,"%Int32Array%":typeof Int32Array>"u"?X:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":V0&&Y0?Y0(Y0([][Symbol.iterator]())):X,"%JSON%":typeof JSON==="object"?JSON:X,"%Map%":typeof Map>"u"?X:Map,"%MapIteratorPrototype%":typeof Map>"u"||!V0||!Y0?X:Y0(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Q,"%Object.getOwnPropertyDescriptor%":N,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?X:Promise,"%Proxy%":typeof Proxy>"u"?X:Proxy,"%RangeError%":$,"%ReferenceError%":q,"%Reflect%":typeof Reflect>"u"?X:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?X:Set,"%SetIteratorPrototype%":typeof Set>"u"||!V0||!Y0?X:Y0(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?X:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":V0&&Y0?Y0(""[Symbol.iterator]()):X,"%Symbol%":V0?Symbol:X,"%SyntaxError%":M,"%ThrowTypeError%":Z0,"%TypedArray%":G,"%TypeError%":z,"%Uint8Array%":typeof Uint8Array>"u"?X:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?X:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?X:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?X:Uint32Array,"%URIError%":T,"%WeakMap%":typeof WeakMap>"u"?X:WeakMap,"%WeakRef%":typeof WeakRef>"u"?X:WeakRef,"%WeakSet%":typeof WeakSet>"u"?X:WeakSet,"%Function.prototype.call%":V,"%Function.prototype.apply%":Y,"%Object.defineProperty%":w,"%Object.getPrototypeOf%":b,"%Math.abs%":A,"%Math.floor%":L,"%Math.max%":E,"%Math.min%":S,"%Math.pow%":j,"%Math.round%":k,"%Math.sign%":B,"%Reflect.getPrototypeOf%":i};if(Y0)try{null.error}catch(Q0){C=Y0(Y0(Q0)),W["%Error.prototype%"]=C}var C,D=function Q0(n){var s;if(n==="%AsyncFunction%")s=x("async function () {}");else if(n==="%GeneratorFunction%")s=x("function* () {}");else if(n==="%AsyncGeneratorFunction%")s=x("async function* () {}");else if(n==="%AsyncGenerator%"){var f0=Q0("%AsyncGeneratorFunction%");if(f0)s=f0.prototype}else if(n==="%AsyncIteratorPrototype%"){var y=Q0("%AsyncGenerator%");if(y&&Y0)s=Y0(y.prototype)}return W[n]=s,s},H={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},J=pZ(),O=aI(),P=J.call(V,Array.prototype.concat),R=J.call(Y,Array.prototype.splice),_=J.call(V,String.prototype.replace),f=J.call(V,String.prototype.slice),c=J.call(V,RegExp.prototype.exec),o=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,K0=/\\(\\)?/g,a=function(Q0){var n=f(Q0,0,1),s=f(Q0,-1);if(n==="%"&&s!=="%")throw new M("invalid intrinsic syntax, expected closing `%`");else if(s==="%"&&n!=="%")throw new M("invalid intrinsic syntax, expected opening `%`");var f0=[];return _(Q0,o,function(y,h,G0,t){f0[f0.length]=G0?_(t,K0,"$1"):h||y}),f0},l=function(Q0,n){var s=Q0,f0;if(O(H,s))f0=H[s],s="%"+f0[0]+"%";if(O(W,s)){var y=W[s];if(y===I)y=D(s);if(typeof y>"u"&&!n)throw new z("intrinsic "+Q0+" exists, but is not available. Please file an issue!");return{alias:f0,name:s,value:y}}throw new M("intrinsic "+Q0+" does not exist!")};Z.exports=function(Q0,n){if(typeof Q0!=="string"||Q0.length===0)throw new z("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof n!=="boolean")throw new z('"allowMissing" argument must be a boolean');if(c(/^%?[^%]*%?$/,Q0)===null)throw new M("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var s=a(Q0),f0=s.length>0?s[0]:"",y=l("%"+f0+"%",n),h=y.name,G0=y.value,t=!1,U0=y.alias;if(U0)f0=U0[0],R(s,P([0,1],U0));for(var L0=1,p=!0;L0<s.length;L0+=1){var m=s[L0],g0=f(m,0,1),r=f(m,-1);if((g0==='"'||g0==="'"||g0==="`"||(r==='"'||r==="'"||r==="`"))&&g0!==r)throw new M("property names with quotes must have matching quotes");if(m==="constructor"||!p)t=!0;if(f0+="."+m,h="%"+f0+"%",O(W,h))G0=W[h];else if(G0!=null){if(!(m in G0)){if(!n)throw new z("base intrinsic for "+Q0+" exists, but the property is not available.");return}if(N&&L0+1>=s.length){var J0=N(G0,m);if(p=!!J0,p&&"get"in J0&&!("originalValue"in J0.get))G0=J0.get;else G0=G0[m]}else p=O(G0,m),G0=G0[m];if(p&&!t)W[h]=G0}}return G0}}),tG=$0((U,Z)=>{var X=aG(),Q=eY(),K=Q([X("%String.prototype.indexOf%")]);Z.exports=function(F,$){var q=X(F,!!$);if(typeof q==="function"&&K(F,".prototype.")>-1)return Q([q]);return q}}),tI=$0((U,Z)=>{var X=Function.prototype.toString,Q=typeof Reflect==="object"&&Reflect!==null&&Reflect.apply,K,F;if(typeof Q==="function"&&typeof Object.defineProperty==="function")try{K=Object.defineProperty({},"length",{get:function(){throw F}}),F={},Q(function(){throw 42},null,K)}catch(N){if(N!==F)Q=null}else Q=null;var $=/^\s*class\b/,q=function(N){try{var w=X.call(N);return $.test(w)}catch(u){return!1}},M=function(N){try{if(q(N))return!1;return X.call(N),!0}catch(w){return!1}},z=Object.prototype.toString,T="[object Object]",A="[object Function]",L="[object GeneratorFunction]",E="[object HTMLAllCollection]",S="[object HTML document.all class]",j="[object HTMLCollection]",k=typeof Symbol==="function"&&!!Symbol.toStringTag,B=!(0 in[,]),v=function(){return!1};if(typeof document==="object"){if(x=document.all,z.call(x)===z.call(document.all))v=function(N){if((B||!N)&&(typeof N>"u"||typeof N==="object"))try{var w=z.call(N);return(w===E||w===S||w===j||w===T)&&N("")==null}catch(u){}return!1}}var x;Z.exports=Q?function(N){if(v(N))return!0;if(!N)return!1;if(typeof N!=="function"&&typeof N!=="object")return!1;try{Q(N,null,K)}catch(w){if(w!==F)return!1}return!q(N)&&M(N)}:function(N){if(v(N))return!0;if(!N)return!1;if(typeof N!=="function"&&typeof N!=="object")return!1;if(k)return M(N);if(q(N))return!1;var w=z.call(N);if(w!==A&&w!==L&&!/^\[object HTML/.test(w))return!1;return M(N)}}),iI=$0((U,Z)=>{var X=tI(),Q=Object.prototype.toString,K=Object.prototype.hasOwnProperty,F=function(z,T,A){for(var L=0,E=z.length;L<E;L++)if(K.call(z,L))if(A==null)T(z[L],L,z);else T.call(A,z[L],L,z)},$=function(z,T,A){for(var L=0,E=z.length;L<E;L++)if(A==null)T(z.charAt(L),L,z);else T.call(A,z.charAt(L),L,z)},q=function(z,T,A){for(var L in z)if(K.call(z,L))if(A==null)T(z[L],L,z);else T.call(A,z[L],L,z)};function M(z){return Q.call(z)==="[object Array]"}Z.exports=function(z,T,A){if(!X(T))throw TypeError("iterator must be a function");var L;if(arguments.length>=3)L=A;if(M(z))F(z,T,L);else if(typeof z==="string")$(z,T,L);else q(z,T,L)}}),eI=$0((U,Z)=>{Z.exports=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]}),UF=$0((U,Z)=>{var X=eI(),Q=typeof globalThis>"u"?globalThis:globalThis;Z.exports=function(){var K=[];for(var F=0;F<X.length;F++)if(typeof Q[X[F]]==="function")K[K.length]=X[F];return K}}),ZF=$0((U,Z)=>{var X=BX(),Q=lG(),K=yZ(),F=cZ();Z.exports=function($,q,M){if(!$||typeof $!=="object"&&typeof $!=="function")throw new K("`obj` must be an object or a function`");if(typeof q!=="string"&&typeof q!=="symbol")throw new K("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!=="boolean"&&arguments[3]!==null)throw new K("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!=="boolean"&&arguments[4]!==null)throw new K("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!=="boolean"&&arguments[5]!==null)throw new K("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!=="boolean")throw new K("`loose`, if provided, must be a boolean");var z=arguments.length>3?arguments[3]:null,T=arguments.length>4?arguments[4]:null,A=arguments.length>5?arguments[5]:null,L=arguments.length>6?arguments[6]:!1,E=!!F&&F($,q);if(X)X($,q,{configurable:A===null&&E?E.configurable:!A,enumerable:z===null&&E?E.enumerable:!z,value:M,writable:T===null&&E?E.writable:!T});else if(L||!z&&!T&&!A)$[q]=M;else throw new Q("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}}),XF=$0((U,Z)=>{var X=BX(),Q=function(){return!!X};Q.hasArrayLengthDefineBug=function(){if(!X)return null;try{return X([],"length",{value:1}).length!==1}catch(K){return!0}},Z.exports=Q}),YF=$0((U,Z)=>{var X=aG(),Q=ZF(),K=XF()(),F=cZ(),$=yZ(),q=X("%Math.floor%");Z.exports=function(M,z){if(typeof M!=="function")throw new $("`fn` is not a function");if(typeof z!=="number"||z<0||z>4294967295||q(z)!==z)throw new $("`length` must be a positive 32-bit integer");var T=arguments.length>2&&!!arguments[2],A=!0,L=!0;if("length"in M&&F){var E=F(M,"length");if(E&&!E.configurable)A=!1;if(E&&!E.writable)L=!1}if(A||L||!T)if(K)Q(M,"length",z,!0,!0);else Q(M,"length",z);return M}}),JF=$0((U,Z)=>{var X=pZ(),Q=iY(),K=sG();Z.exports=function(){return K(X,Q,arguments)}}),QF=$0((U,Z)=>{var X=YF(),Q=BX(),K=eY(),F=JF();if(Z.exports=function($){var q=K(arguments),M=$.length-(arguments.length-1);return X(q,1+(M>0?M:0),!0)},Q)Q(Z.exports,"apply",{value:F});else Z.exports.apply=F}),GF=$0((U,Z)=>{var X=oG();Z.exports=function(){return X()&&!!Symbol.toStringTag}}),VF=$0((U,Z)=>{var X=iI(),Q=UF(),K=QF(),F=tG(),$=cZ(),q=rG(),M=F("Object.prototype.toString"),z=GF()(),T=typeof globalThis>"u"?globalThis:globalThis,A=Q(),L=F("String.prototype.slice"),E=F("Array.prototype.indexOf",!0)||function(B,v){for(var x=0;x<B.length;x+=1)if(B[x]===v)return x;return-1},S={__proto__:null};if(z&&$&&q)X(A,function(B){var v=new T[B];if(Symbol.toStringTag in v&&q){var x=q(v),N=$(x,Symbol.toStringTag);if(!N&&x){var w=q(x);N=$(w,Symbol.toStringTag)}S["$"+B]=K(N.get)}});else X(A,function(B){var v=new T[B],x=v.slice||v.set;if(x)S["$"+B]=K(x)});var j=function(B){var v=!1;return X(S,function(x,N){if(!v)try{if("$"+x(B)===N)v=L(N,1)}catch(w){}}),v},k=function(B){var v=!1;return X(S,function(x,N){if(!v)try{x(B),v=L(N,1)}catch(w){}}),v};Z.exports=function(B){if(!B||typeof B!=="object")return!1;if(!z){var v=L(M(B),8,-1);if(E(A,v)>-1)return v;if(v!=="Object")return!1;return k(B)}if(!$)return null;return j(B)}}),$F=$0((U,Z)=>{var X=VF();Z.exports=function(Q){return!!X(Q)}}),KF=$0((U,Z)=>{var X=yZ(),Q=tG(),K=Q("TypedArray.prototype.buffer",!0),F=$F();Z.exports=K||function($){if(!F($))throw new X("Not a Typed Array");return $.buffer}}),WF=$0((U,Z)=>{var X=m1().Buffer,Q=BI(),K=KF(),F=ArrayBuffer.isView||function(z){try{return K(z),!0}catch(T){return!1}},$=typeof Uint8Array<"u",q=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",M=q&&(X.prototype instanceof Uint8Array||X.TYPED_ARRAY_SUPPORT);Z.exports=function(z,T){if(X.isBuffer(z)){if(z.constructor&&!("isBuffer"in z))return X.from(z);return z}if(typeof z==="string")return X.from(z,T);if(q&&F(z)){if(z.byteLength===0)return X.alloc(0);if(M){var A=X.from(z.buffer,z.byteOffset,z.byteLength);if(A.byteLength===z.byteLength)return A}var L=z instanceof Uint8Array?z:new Uint8Array(z.buffer,z.byteOffset,z.byteLength),E=X.from(L);if(E.length===z.byteLength)return E}if($&&z instanceof Uint8Array)return X.from(z);var S=Q(z);if(S)for(var j=0;j<z.length;j+=1){var k=z[j];if(typeof k!=="number"||k<0||k>255||~~k!==k)throw RangeError("Array items must be numbers in the range 0-255.")}if(S||X.isBuffer(z)&&z.constructor&&typeof z.constructor.isBuffer==="function"&&z.constructor.isBuffer(z))return X.from(z);throw TypeError('The "data" argument must be a string, an Array, a Buffer, a Uint8Array, or a DataView.')}}),UJ=$0((U,Z)=>{var X=m1().Buffer,Q=WF(),K=typeof Uint8Array<"u",F=K&&typeof ArrayBuffer<"u",$=F&&ArrayBuffer.isView;Z.exports=function(q,M,z){if(typeof q==="string"||X.isBuffer(q)||K&&q instanceof Uint8Array||$&&$(q))return Q(q,M);throw TypeError(z+" must be a string, a Buffer, a Uint8Array, or a DataView")}}),iG=$0((U,Z)=>{var X={__proto__:null,md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,"sha512-256":32,rmd160:20,ripemd160:20},Q={__proto__:null,"sha-1":"sha1","sha-224":"sha224","sha-256":"sha256","sha-384":"sha384","sha-512":"sha512","ripemd-160":"ripemd160"},K=bG(),F=m1().Buffer,$=rY(),q=aY(),M=UJ();function z(T,A,L,E,S){$(L,E),T=M(T,q,"Password"),A=M(A,q,"Salt");var j=(S||"sha1").toLowerCase(),k=Q[j]||j,B=X[k];if(typeof B!=="number"||!B)throw TypeError("Digest algorithm not supported: "+S);var v=F.allocUnsafe(E),x=F.allocUnsafe(A.length+4);A.copy(x,0,0,A.length);var N=0,w=B,u=Math.ceil(E/w);for(var Z0=1;Z0<=u;Z0++){x.writeUInt32BE(Z0,A.length);var V0=K(k,T).update(x).digest(),Y0=V0;for(var b=1;b<L;b++){Y0=K(k,T).update(Y0).digest();for(var i=0;i<w;i++)V0[i]^=Y0[i]}V0.copy(v,N),N+=w}return v}Z.exports=z}),IF=$0((U,Z)=>{var X=m1().Buffer,Q=rY(),K=aY(),F=iG(),$=UJ(),q,M=globalThis.crypto&&globalThis.crypto.subtle,z={sha:"SHA-1","sha-1":"SHA-1",sha1:"SHA-1",sha256:"SHA-256","sha-256":"SHA-256",sha384:"SHA-384","sha-384":"SHA-384","sha-512":"SHA-512",sha512:"SHA-512"},T=[],A;function L(){if(A)return A;if(globalThis.process&&globalThis.process.nextTick)A=globalThis.process.nextTick;else if(globalThis.queueMicrotask)A=globalThis.queueMicrotask;else if(globalThis.setImmediate)A=globalThis.setImmediate;else A=globalThis.setTimeout;return A}function E(k,B,v,x,N){return M.importKey("raw",k,{name:"PBKDF2"},!1,["deriveBits"]).then(function(w){return M.deriveBits({name:"PBKDF2",salt:B,iterations:v,hash:{name:N}},w,x<<3)}).then(function(w){return X.from(w)})}function S(k){if(globalThis.process&&!globalThis.process.browser)return Promise.resolve(!1);if(!M||!M.importKey||!M.deriveBits)return Promise.resolve(!1);if(T[k]!==void 0)return T[k];q=q||X.alloc(8);var B=E(q,q,10,128,k).then(function(){return!0},function(){return!1});return T[k]=B,B}function j(k,B){k.then(function(v){L()(function(){B(null,v)})},function(v){L()(function(){B(v)})})}Z.exports=function(k,B,v,x,N,w){if(typeof N==="function")w=N,N=void 0;if(Q(v,x),k=$(k,K,"Password"),B=$(B,K,"Salt"),typeof w!=="function")throw Error("No callback provided to pbkdf2");N=N||"sha1";var u=z[N.toLowerCase()];if(!u||typeof globalThis.Promise!=="function"){L()(function(){var Z0;try{Z0=F(k,B,v,x,N)}catch(V0){w(V0);return}w(null,Z0)});return}j(S(u).then(function(Z0){if(Z0)return E(k,B,v,x,u);return F(k,B,v,x,N)}),w)}}),eG=$0((U)=>{var Z=(UU(),m0(e1)),X=rY(),Q=aY(),K=UJ();function F(q,M,z,T,A,L){if(X(z,T),q=K(q,Q,"Password"),M=K(M,Q,"Salt"),typeof A==="function")L=A,A="sha1";if(typeof L!=="function")throw Error("No callback provided to pbkdf2");return Z.pbkdf2(q,M,z,T,A,L)}function $(q,M,z,T,A){return X(z,T),q=K(q,Q,"Password"),M=K(M,Q,"Salt"),A=A||"sha1",Z.pbkdf2Sync(q,M,z,T,A)}if(!Z.pbkdf2Sync||Z.pbkdf2Sync.toString().indexOf("keylen, digest")===-1)U.pbkdf2Sync=iG(),U.pbkdf2=IF();else U.pbkdf2Sync=$,U.pbkdf2=F}),FF=$0((U)=>{var Z=(UU(),m0(e1));U.createCipher=U.Cipher=Z.createCipher,U.createCipheriv=U.Cipheriv=Z.createCipheriv,U.createDecipher=U.Decipher=Z.createDecipher,U.createDecipheriv=U.Decipheriv=Z.createDecipheriv,U.listCiphers=U.getCiphers=Z.getCiphers}),HF=$0((U)=>{var Z=(UU(),m0(e1));U.DiffieHellmanGroup=Z.DiffieHellmanGroup,U.createDiffieHellmanGroup=Z.createDiffieHellmanGroup,U.getDiffieHellman=Z.getDiffieHellman,U.createDiffieHellman=Z.createDiffieHellman,U.DiffieHellman=Z.DiffieHellman}),OF=$0((U)=>{var Z=(UU(),m0(e1));U.createSign=Z.createSign,U.Sign=Z.Sign,U.createVerify=Z.createVerify,U.Verify=Z.Verify}),CF=$0((U,Z)=>{Z.exports={name:"elliptic",version:"6.6.1",description:"EC cryptography",main:"lib/elliptic.js",files:["lib"],scripts:{lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository:{type:"git",url:"git@github.com:indutny/elliptic"},keywords:["EC","Elliptic","curve","Cryptography"],author:"Fedor Indutny <fedor@indutny.com>",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}}}),jU=$0((U,Z)=>{(function(X,Q){function K(Y,V){if(!Y)throw Error(V||"Assertion failed")}function F(Y,V){Y.super_=V;var I=function(){};I.prototype=V.prototype,Y.prototype=new I,Y.prototype.constructor=Y}function $(Y,V,I){if($.isBN(Y))return Y;if(this.negative=0,this.words=null,this.length=0,this.red=null,Y!==null){if(V==="le"||V==="be")I=V,V=10;this._init(Y||0,V||10,I||"be")}}if(typeof X==="object")X.exports=$;else Q.BN=$;$.BN=$,$.wordSize=26;var q;try{if(typeof window<"u"&&typeof window.Buffer<"u")q=window.Buffer;else q=(g1(),m0(N1)).Buffer}catch(Y){}$.isBN=function(Y){if(Y instanceof $)return!0;return Y!==null&&typeof Y==="object"&&Y.constructor.wordSize===$.wordSize&&Array.isArray(Y.words)},$.max=function(Y,V){if(Y.cmp(V)>0)return Y;return V},$.min=function(Y,V){if(Y.cmp(V)<0)return Y;return V},$.prototype._init=function(Y,V,I){if(typeof Y==="number")return this._initNumber(Y,V,I);if(typeof Y==="object")return this._initArray(Y,V,I);if(V==="hex")V=16;K(V===(V|0)&&V>=2&&V<=36),Y=Y.toString().replace(/\s+/g,"");var G=0;if(Y[0]==="-")G++,this.negative=1;if(G<Y.length){if(V===16)this._parseHex(Y,G,I);else if(this._parseBase(Y,V,G),I==="le")this._initArray(this.toArray(),V,I)}},$.prototype._initNumber=function(Y,V,I){if(Y<0)this.negative=1,Y=-Y;if(Y<67108864)this.words=[Y&67108863],this.length=1;else if(Y<4503599627370496)this.words=[Y&67108863,Y/67108864&67108863],this.length=2;else K(Y<9007199254740992),this.words=[Y&67108863,Y/67108864&67108863,1],this.length=3;if(I!=="le")return;this._initArray(this.toArray(),V,I)},$.prototype._initArray=function(Y,V,I){if(K(typeof Y.length==="number"),Y.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(Y.length/3),this.words=Array(this.length);for(var G=0;G<this.length;G++)this.words[G]=0;var W,C,D=0;if(I==="be"){for(G=Y.length-1,W=0;G>=0;G-=3)if(C=Y[G]|Y[G-1]<<8|Y[G-2]<<16,this.words[W]|=C<<D&67108863,this.words[W+1]=C>>>26-D&67108863,D+=24,D>=26)D-=26,W++}else if(I==="le"){for(G=0,W=0;G<Y.length;G+=3)if(C=Y[G]|Y[G+1]<<8|Y[G+2]<<16,this.words[W]|=C<<D&67108863,this.words[W+1]=C>>>26-D&67108863,D+=24,D>=26)D-=26,W++}return this.strip()};function M(Y,V){var I=Y.charCodeAt(V);if(I>=65&&I<=70)return I-55;else if(I>=97&&I<=102)return I-87;else return I-48&15}function z(Y,V,I){var G=M(Y,I);if(I-1>=V)G|=M(Y,I-1)<<4;return G}$.prototype._parseHex=function(Y,V,I){this.length=Math.ceil((Y.length-V)/6),this.words=Array(this.length);for(var G=0;G<this.length;G++)this.words[G]=0;var W=0,C=0,D;if(I==="be")for(G=Y.length-1;G>=V;G-=2)if(D=z(Y,V,G)<<W,this.words[C]|=D&67108863,W>=18)W-=18,C+=1,this.words[C]|=D>>>26;else W+=8;else{var H=Y.length-V;for(G=H%2===0?V+1:V;G<Y.length;G+=2)if(D=z(Y,V,G)<<W,this.words[C]|=D&67108863,W>=18)W-=18,C+=1,this.words[C]|=D>>>26;else W+=8}this.strip()};function T(Y,V,I,G){var W=0,C=Math.min(Y.length,I);for(var D=V;D<C;D++){var H=Y.charCodeAt(D)-48;if(W*=G,H>=49)W+=H-49+10;else if(H>=17)W+=H-17+10;else W+=H}return W}$.prototype._parseBase=function(Y,V,I){this.words=[0],this.length=1;for(var G=0,W=1;W<=67108863;W*=V)G++;G--,W=W/V|0;var C=Y.length-I,D=C%G,H=Math.min(C,C-D)+I,J=0;for(var O=I;O<H;O+=G)if(J=T(Y,O,O+G,V),this.imuln(W),this.words[0]+J<67108864)this.words[0]+=J;else this._iaddn(J);if(D!==0){var P=1;J=T(Y,O,Y.length,V);for(O=0;O<D;O++)P*=V;if(this.imuln(P),this.words[0]+J<67108864)this.words[0]+=J;else this._iaddn(J)}this.strip()},$.prototype.copy=function(Y){Y.words=Array(this.length);for(var V=0;V<this.length;V++)Y.words[V]=this.words[V];Y.length=this.length,Y.negative=this.negative,Y.red=this.red},$.prototype.clone=function(){var Y=new $(null);return this.copy(Y),Y},$.prototype._expand=function(Y){while(this.length<Y)this.words[this.length++]=0;return this},$.prototype.strip=function(){while(this.length>1&&this.words[this.length-1]===0)this.length--;return this._normSign()},$.prototype._normSign=function(){if(this.length===1&&this.words[0]===0)this.negative=0;return this},$.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var A=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],L=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],E=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64000000,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,24300000,28629151,33554432,39135393,45435424,52521875,60466176];if($.prototype.toString=function(Y,V){Y=Y||10,V=V|0||1;var I;if(Y===16||Y==="hex"){I="";var G=0,W=0;for(var C=0;C<this.length;C++){var D=this.words[C],H=((D<<G|W)&16777215).toString(16);if(W=D>>>24-G&16777215,G+=2,G>=26)G-=26,C--;if(W!==0||C!==this.length-1)I=A[6-H.length]+H+I;else I=H+I}if(W!==0)I=W.toString(16)+I;while(I.length%V!==0)I="0"+I;if(this.negative!==0)I="-"+I;return I}if(Y===(Y|0)&&Y>=2&&Y<=36){var J=L[Y],O=E[Y];I="";var P=this.clone();P.negative=0;while(!P.isZero()){var R=P.modn(O).toString(Y);if(P=P.idivn(O),!P.isZero())I=A[J-R.length]+R+I;else I=R+I}if(this.isZero())I="0"+I;while(I.length%V!==0)I="0"+I;if(this.negative!==0)I="-"+I;return I}K(!1,"Base should be between 2 and 36")},$.prototype.toNumber=function(){var Y=this.words[0];if(this.length===2)Y+=this.words[1]*67108864;else if(this.length===3&&this.words[2]===1)Y+=4503599627370496+this.words[1]*67108864;else if(this.length>2)K(!1,"Number can only safely store up to 53 bits");return this.negative!==0?-Y:Y},$.prototype.toJSON=function(){return this.toString(16)},$.prototype.toBuffer=function(Y,V){return K(typeof q<"u"),this.toArrayLike(q,Y,V)},$.prototype.toArray=function(Y,V){return this.toArrayLike(Array,Y,V)},$.prototype.toArrayLike=function(Y,V,I){var G=this.byteLength(),W=I||Math.max(1,G);K(G<=W,"byte array longer than desired length"),K(W>0,"Requested array length <= 0"),this.strip();var C=V==="le",D=new Y(W),H,J,O=this.clone();if(!C){for(J=0;J<W-G;J++)D[J]=0;for(J=0;!O.isZero();J++)H=O.andln(255),O.iushrn(8),D[W-J-1]=H}else{for(J=0;!O.isZero();J++)H=O.andln(255),O.iushrn(8),D[J]=H;for(;J<W;J++)D[J]=0}return D},Math.clz32)$.prototype._countBits=function(Y){return 32-Math.clz32(Y)};else $.prototype._countBits=function(Y){var V=Y,I=0;if(V>=4096)I+=13,V>>>=13;if(V>=64)I+=7,V>>>=7;if(V>=8)I+=4,V>>>=4;if(V>=2)I+=2,V>>>=2;return I+V};$.prototype._zeroBits=function(Y){if(Y===0)return 26;var V=Y,I=0;if((V&8191)===0)I+=13,V>>>=13;if((V&127)===0)I+=7,V>>>=7;if((V&15)===0)I+=4,V>>>=4;if((V&3)===0)I+=2,V>>>=2;if((V&1)===0)I++;return I},$.prototype.bitLength=function(){var Y=this.words[this.length-1],V=this._countBits(Y);return(this.length-1)*26+V};function S(Y){var V=Array(Y.bitLength());for(var I=0;I<V.length;I++){var G=I/26|0,W=I%26;V[I]=(Y.words[G]&1<<W)>>>W}return V}$.prototype.zeroBits=function(){if(this.isZero())return 0;var Y=0;for(var V=0;V<this.length;V++){var I=this._zeroBits(this.words[V]);if(Y+=I,I!==26)break}return Y},$.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},$.prototype.toTwos=function(Y){if(this.negative!==0)return this.abs().inotn(Y).iaddn(1);return this.clone()},$.prototype.fromTwos=function(Y){if(this.testn(Y-1))return this.notn(Y).iaddn(1).ineg();return this.clone()},$.prototype.isNeg=function(){return this.negative!==0},$.prototype.neg=function(){return this.clone().ineg()},$.prototype.ineg=function(){if(!this.isZero())this.negative^=1;return this},$.prototype.iuor=function(Y){while(this.length<Y.length)this.words[this.length++]=0;for(var V=0;V<Y.length;V++)this.words[V]=this.words[V]|Y.words[V];return this.strip()},$.prototype.ior=function(Y){return K((this.negative|Y.negative)===0),this.iuor(Y)},$.prototype.or=function(Y){if(this.length>Y.length)return this.clone().ior(Y);return Y.clone().ior(this)},$.prototype.uor=function(Y){if(this.length>Y.length)return this.clone().iuor(Y);return Y.clone().iuor(this)},$.prototype.iuand=function(Y){var V;if(this.length>Y.length)V=Y;else V=this;for(var I=0;I<V.length;I++)this.words[I]=this.words[I]&Y.words[I];return this.length=V.length,this.strip()},$.prototype.iand=function(Y){return K((this.negative|Y.negative)===0),this.iuand(Y)},$.prototype.and=function(Y){if(this.length>Y.length)return this.clone().iand(Y);return Y.clone().iand(this)},$.prototype.uand=function(Y){if(this.length>Y.length)return this.clone().iuand(Y);return Y.clone().iuand(this)},$.prototype.iuxor=function(Y){var V,I;if(this.length>Y.length)V=this,I=Y;else V=Y,I=this;for(var G=0;G<I.length;G++)this.words[G]=V.words[G]^I.words[G];if(this!==V)for(;G<V.length;G++)this.words[G]=V.words[G];return this.length=V.length,this.strip()},$.prototype.ixor=function(Y){return K((this.negative|Y.negative)===0),this.iuxor(Y)},$.prototype.xor=function(Y){if(this.length>Y.length)return this.clone().ixor(Y);return Y.clone().ixor(this)},$.prototype.uxor=function(Y){if(this.length>Y.length)return this.clone().iuxor(Y);return Y.clone().iuxor(this)},$.prototype.inotn=function(Y){K(typeof Y==="number"&&Y>=0);var V=Math.ceil(Y/26)|0,I=Y%26;if(this._expand(V),I>0)V--;for(var G=0;G<V;G++)this.words[G]=~this.words[G]&67108863;if(I>0)this.words[G]=~this.words[G]&67108863>>26-I;return this.strip()},$.prototype.notn=function(Y){return this.clone().inotn(Y)},$.prototype.setn=function(Y,V){K(typeof Y==="number"&&Y>=0);var I=Y/26|0,G=Y%26;if(this._expand(I+1),V)this.words[I]=this.words[I]|1<<G;else this.words[I]=this.words[I]&~(1<<G);return this.strip()},$.prototype.iadd=function(Y){var V;if(this.negative!==0&&Y.negative===0)return this.negative=0,V=this.isub(Y),this.negative^=1,this._normSign();else if(this.negative===0&&Y.negative!==0)return Y.negative=0,V=this.isub(Y),Y.negative=1,V._normSign();var I,G;if(this.length>Y.length)I=this,G=Y;else I=Y,G=this;var W=0;for(var C=0;C<G.length;C++)V=(I.words[C]|0)+(G.words[C]|0)+W,this.words[C]=V&67108863,W=V>>>26;for(;W!==0&&C<I.length;C++)V=(I.words[C]|0)+W,this.words[C]=V&67108863,W=V>>>26;if(this.length=I.length,W!==0)this.words[this.length]=W,this.length++;else if(I!==this)for(;C<I.length;C++)this.words[C]=I.words[C];return this},$.prototype.add=function(Y){var V;if(Y.negative!==0&&this.negative===0)return Y.negative=0,V=this.sub(Y),Y.negative^=1,V;else if(Y.negative===0&&this.negative!==0)return this.negative=0,V=Y.sub(this),this.negative=1,V;if(this.length>Y.length)return this.clone().iadd(Y);return Y.clone().iadd(this)},$.prototype.isub=function(Y){if(Y.negative!==0){Y.negative=0;var V=this.iadd(Y);return Y.negative=1,V._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(Y),this.negative=1,this._normSign();var I=this.cmp(Y);if(I===0)return this.negative=0,this.length=1,this.words[0]=0,this;var G,W;if(I>0)G=this,W=Y;else G=Y,W=this;var C=0;for(var D=0;D<W.length;D++)V=(G.words[D]|0)-(W.words[D]|0)+C,C=V>>26,this.words[D]=V&67108863;for(;C!==0&&D<G.length;D++)V=(G.words[D]|0)+C,C=V>>26,this.words[D]=V&67108863;if(C===0&&D<G.length&&G!==this)for(;D<G.length;D++)this.words[D]=G.words[D];if(this.length=Math.max(this.length,D),G!==this)this.negative=1;return this.strip()},$.prototype.sub=function(Y){return this.clone().isub(Y)};function j(Y,V,I){I.negative=V.negative^Y.negative;var G=Y.length+V.length|0;I.length=G,G=G-1|0;var W=Y.words[0]|0,C=V.words[0]|0,D=W*C,H=D&67108863,J=D/67108864|0;I.words[0]=H;for(var O=1;O<G;O++){var P=J>>>26,R=J&67108863,_=Math.min(O,V.length-1);for(var f=Math.max(0,O-Y.length+1);f<=_;f++){var c=O-f|0;W=Y.words[c]|0,C=V.words[f]|0,D=W*C+R,P+=D/67108864|0,R=D&67108863}I.words[O]=R|0,J=P|0}if(J!==0)I.words[O]=J|0;else I.length--;return I.strip()}var k=function(Y,V,I){var G=Y.words,W=V.words,C=I.words,D=0,H,J,O,P=G[0]|0,R=P&8191,_=P>>>13,f=G[1]|0,c=f&8191,o=f>>>13,K0=G[2]|0,a=K0&8191,l=K0>>>13,Q0=G[3]|0,n=Q0&8191,s=Q0>>>13,f0=G[4]|0,y=f0&8191,h=f0>>>13,G0=G[5]|0,t=G0&8191,U0=G0>>>13,L0=G[6]|0,p=L0&8191,m=L0>>>13,g0=G[7]|0,r=g0&8191,J0=g0>>>13,h0=G[8]|0,H0=h0&8191,O0=h0>>>13,J1=G[9]|0,I0=J1&8191,C0=J1>>>13,K1=W[0]|0,q0=K1&8191,z0=K1>>>13,d1=W[1]|0,T0=d1&8191,j0=d1>>>13,l1=W[2]|0,v0=l1&8191,R0=l1>>>13,h1=W[3]|0,_0=h1&8191,E0=h1>>>13,_1=W[4]|0,B0=_1&8191,x0=_1>>>13,B1=W[5]|0,S0=B1&8191,g=B1>>>13,d=W[6]|0,e=d&8191,X0=d>>>13,y0=W[7]|0,F0=y0&8191,A0=y0>>>13,Q1=W[8]|0,P0=Q1&8191,N0=Q1>>>13,u1=W[9]|0,k0=u1&8191,M0=u1>>>13;I.negative=Y.negative^V.negative,I.length=19,H=Math.imul(R,q0),J=Math.imul(R,z0),J=J+Math.imul(_,q0)|0,O=Math.imul(_,z0);var G1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(G1>>>26)|0,G1&=67108863,H=Math.imul(c,q0),J=Math.imul(c,z0),J=J+Math.imul(o,q0)|0,O=Math.imul(o,z0),H=H+Math.imul(R,T0)|0,J=J+Math.imul(R,j0)|0,J=J+Math.imul(_,T0)|0,O=O+Math.imul(_,j0)|0;var l0=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(l0>>>26)|0,l0&=67108863,H=Math.imul(a,q0),J=Math.imul(a,z0),J=J+Math.imul(l,q0)|0,O=Math.imul(l,z0),H=H+Math.imul(c,T0)|0,J=J+Math.imul(c,j0)|0,J=J+Math.imul(o,T0)|0,O=O+Math.imul(o,j0)|0,H=H+Math.imul(R,v0)|0,J=J+Math.imul(R,R0)|0,J=J+Math.imul(_,v0)|0,O=O+Math.imul(_,R0)|0;var b0=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(b0>>>26)|0,b0&=67108863,H=Math.imul(n,q0),J=Math.imul(n,z0),J=J+Math.imul(s,q0)|0,O=Math.imul(s,z0),H=H+Math.imul(a,T0)|0,J=J+Math.imul(a,j0)|0,J=J+Math.imul(l,T0)|0,O=O+Math.imul(l,j0)|0,H=H+Math.imul(c,v0)|0,J=J+Math.imul(c,R0)|0,J=J+Math.imul(o,v0)|0,O=O+Math.imul(o,R0)|0,H=H+Math.imul(R,_0)|0,J=J+Math.imul(R,E0)|0,J=J+Math.imul(_,_0)|0,O=O+Math.imul(_,E0)|0;var t0=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(t0>>>26)|0,t0&=67108863,H=Math.imul(y,q0),J=Math.imul(y,z0),J=J+Math.imul(h,q0)|0,O=Math.imul(h,z0),H=H+Math.imul(n,T0)|0,J=J+Math.imul(n,j0)|0,J=J+Math.imul(s,T0)|0,O=O+Math.imul(s,j0)|0,H=H+Math.imul(a,v0)|0,J=J+Math.imul(a,R0)|0,J=J+Math.imul(l,v0)|0,O=O+Math.imul(l,R0)|0,H=H+Math.imul(c,_0)|0,J=J+Math.imul(c,E0)|0,J=J+Math.imul(o,_0)|0,O=O+Math.imul(o,E0)|0,H=H+Math.imul(R,B0)|0,J=J+Math.imul(R,x0)|0,J=J+Math.imul(_,B0)|0,O=O+Math.imul(_,x0)|0;var r0=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(r0>>>26)|0,r0&=67108863,H=Math.imul(t,q0),J=Math.imul(t,z0),J=J+Math.imul(U0,q0)|0,O=Math.imul(U0,z0),H=H+Math.imul(y,T0)|0,J=J+Math.imul(y,j0)|0,J=J+Math.imul(h,T0)|0,O=O+Math.imul(h,j0)|0,H=H+Math.imul(n,v0)|0,J=J+Math.imul(n,R0)|0,J=J+Math.imul(s,v0)|0,O=O+Math.imul(s,R0)|0,H=H+Math.imul(a,_0)|0,J=J+Math.imul(a,E0)|0,J=J+Math.imul(l,_0)|0,O=O+Math.imul(l,E0)|0,H=H+Math.imul(c,B0)|0,J=J+Math.imul(c,x0)|0,J=J+Math.imul(o,B0)|0,O=O+Math.imul(o,x0)|0,H=H+Math.imul(R,S0)|0,J=J+Math.imul(R,g)|0,J=J+Math.imul(_,S0)|0,O=O+Math.imul(_,g)|0;var H1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(H1>>>26)|0,H1&=67108863,H=Math.imul(p,q0),J=Math.imul(p,z0),J=J+Math.imul(m,q0)|0,O=Math.imul(m,z0),H=H+Math.imul(t,T0)|0,J=J+Math.imul(t,j0)|0,J=J+Math.imul(U0,T0)|0,O=O+Math.imul(U0,j0)|0,H=H+Math.imul(y,v0)|0,J=J+Math.imul(y,R0)|0,J=J+Math.imul(h,v0)|0,O=O+Math.imul(h,R0)|0,H=H+Math.imul(n,_0)|0,J=J+Math.imul(n,E0)|0,J=J+Math.imul(s,_0)|0,O=O+Math.imul(s,E0)|0,H=H+Math.imul(a,B0)|0,J=J+Math.imul(a,x0)|0,J=J+Math.imul(l,B0)|0,O=O+Math.imul(l,x0)|0,H=H+Math.imul(c,S0)|0,J=J+Math.imul(c,g)|0,J=J+Math.imul(o,S0)|0,O=O+Math.imul(o,g)|0,H=H+Math.imul(R,e)|0,J=J+Math.imul(R,X0)|0,J=J+Math.imul(_,e)|0,O=O+Math.imul(_,X0)|0;var O1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(O1>>>26)|0,O1&=67108863,H=Math.imul(r,q0),J=Math.imul(r,z0),J=J+Math.imul(J0,q0)|0,O=Math.imul(J0,z0),H=H+Math.imul(p,T0)|0,J=J+Math.imul(p,j0)|0,J=J+Math.imul(m,T0)|0,O=O+Math.imul(m,j0)|0,H=H+Math.imul(t,v0)|0,J=J+Math.imul(t,R0)|0,J=J+Math.imul(U0,v0)|0,O=O+Math.imul(U0,R0)|0,H=H+Math.imul(y,_0)|0,J=J+Math.imul(y,E0)|0,J=J+Math.imul(h,_0)|0,O=O+Math.imul(h,E0)|0,H=H+Math.imul(n,B0)|0,J=J+Math.imul(n,x0)|0,J=J+Math.imul(s,B0)|0,O=O+Math.imul(s,x0)|0,H=H+Math.imul(a,S0)|0,J=J+Math.imul(a,g)|0,J=J+Math.imul(l,S0)|0,O=O+Math.imul(l,g)|0,H=H+Math.imul(c,e)|0,J=J+Math.imul(c,X0)|0,J=J+Math.imul(o,e)|0,O=O+Math.imul(o,X0)|0,H=H+Math.imul(R,F0)|0,J=J+Math.imul(R,A0)|0,J=J+Math.imul(_,F0)|0,O=O+Math.imul(_,A0)|0;var C1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(C1>>>26)|0,C1&=67108863,H=Math.imul(H0,q0),J=Math.imul(H0,z0),J=J+Math.imul(O0,q0)|0,O=Math.imul(O0,z0),H=H+Math.imul(r,T0)|0,J=J+Math.imul(r,j0)|0,J=J+Math.imul(J0,T0)|0,O=O+Math.imul(J0,j0)|0,H=H+Math.imul(p,v0)|0,J=J+Math.imul(p,R0)|0,J=J+Math.imul(m,v0)|0,O=O+Math.imul(m,R0)|0,H=H+Math.imul(t,_0)|0,J=J+Math.imul(t,E0)|0,J=J+Math.imul(U0,_0)|0,O=O+Math.imul(U0,E0)|0,H=H+Math.imul(y,B0)|0,J=J+Math.imul(y,x0)|0,J=J+Math.imul(h,B0)|0,O=O+Math.imul(h,x0)|0,H=H+Math.imul(n,S0)|0,J=J+Math.imul(n,g)|0,J=J+Math.imul(s,S0)|0,O=O+Math.imul(s,g)|0,H=H+Math.imul(a,e)|0,J=J+Math.imul(a,X0)|0,J=J+Math.imul(l,e)|0,O=O+Math.imul(l,X0)|0,H=H+Math.imul(c,F0)|0,J=J+Math.imul(c,A0)|0,J=J+Math.imul(o,F0)|0,O=O+Math.imul(o,A0)|0,H=H+Math.imul(R,P0)|0,J=J+Math.imul(R,N0)|0,J=J+Math.imul(_,P0)|0,O=O+Math.imul(_,N0)|0;var A1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(A1>>>26)|0,A1&=67108863,H=Math.imul(I0,q0),J=Math.imul(I0,z0),J=J+Math.imul(C0,q0)|0,O=Math.imul(C0,z0),H=H+Math.imul(H0,T0)|0,J=J+Math.imul(H0,j0)|0,J=J+Math.imul(O0,T0)|0,O=O+Math.imul(O0,j0)|0,H=H+Math.imul(r,v0)|0,J=J+Math.imul(r,R0)|0,J=J+Math.imul(J0,v0)|0,O=O+Math.imul(J0,R0)|0,H=H+Math.imul(p,_0)|0,J=J+Math.imul(p,E0)|0,J=J+Math.imul(m,_0)|0,O=O+Math.imul(m,E0)|0,H=H+Math.imul(t,B0)|0,J=J+Math.imul(t,x0)|0,J=J+Math.imul(U0,B0)|0,O=O+Math.imul(U0,x0)|0,H=H+Math.imul(y,S0)|0,J=J+Math.imul(y,g)|0,J=J+Math.imul(h,S0)|0,O=O+Math.imul(h,g)|0,H=H+Math.imul(n,e)|0,J=J+Math.imul(n,X0)|0,J=J+Math.imul(s,e)|0,O=O+Math.imul(s,X0)|0,H=H+Math.imul(a,F0)|0,J=J+Math.imul(a,A0)|0,J=J+Math.imul(l,F0)|0,O=O+Math.imul(l,A0)|0,H=H+Math.imul(c,P0)|0,J=J+Math.imul(c,N0)|0,J=J+Math.imul(o,P0)|0,O=O+Math.imul(o,N0)|0,H=H+Math.imul(R,k0)|0,J=J+Math.imul(R,M0)|0,J=J+Math.imul(_,k0)|0,O=O+Math.imul(_,M0)|0;var z1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(z1>>>26)|0,z1&=67108863,H=Math.imul(I0,T0),J=Math.imul(I0,j0),J=J+Math.imul(C0,T0)|0,O=Math.imul(C0,j0),H=H+Math.imul(H0,v0)|0,J=J+Math.imul(H0,R0)|0,J=J+Math.imul(O0,v0)|0,O=O+Math.imul(O0,R0)|0,H=H+Math.imul(r,_0)|0,J=J+Math.imul(r,E0)|0,J=J+Math.imul(J0,_0)|0,O=O+Math.imul(J0,E0)|0,H=H+Math.imul(p,B0)|0,J=J+Math.imul(p,x0)|0,J=J+Math.imul(m,B0)|0,O=O+Math.imul(m,x0)|0,H=H+Math.imul(t,S0)|0,J=J+Math.imul(t,g)|0,J=J+Math.imul(U0,S0)|0,O=O+Math.imul(U0,g)|0,H=H+Math.imul(y,e)|0,J=J+Math.imul(y,X0)|0,J=J+Math.imul(h,e)|0,O=O+Math.imul(h,X0)|0,H=H+Math.imul(n,F0)|0,J=J+Math.imul(n,A0)|0,J=J+Math.imul(s,F0)|0,O=O+Math.imul(s,A0)|0,H=H+Math.imul(a,P0)|0,J=J+Math.imul(a,N0)|0,J=J+Math.imul(l,P0)|0,O=O+Math.imul(l,N0)|0,H=H+Math.imul(c,k0)|0,J=J+Math.imul(c,M0)|0,J=J+Math.imul(o,k0)|0,O=O+Math.imul(o,M0)|0;var D1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(D1>>>26)|0,D1&=67108863,H=Math.imul(I0,v0),J=Math.imul(I0,R0),J=J+Math.imul(C0,v0)|0,O=Math.imul(C0,R0),H=H+Math.imul(H0,_0)|0,J=J+Math.imul(H0,E0)|0,J=J+Math.imul(O0,_0)|0,O=O+Math.imul(O0,E0)|0,H=H+Math.imul(r,B0)|0,J=J+Math.imul(r,x0)|0,J=J+Math.imul(J0,B0)|0,O=O+Math.imul(J0,x0)|0,H=H+Math.imul(p,S0)|0,J=J+Math.imul(p,g)|0,J=J+Math.imul(m,S0)|0,O=O+Math.imul(m,g)|0,H=H+Math.imul(t,e)|0,J=J+Math.imul(t,X0)|0,J=J+Math.imul(U0,e)|0,O=O+Math.imul(U0,X0)|0,H=H+Math.imul(y,F0)|0,J=J+Math.imul(y,A0)|0,J=J+Math.imul(h,F0)|0,O=O+Math.imul(h,A0)|0,H=H+Math.imul(n,P0)|0,J=J+Math.imul(n,N0)|0,J=J+Math.imul(s,P0)|0,O=O+Math.imul(s,N0)|0,H=H+Math.imul(a,k0)|0,J=J+Math.imul(a,M0)|0,J=J+Math.imul(l,k0)|0,O=O+Math.imul(l,M0)|0;var q1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(q1>>>26)|0,q1&=67108863,H=Math.imul(I0,_0),J=Math.imul(I0,E0),J=J+Math.imul(C0,_0)|0,O=Math.imul(C0,E0),H=H+Math.imul(H0,B0)|0,J=J+Math.imul(H0,x0)|0,J=J+Math.imul(O0,B0)|0,O=O+Math.imul(O0,x0)|0,H=H+Math.imul(r,S0)|0,J=J+Math.imul(r,g)|0,J=J+Math.imul(J0,S0)|0,O=O+Math.imul(J0,g)|0,H=H+Math.imul(p,e)|0,J=J+Math.imul(p,X0)|0,J=J+Math.imul(m,e)|0,O=O+Math.imul(m,X0)|0,H=H+Math.imul(t,F0)|0,J=J+Math.imul(t,A0)|0,J=J+Math.imul(U0,F0)|0,O=O+Math.imul(U0,A0)|0,H=H+Math.imul(y,P0)|0,J=J+Math.imul(y,N0)|0,J=J+Math.imul(h,P0)|0,O=O+Math.imul(h,N0)|0,H=H+Math.imul(n,k0)|0,J=J+Math.imul(n,M0)|0,J=J+Math.imul(s,k0)|0,O=O+Math.imul(s,M0)|0;var M1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(M1>>>26)|0,M1&=67108863,H=Math.imul(I0,B0),J=Math.imul(I0,x0),J=J+Math.imul(C0,B0)|0,O=Math.imul(C0,x0),H=H+Math.imul(H0,S0)|0,J=J+Math.imul(H0,g)|0,J=J+Math.imul(O0,S0)|0,O=O+Math.imul(O0,g)|0,H=H+Math.imul(r,e)|0,J=J+Math.imul(r,X0)|0,J=J+Math.imul(J0,e)|0,O=O+Math.imul(J0,X0)|0,H=H+Math.imul(p,F0)|0,J=J+Math.imul(p,A0)|0,J=J+Math.imul(m,F0)|0,O=O+Math.imul(m,A0)|0,H=H+Math.imul(t,P0)|0,J=J+Math.imul(t,N0)|0,J=J+Math.imul(U0,P0)|0,O=O+Math.imul(U0,N0)|0,H=H+Math.imul(y,k0)|0,J=J+Math.imul(y,M0)|0,J=J+Math.imul(h,k0)|0,O=O+Math.imul(h,M0)|0;var L1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(L1>>>26)|0,L1&=67108863,H=Math.imul(I0,S0),J=Math.imul(I0,g),J=J+Math.imul(C0,S0)|0,O=Math.imul(C0,g),H=H+Math.imul(H0,e)|0,J=J+Math.imul(H0,X0)|0,J=J+Math.imul(O0,e)|0,O=O+Math.imul(O0,X0)|0,H=H+Math.imul(r,F0)|0,J=J+Math.imul(r,A0)|0,J=J+Math.imul(J0,F0)|0,O=O+Math.imul(J0,A0)|0,H=H+Math.imul(p,P0)|0,J=J+Math.imul(p,N0)|0,J=J+Math.imul(m,P0)|0,O=O+Math.imul(m,N0)|0,H=H+Math.imul(t,k0)|0,J=J+Math.imul(t,M0)|0,J=J+Math.imul(U0,k0)|0,O=O+Math.imul(U0,M0)|0;var T1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(T1>>>26)|0,T1&=67108863,H=Math.imul(I0,e),J=Math.imul(I0,X0),J=J+Math.imul(C0,e)|0,O=Math.imul(C0,X0),H=H+Math.imul(H0,F0)|0,J=J+Math.imul(H0,A0)|0,J=J+Math.imul(O0,F0)|0,O=O+Math.imul(O0,A0)|0,H=H+Math.imul(r,P0)|0,J=J+Math.imul(r,N0)|0,J=J+Math.imul(J0,P0)|0,O=O+Math.imul(J0,N0)|0,H=H+Math.imul(p,k0)|0,J=J+Math.imul(p,M0)|0,J=J+Math.imul(m,k0)|0,O=O+Math.imul(m,M0)|0;var R1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(R1>>>26)|0,R1&=67108863,H=Math.imul(I0,F0),J=Math.imul(I0,A0),J=J+Math.imul(C0,F0)|0,O=Math.imul(C0,A0),H=H+Math.imul(H0,P0)|0,J=J+Math.imul(H0,N0)|0,J=J+Math.imul(O0,P0)|0,O=O+Math.imul(O0,N0)|0,H=H+Math.imul(r,k0)|0,J=J+Math.imul(r,M0)|0,J=J+Math.imul(J0,k0)|0,O=O+Math.imul(J0,M0)|0;var E1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(E1>>>26)|0,E1&=67108863,H=Math.imul(I0,P0),J=Math.imul(I0,N0),J=J+Math.imul(C0,P0)|0,O=Math.imul(C0,N0),H=H+Math.imul(H0,k0)|0,J=J+Math.imul(H0,M0)|0,J=J+Math.imul(O0,k0)|0,O=O+Math.imul(O0,M0)|0;var S1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(S1>>>26)|0,S1&=67108863,H=Math.imul(I0,k0),J=Math.imul(I0,M0),J=J+Math.imul(C0,k0)|0,O=Math.imul(C0,M0);var P1=(D+H|0)+((J&8191)<<13)|0;if(D=(O+(J>>>13)|0)+(P1>>>26)|0,P1&=67108863,C[0]=G1,C[1]=l0,C[2]=b0,C[3]=t0,C[4]=r0,C[5]=H1,C[6]=O1,C[7]=C1,C[8]=A1,C[9]=z1,C[10]=D1,C[11]=q1,C[12]=M1,C[13]=L1,C[14]=T1,C[15]=R1,C[16]=E1,C[17]=S1,C[18]=P1,D!==0)C[19]=D,I.length++;return I};if(!Math.imul)k=j;function B(Y,V,I){I.negative=V.negative^Y.negative,I.length=Y.length+V.length;var G=0,W=0;for(var C=0;C<I.length-1;C++){var D=W;W=0;var H=G&67108863,J=Math.min(C,V.length-1);for(var O=Math.max(0,C-Y.length+1);O<=J;O++){var P=C-O,R=Y.words[P]|0,_=V.words[O]|0,f=R*_,c=f&67108863;D=D+(f/67108864|0)|0,c=c+H|0,H=c&67108863,D=D+(c>>>26)|0,W+=D>>>26,D&=67108863}I.words[C]=H,G=D,D=W}if(G!==0)I.words[C]=G;else I.length--;return I.strip()}function v(Y,V,I){var G=new x;return G.mulp(Y,V,I)}$.prototype.mulTo=function(Y,V){var I,G=this.length+Y.length;if(this.length===10&&Y.length===10)I=k(this,Y,V);else if(G<63)I=j(this,Y,V);else if(G<1024)I=B(this,Y,V);else I=v(this,Y,V);return I};function x(Y,V){this.x=Y,this.y=V}x.prototype.makeRBT=function(Y){var V=Array(Y),I=$.prototype._countBits(Y)-1;for(var G=0;G<Y;G++)V[G]=this.revBin(G,I,Y);return V},x.prototype.revBin=function(Y,V,I){if(Y===0||Y===I-1)return Y;var G=0;for(var W=0;W<V;W++)G|=(Y&1)<<V-W-1,Y>>=1;return G},x.prototype.permute=function(Y,V,I,G,W,C){for(var D=0;D<C;D++)G[D]=V[Y[D]],W[D]=I[Y[D]]},x.prototype.transform=function(Y,V,I,G,W,C){this.permute(C,Y,V,I,G,W);for(var D=1;D<W;D<<=1){var H=D<<1,J=Math.cos(2*Math.PI/H),O=Math.sin(2*Math.PI/H);for(var P=0;P<W;P+=H){var R=J,_=O;for(var f=0;f<D;f++){var c=I[P+f],o=G[P+f],K0=I[P+f+D],a=G[P+f+D],l=R*K0-_*a;if(a=R*a+_*K0,K0=l,I[P+f]=c+K0,G[P+f]=o+a,I[P+f+D]=c-K0,G[P+f+D]=o-a,f!==H)l=J*R-O*_,_=J*_+O*R,R=l}}}},x.prototype.guessLen13b=function(Y,V){var I=Math.max(V,Y)|1,G=I&1,W=0;for(I=I/2|0;I;I=I>>>1)W++;return 1<<W+1+G},x.prototype.conjugate=function(Y,V,I){if(I<=1)return;for(var G=0;G<I/2;G++){var W=Y[G];Y[G]=Y[I-G-1],Y[I-G-1]=W,W=V[G],V[G]=-V[I-G-1],V[I-G-1]=-W}},x.prototype.normalize13b=function(Y,V){var I=0;for(var G=0;G<V/2;G++){var W=Math.round(Y[2*G+1]/V)*8192+Math.round(Y[2*G]/V)+I;if(Y[G]=W&67108863,W<67108864)I=0;else I=W/67108864|0}return Y},x.prototype.convert13b=function(Y,V,I,G){var W=0;for(var C=0;C<V;C++)W=W+(Y[C]|0),I[2*C]=W&8191,W=W>>>13,I[2*C+1]=W&8191,W=W>>>13;for(C=2*V;C<G;++C)I[C]=0;K(W===0),K((W&-8192)===0)},x.prototype.stub=function(Y){var V=Array(Y);for(var I=0;I<Y;I++)V[I]=0;return V},x.prototype.mulp=function(Y,V,I){var G=2*this.guessLen13b(Y.length,V.length),W=this.makeRBT(G),C=this.stub(G),D=Array(G),H=Array(G),J=Array(G),O=Array(G),P=Array(G),R=Array(G),_=I.words;_.length=G,this.convert13b(Y.words,Y.length,D,G),this.convert13b(V.words,V.length,O,G),this.transform(D,C,H,J,G,W),this.transform(O,C,P,R,G,W);for(var f=0;f<G;f++){var c=H[f]*P[f]-J[f]*R[f];J[f]=H[f]*R[f]+J[f]*P[f],H[f]=c}return this.conjugate(H,J,G),this.transform(H,J,_,C,G,W),this.conjugate(_,C,G),this.normalize13b(_,G),I.negative=Y.negative^V.negative,I.length=Y.length+V.length,I.strip()},$.prototype.mul=function(Y){var V=new $(null);return V.words=Array(this.length+Y.length),this.mulTo(Y,V)},$.prototype.mulf=function(Y){var V=new $(null);return V.words=Array(this.length+Y.length),v(this,Y,V)},$.prototype.imul=function(Y){return this.clone().mulTo(Y,this)},$.prototype.imuln=function(Y){K(typeof Y==="number"),K(Y<67108864);var V=0;for(var I=0;I<this.length;I++){var G=(this.words[I]|0)*Y,W=(G&67108863)+(V&67108863);V>>=26,V+=G/67108864|0,V+=W>>>26,this.words[I]=W&67108863}if(V!==0)this.words[I]=V,this.length++;return this.length=Y===0?1:this.length,this},$.prototype.muln=function(Y){return this.clone().imuln(Y)},$.prototype.sqr=function(){return this.mul(this)},$.prototype.isqr=function(){return this.imul(this.clone())},$.prototype.pow=function(Y){var V=S(Y);if(V.length===0)return new $(1);var I=this;for(var G=0;G<V.length;G++,I=I.sqr())if(V[G]!==0)break;if(++G<V.length)for(var W=I.sqr();G<V.length;G++,W=W.sqr()){if(V[G]===0)continue;I=I.mul(W)}return I},$.prototype.iushln=function(Y){K(typeof Y==="number"&&Y>=0);var V=Y%26,I=(Y-V)/26,G=67108863>>>26-V<<26-V,W;if(V!==0){var C=0;for(W=0;W<this.length;W++){var D=this.words[W]&G,H=(this.words[W]|0)-D<<V;this.words[W]=H|C,C=D>>>26-V}if(C)this.words[W]=C,this.length++}if(I!==0){for(W=this.length-1;W>=0;W--)this.words[W+I]=this.words[W];for(W=0;W<I;W++)this.words[W]=0;this.length+=I}return this.strip()},$.prototype.ishln=function(Y){return K(this.negative===0),this.iushln(Y)},$.prototype.iushrn=function(Y,V,I){K(typeof Y==="number"&&Y>=0);var G;if(V)G=(V-V%26)/26;else G=0;var W=Y%26,C=Math.min((Y-W)/26,this.length),D=67108863^67108863>>>W<<W,H=I;if(G-=C,G=Math.max(0,G),H){for(var J=0;J<C;J++)H.words[J]=this.words[J];H.length=C}if(C===0);else if(this.length>C){this.length-=C;for(J=0;J<this.length;J++)this.words[J]=this.words[J+C]}else this.words[0]=0,this.length=1;var O=0;for(J=this.length-1;J>=0&&(O!==0||J>=G);J--){var P=this.words[J]|0;this.words[J]=O<<26-W|P>>>W,O=P&D}if(H&&O!==0)H.words[H.length++]=O;if(this.length===0)this.words[0]=0,this.length=1;return this.strip()},$.prototype.ishrn=function(Y,V,I){return K(this.negative===0),this.iushrn(Y,V,I)},$.prototype.shln=function(Y){return this.clone().ishln(Y)},$.prototype.ushln=function(Y){return this.clone().iushln(Y)},$.prototype.shrn=function(Y){return this.clone().ishrn(Y)},$.prototype.ushrn=function(Y){return this.clone().iushrn(Y)},$.prototype.testn=function(Y){K(typeof Y==="number"&&Y>=0);var V=Y%26,I=(Y-V)/26,G=1<<V;if(this.length<=I)return!1;var W=this.words[I];return!!(W&G)},$.prototype.imaskn=function(Y){K(typeof Y==="number"&&Y>=0);var V=Y%26,I=(Y-V)/26;if(K(this.negative===0,"imaskn works only with positive numbers"),this.length<=I)return this;if(V!==0)I++;if(this.length=Math.min(I,this.length),V!==0){var G=67108863^67108863>>>V<<V;this.words[this.length-1]&=G}return this.strip()},$.prototype.maskn=function(Y){return this.clone().imaskn(Y)},$.prototype.iaddn=function(Y){if(K(typeof Y==="number"),K(Y<67108864),Y<0)return this.isubn(-Y);if(this.negative!==0){if(this.length===1&&(this.words[0]|0)<Y)return this.words[0]=Y-(this.words[0]|0),this.negative=0,this;return this.negative=0,this.isubn(Y),this.negative=1,this}return this._iaddn(Y)},$.prototype._iaddn=function(Y){this.words[0]+=Y;for(var V=0;V<this.length&&this.words[V]>=67108864;V++)if(this.words[V]-=67108864,V===this.length-1)this.words[V+1]=1;else this.words[V+1]++;return this.length=Math.max(this.length,V+1),this},$.prototype.isubn=function(Y){if(K(typeof Y==="number"),K(Y<67108864),Y<0)return this.iaddn(-Y);if(this.negative!==0)return this.negative=0,this.iaddn(Y),this.negative=1,this;if(this.words[0]-=Y,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var V=0;V<this.length&&this.words[V]<0;V++)this.words[V]+=67108864,this.words[V+1]-=1;return this.strip()},$.prototype.addn=function(Y){return this.clone().iaddn(Y)},$.prototype.subn=function(Y){return this.clone().isubn(Y)},$.prototype.iabs=function(){return this.negative=0,this},$.prototype.abs=function(){return this.clone().iabs()},$.prototype._ishlnsubmul=function(Y,V,I){var G=Y.length+I,W;this._expand(G);var C,D=0;for(W=0;W<Y.length;W++){C=(this.words[W+I]|0)+D;var H=(Y.words[W]|0)*V;C-=H&67108863,D=(C>>26)-(H/67108864|0),this.words[W+I]=C&67108863}for(;W<this.length-I;W++)C=(this.words[W+I]|0)+D,D=C>>26,this.words[W+I]=C&67108863;if(D===0)return this.strip();K(D===-1),D=0;for(W=0;W<this.length;W++)C=-(this.words[W]|0)+D,D=C>>26,this.words[W]=C&67108863;return this.negative=1,this.strip()},$.prototype._wordDiv=function(Y,V){var I=this.length-Y.length,G=this.clone(),W=Y,C=W.words[W.length-1]|0,D=this._countBits(C);if(I=26-D,I!==0)W=W.ushln(I),G.iushln(I),C=W.words[W.length-1]|0;var H=G.length-W.length,J;if(V!=="mod"){J=new $(null),J.length=H+1,J.words=Array(J.length);for(var O=0;O<J.length;O++)J.words[O]=0}var P=G.clone()._ishlnsubmul(W,1,H);if(P.negative===0){if(G=P,J)J.words[H]=1}for(var R=H-1;R>=0;R--){var _=(G.words[W.length+R]|0)*67108864+(G.words[W.length+R-1]|0);_=Math.min(_/C|0,67108863),G._ishlnsubmul(W,_,R);while(G.negative!==0)if(_--,G.negative=0,G._ishlnsubmul(W,1,R),!G.isZero())G.negative^=1;if(J)J.words[R]=_}if(J)J.strip();if(G.strip(),V!=="div"&&I!==0)G.iushrn(I);return{div:J||null,mod:G}},$.prototype.divmod=function(Y,V,I){if(K(!Y.isZero()),this.isZero())return{div:new $(0),mod:new $(0)};var G,W,C;if(this.negative!==0&&Y.negative===0){if(C=this.neg().divmod(Y,V),V!=="mod")G=C.div.neg();if(V!=="div"){if(W=C.mod.neg(),I&&W.negative!==0)W.iadd(Y)}return{div:G,mod:W}}if(this.negative===0&&Y.negative!==0){if(C=this.divmod(Y.neg(),V),V!=="mod")G=C.div.neg();return{div:G,mod:C.mod}}if((this.negative&Y.negative)!==0){if(C=this.neg().divmod(Y.neg(),V),V!=="div"){if(W=C.mod.neg(),I&&W.negative!==0)W.isub(Y)}return{div:C.div,mod:W}}if(Y.length>this.length||this.cmp(Y)<0)return{div:new $(0),mod:this};if(Y.length===1){if(V==="div")return{div:this.divn(Y.words[0]),mod:null};if(V==="mod")return{div:null,mod:new $(this.modn(Y.words[0]))};return{div:this.divn(Y.words[0]),mod:new $(this.modn(Y.words[0]))}}return this._wordDiv(Y,V)},$.prototype.div=function(Y){return this.divmod(Y,"div",!1).div},$.prototype.mod=function(Y){return this.divmod(Y,"mod",!1).mod},$.prototype.umod=function(Y){return this.divmod(Y,"mod",!0).mod},$.prototype.divRound=function(Y){var V=this.divmod(Y);if(V.mod.isZero())return V.div;var I=V.div.negative!==0?V.mod.isub(Y):V.mod,G=Y.ushrn(1),W=Y.andln(1),C=I.cmp(G);if(C<0||W===1&&C===0)return V.div;return V.div.negative!==0?V.div.isubn(1):V.div.iaddn(1)},$.prototype.modn=function(Y){K(Y<=67108863);var V=67108864%Y,I=0;for(var G=this.length-1;G>=0;G--)I=(V*I+(this.words[G]|0))%Y;return I},$.prototype.idivn=function(Y){K(Y<=67108863);var V=0;for(var I=this.length-1;I>=0;I--){var G=(this.words[I]|0)+V*67108864;this.words[I]=G/Y|0,V=G%Y}return this.strip()},$.prototype.divn=function(Y){return this.clone().idivn(Y)},$.prototype.egcd=function(Y){K(Y.negative===0),K(!Y.isZero());var V=this,I=Y.clone();if(V.negative!==0)V=V.umod(Y);else V=V.clone();var G=new $(1),W=new $(0),C=new $(0),D=new $(1),H=0;while(V.isEven()&&I.isEven())V.iushrn(1),I.iushrn(1),++H;var J=I.clone(),O=V.clone();while(!V.isZero()){for(var P=0,R=1;(V.words[0]&R)===0&&P<26;++P,R<<=1);if(P>0){V.iushrn(P);while(P-- >0){if(G.isOdd()||W.isOdd())G.iadd(J),W.isub(O);G.iushrn(1),W.iushrn(1)}}for(var _=0,f=1;(I.words[0]&f)===0&&_<26;++_,f<<=1);if(_>0){I.iushrn(_);while(_-- >0){if(C.isOdd()||D.isOdd())C.iadd(J),D.isub(O);C.iushrn(1),D.iushrn(1)}}if(V.cmp(I)>=0)V.isub(I),G.isub(C),W.isub(D);else I.isub(V),C.isub(G),D.isub(W)}return{a:C,b:D,gcd:I.iushln(H)}},$.prototype._invmp=function(Y){K(Y.negative===0),K(!Y.isZero());var V=this,I=Y.clone();if(V.negative!==0)V=V.umod(Y);else V=V.clone();var G=new $(1),W=new $(0),C=I.clone();while(V.cmpn(1)>0&&I.cmpn(1)>0){for(var D=0,H=1;(V.words[0]&H)===0&&D<26;++D,H<<=1);if(D>0){V.iushrn(D);while(D-- >0){if(G.isOdd())G.iadd(C);G.iushrn(1)}}for(var J=0,O=1;(I.words[0]&O)===0&&J<26;++J,O<<=1);if(J>0){I.iushrn(J);while(J-- >0){if(W.isOdd())W.iadd(C);W.iushrn(1)}}if(V.cmp(I)>=0)V.isub(I),G.isub(W);else I.isub(V),W.isub(G)}var P;if(V.cmpn(1)===0)P=G;else P=W;if(P.cmpn(0)<0)P.iadd(Y);return P},$.prototype.gcd=function(Y){if(this.isZero())return Y.abs();if(Y.isZero())return this.abs();var V=this.clone(),I=Y.clone();V.negative=0,I.negative=0;for(var G=0;V.isEven()&&I.isEven();G++)V.iushrn(1),I.iushrn(1);do{while(V.isEven())V.iushrn(1);while(I.isEven())I.iushrn(1);var W=V.cmp(I);if(W<0){var C=V;V=I,I=C}else if(W===0||I.cmpn(1)===0)break;V.isub(I)}while(!0);return I.iushln(G)},$.prototype.invm=function(Y){return this.egcd(Y).a.umod(Y)},$.prototype.isEven=function(){return(this.words[0]&1)===0},$.prototype.isOdd=function(){return(this.words[0]&1)===1},$.prototype.andln=function(Y){return this.words[0]&Y},$.prototype.bincn=function(Y){K(typeof Y==="number");var V=Y%26,I=(Y-V)/26,G=1<<V;if(this.length<=I)return this._expand(I+1),this.words[I]|=G,this;var W=G;for(var C=I;W!==0&&C<this.length;C++){var D=this.words[C]|0;D+=W,W=D>>>26,D&=67108863,this.words[C]=D}if(W!==0)this.words[C]=W,this.length++;return this},$.prototype.isZero=function(){return this.length===1&&this.words[0]===0},$.prototype.cmpn=function(Y){var V=Y<0;if(this.negative!==0&&!V)return-1;if(this.negative===0&&V)return 1;this.strip();var I;if(this.length>1)I=1;else{if(V)Y=-Y;K(Y<=67108863,"Number is too big");var G=this.words[0]|0;I=G===Y?0:G<Y?-1:1}if(this.negative!==0)return-I|0;return I},$.prototype.cmp=function(Y){if(this.negative!==0&&Y.negative===0)return-1;if(this.negative===0&&Y.negative!==0)return 1;var V=this.ucmp(Y);if(this.negative!==0)return-V|0;return V},$.prototype.ucmp=function(Y){if(this.length>Y.length)return 1;if(this.length<Y.length)return-1;var V=0;for(var I=this.length-1;I>=0;I--){var G=this.words[I]|0,W=Y.words[I]|0;if(G===W)continue;if(G<W)V=-1;else if(G>W)V=1;break}return V},$.prototype.gtn=function(Y){return this.cmpn(Y)===1},$.prototype.gt=function(Y){return this.cmp(Y)===1},$.prototype.gten=function(Y){return this.cmpn(Y)>=0},$.prototype.gte=function(Y){return this.cmp(Y)>=0},$.prototype.ltn=function(Y){return this.cmpn(Y)===-1},$.prototype.lt=function(Y){return this.cmp(Y)===-1},$.prototype.lten=function(Y){return this.cmpn(Y)<=0},$.prototype.lte=function(Y){return this.cmp(Y)<=0},$.prototype.eqn=function(Y){return this.cmpn(Y)===0},$.prototype.eq=function(Y){return this.cmp(Y)===0},$.red=function(Y){return new b(Y)},$.prototype.toRed=function(Y){return K(!this.red,"Already a number in reduction context"),K(this.negative===0,"red works only with positives"),Y.convertTo(this)._forceRed(Y)},$.prototype.fromRed=function(){return K(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},$.prototype._forceRed=function(Y){return this.red=Y,this},$.prototype.forceRed=function(Y){return K(!this.red,"Already a number in reduction context"),this._forceRed(Y)},$.prototype.redAdd=function(Y){return K(this.red,"redAdd works only with red numbers"),this.red.add(this,Y)},$.prototype.redIAdd=function(Y){return K(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,Y)},$.prototype.redSub=function(Y){return K(this.red,"redSub works only with red numbers"),this.red.sub(this,Y)},$.prototype.redISub=function(Y){return K(this.red,"redISub works only with red numbers"),this.red.isub(this,Y)},$.prototype.redShl=function(Y){return K(this.red,"redShl works only with red numbers"),this.red.shl(this,Y)},$.prototype.redMul=function(Y){return K(this.red,"redMul works only with red numbers"),this.red._verify2(this,Y),this.red.mul(this,Y)},$.prototype.redIMul=function(Y){return K(this.red,"redMul works only with red numbers"),this.red._verify2(this,Y),this.red.imul(this,Y)},$.prototype.redSqr=function(){return K(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},$.prototype.redISqr=function(){return K(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},$.prototype.redSqrt=function(){return K(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},$.prototype.redInvm=function(){return K(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},$.prototype.redNeg=function(){return K(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},$.prototype.redPow=function(Y){return K(this.red&&!Y.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,Y)};var N={k256:null,p224:null,p192:null,p25519:null};function w(Y,V){this.name=Y,this.p=new $(V,16),this.n=this.p.bitLength(),this.k=new $(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}w.prototype._tmp=function(){var Y=new $(null);return Y.words=Array(Math.ceil(this.n/13)),Y},w.prototype.ireduce=function(Y){var V=Y,I;do this.split(V,this.tmp),V=this.imulK(V),V=V.iadd(this.tmp),I=V.bitLength();while(I>this.n);var G=I<this.n?-1:V.ucmp(this.p);if(G===0)V.words[0]=0,V.length=1;else if(G>0)V.isub(this.p);else if(V.strip!==void 0)V.strip();else V._strip();return V},w.prototype.split=function(Y,V){Y.iushrn(this.n,0,V)},w.prototype.imulK=function(Y){return Y.imul(this.k)};function u(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}F(u,w),u.prototype.split=function(Y,V){var I=4194303,G=Math.min(Y.length,9);for(var W=0;W<G;W++)V.words[W]=Y.words[W];if(V.length=G,Y.length<=9){Y.words[0]=0,Y.length=1;return}var C=Y.words[9];V.words[V.length++]=C&I;for(W=10;W<Y.length;W++){var D=Y.words[W]|0;Y.words[W-10]=(D&I)<<4|C>>>22,C=D}if(C>>>=22,Y.words[W-10]=C,C===0&&Y.length>10)Y.length-=10;else Y.length-=9},u.prototype.imulK=function(Y){Y.words[Y.length]=0,Y.words[Y.length+1]=0,Y.length+=2;var V=0;for(var I=0;I<Y.length;I++){var G=Y.words[I]|0;V+=G*977,Y.words[I]=V&67108863,V=G*64+(V/67108864|0)}if(Y.words[Y.length-1]===0){if(Y.length--,Y.words[Y.length-1]===0)Y.length--}return Y};function Z0(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}F(Z0,w);function V0(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}F(V0,w);function Y0(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}F(Y0,w),Y0.prototype.imulK=function(Y){var V=0;for(var I=0;I<Y.length;I++){var G=(Y.words[I]|0)*19+V,W=G&67108863;G>>>=26,Y.words[I]=W,V=G}if(V!==0)Y.words[Y.length++]=V;return Y},$._prime=function(Y){if(N[Y])return N[Y];var V;if(Y==="k256")V=new u;else if(Y==="p224")V=new Z0;else if(Y==="p192")V=new V0;else if(Y==="p25519")V=new Y0;else throw Error("Unknown prime "+Y);return N[Y]=V,V};function b(Y){if(typeof Y==="string"){var V=$._prime(Y);this.m=V.p,this.prime=V}else K(Y.gtn(1),"modulus must be greater than 1"),this.m=Y,this.prime=null}b.prototype._verify1=function(Y){K(Y.negative===0,"red works only with positives"),K(Y.red,"red works only with red numbers")},b.prototype._verify2=function(Y,V){K((Y.negative|V.negative)===0,"red works only with positives"),K(Y.red&&Y.red===V.red,"red works only with red numbers")},b.prototype.imod=function(Y){if(this.prime)return this.prime.ireduce(Y)._forceRed(this);return Y.umod(this.m)._forceRed(this)},b.prototype.neg=function(Y){if(Y.isZero())return Y.clone();return this.m.sub(Y)._forceRed(this)},b.prototype.add=function(Y,V){this._verify2(Y,V);var I=Y.add(V);if(I.cmp(this.m)>=0)I.isub(this.m);return I._forceRed(this)},b.prototype.iadd=function(Y,V){this._verify2(Y,V);var I=Y.iadd(V);if(I.cmp(this.m)>=0)I.isub(this.m);return I},b.prototype.sub=function(Y,V){this._verify2(Y,V);var I=Y.sub(V);if(I.cmpn(0)<0)I.iadd(this.m);return I._forceRed(this)},b.prototype.isub=function(Y,V){this._verify2(Y,V);var I=Y.isub(V);if(I.cmpn(0)<0)I.iadd(this.m);return I},b.prototype.shl=function(Y,V){return this._verify1(Y),this.imod(Y.ushln(V))},b.prototype.imul=function(Y,V){return this._verify2(Y,V),this.imod(Y.imul(V))},b.prototype.mul=function(Y,V){return this._verify2(Y,V),this.imod(Y.mul(V))},b.prototype.isqr=function(Y){return this.imul(Y,Y.clone())},b.prototype.sqr=function(Y){return this.mul(Y,Y)},b.prototype.sqrt=function(Y){if(Y.isZero())return Y.clone();var V=this.m.andln(3);if(K(V%2===1),V===3){var I=this.m.add(new $(1)).iushrn(2);return this.pow(Y,I)}var G=this.m.subn(1),W=0;while(!G.isZero()&&G.andln(1)===0)W++,G.iushrn(1);K(!G.isZero());var C=new $(1).toRed(this),D=C.redNeg(),H=this.m.subn(1).iushrn(1),J=this.m.bitLength();J=new $(2*J*J).toRed(this);while(this.pow(J,H).cmp(D)!==0)J.redIAdd(D);var O=this.pow(J,G),P=this.pow(Y,G.addn(1).iushrn(1)),R=this.pow(Y,G),_=W;while(R.cmp(C)!==0){var f=R;for(var c=0;f.cmp(C)!==0;c++)f=f.redSqr();K(c<_);var o=this.pow(O,new $(1).iushln(_-c-1));P=P.redMul(o),O=o.redSqr(),R=R.redMul(O),_=c}return P},b.prototype.invm=function(Y){var V=Y._invmp(this.m);if(V.negative!==0)return V.negative=0,this.imod(V).redNeg();else return this.imod(V)},b.prototype.pow=function(Y,V){if(V.isZero())return new $(1).toRed(this);if(V.cmpn(1)===0)return Y.clone();var I=4,G=Array(1<<I);G[0]=new $(1).toRed(this),G[1]=Y;for(var W=2;W<G.length;W++)G[W]=this.mul(G[W-1],Y);var C=G[0],D=0,H=0,J=V.bitLength()%26;if(J===0)J=26;for(W=V.length-1;W>=0;W--){var O=V.words[W];for(var P=J-1;P>=0;P--){var R=O>>P&1;if(C!==G[0])C=this.sqr(C);if(R===0&&D===0){H=0;continue}if(D<<=1,D|=R,H++,H!==I&&(W!==0||P!==0))continue;C=this.mul(C,G[D]),H=0,D=0}J=26}return C},b.prototype.convertTo=function(Y){var V=Y.umod(this.m);return V===Y?V.clone():V},b.prototype.convertFrom=function(Y){var V=Y.clone();return V.red=null,V},$.mont=function(Y){return new i(Y)};function i(Y){if(b.call(this,Y),this.shift=this.m.bitLength(),this.shift%26!==0)this.shift+=26-this.shift%26;this.r=new $(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}F(i,b),i.prototype.convertTo=function(Y){return this.imod(Y.ushln(this.shift))},i.prototype.convertFrom=function(Y){var V=this.imod(Y.mul(this.rinv));return V.red=null,V},i.prototype.imul=function(Y,V){if(Y.isZero()||V.isZero())return Y.words[0]=0,Y.length=1,Y;var I=Y.imul(V),G=I.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),W=I.isub(G).iushrn(this.shift),C=W;if(W.cmp(this.m)>=0)C=W.isub(this.m);else if(W.cmpn(0)<0)C=W.iadd(this.m);return C._forceRed(this)},i.prototype.mul=function(Y,V){if(Y.isZero()||V.isZero())return new $(0)._forceRed(this);var I=Y.mul(V),G=I.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),W=I.isub(G).iushrn(this.shift),C=W;if(W.cmp(this.m)>=0)C=W.isub(this.m);else if(W.cmpn(0)<0)C=W.iadd(this.m);return C._forceRed(this)},i.prototype.invm=function(Y){var V=this.imod(Y._invmp(this.m).mul(this.r2));return V._forceRed(this)}})(typeof Z>"u"||Z,U)}),cU=$0((U,Z)=>{Z.exports=X;function X(Q,K){if(!Q)throw Error(K||"Assertion failed")}X.equal=function(Q,K,F){if(Q!=K)throw Error(F||"Assertion failed: "+Q+" != "+K)}}),UV=$0((U)=>{var Z=U;function X(F,$){if(Array.isArray(F))return F.slice();if(!F)return[];var q=[];if(typeof F!=="string"){for(var M=0;M<F.length;M++)q[M]=F[M]|0;return q}if($==="hex"){if(F=F.replace(/[^a-z0-9]+/ig,""),F.length%2!==0)F="0"+F;for(var M=0;M<F.length;M+=2)q.push(parseInt(F[M]+F[M+1],16))}else for(var M=0;M<F.length;M++){var z=F.charCodeAt(M),T=z>>8,A=z&255;if(T)q.push(T,A);else q.push(A)}return q}Z.toArray=X;function Q(F){if(F.length===1)return"0"+F;else return F}Z.zero2=Q;function K(F){var $="";for(var q=0;q<F.length;q++)$+=Q(F[q].toString(16));return $}Z.toHex=K,Z.encode=function(F,$){if($==="hex")return K(F);else return F}}),WU=$0((U)=>{var Z=U,X=jU(),Q=cU(),K=UV();Z.assert=Q,Z.toArray=K.toArray,Z.zero2=K.zero2,Z.toHex=K.toHex,Z.encode=K.encode;function F(T,A,L){var E=Array(Math.max(T.bitLength(),L)+1),S;for(S=0;S<E.length;S+=1)E[S]=0;var j=1<<A+1,k=T.clone();for(S=0;S<E.length;S++){var B,v=k.andln(j-1);if(k.isOdd()){if(v>(j>>1)-1)B=(j>>1)-v;else B=v;k.isubn(B)}else B=0;E[S]=B,k.iushrn(1)}return E}Z.getNAF=F;function $(T,A){var L=[[],[]];T=T.clone(),A=A.clone();var E=0,S=0,j;while(T.cmpn(-E)>0||A.cmpn(-S)>0){var k=T.andln(3)+E&3,B=A.andln(3)+S&3;if(k===3)k=-1;if(B===3)B=-1;var v;if((k&1)===0)v=0;else if(j=T.andln(7)+E&7,(j===3||j===5)&&B===2)v=-k;else v=k;L[0].push(v);var x;if((B&1)===0)x=0;else if(j=A.andln(7)+S&7,(j===3||j===5)&&k===2)x=-B;else x=B;if(L[1].push(x),2*E===v+1)E=1-E;if(2*S===x+1)S=1-S;T.iushrn(1),A.iushrn(1)}return L}Z.getJSF=$;function q(T,A,L){var E="_"+A;T.prototype[A]=function(){return this[E]!==void 0?this[E]:this[E]=L.call(this)}}Z.cachedProperty=q;function M(T){return typeof T==="string"?Z.toArray(T,"hex"):T}Z.parseBytes=M;function z(T){return new X(T,"hex","le")}Z.intFromLE=z}),ZV=$0((U,Z)=>{var X;Z.exports=function(F){if(!X)X=new Q(null);return X.generate(F)};function Q(F){this.rand=F}if(Z.exports.Rand=Q,Q.prototype.generate=function(F){return this._rand(F)},Q.prototype._rand=function(F){if(this.rand.getBytes)return this.rand.getBytes(F);var $=new Uint8Array(F);for(var q=0;q<$.length;q++)$[q]=this.rand.getByte();return $},typeof self==="object"){if(self.crypto&&self.crypto.getRandomValues)Q.prototype._rand=function(F){var $=new Uint8Array(F);return self.crypto.getRandomValues($),$};else if(self.msCrypto&&self.msCrypto.getRandomValues)Q.prototype._rand=function(F){var $=new Uint8Array(F);return self.msCrypto.getRandomValues($),$};else if(typeof window==="object")Q.prototype._rand=function(){throw Error("Not implemented yet")}}else try{if(K=(UU(),m0(e1)),typeof K.randomBytes!=="function")throw Error("Not supported");Q.prototype._rand=function(F){return K.randomBytes(F)}}catch(F){}var K}),xX=$0((U,Z)=>{var X=jU(),Q=WU(),K=Q.getNAF,F=Q.getJSF,$=Q.assert;function q(z,T){this.type=z,this.p=new X(T.p,16),this.red=T.prime?X.red(T.prime):X.mont(this.p),this.zero=new X(0).toRed(this.red),this.one=new X(1).toRed(this.red),this.two=new X(2).toRed(this.red),this.n=T.n&&new X(T.n,16),this.g=T.g&&this.pointFromJSON(T.g,T.gRed),this._wnafT1=[,,,,],this._wnafT2=[,,,,],this._wnafT3=[,,,,],this._wnafT4=[,,,,],this._bitLength=this.n?this.n.bitLength():0;var A=this.n&&this.p.div(this.n);if(!A||A.cmpn(100)>0)this.redN=null;else this._maxwellTrick=!0,this.redN=this.n.toRed(this.red)}Z.exports=q,q.prototype.point=function(){throw Error("Not implemented")},q.prototype.validate=function(){throw Error("Not implemented")},q.prototype._fixedNafMul=function(z,T){$(z.precomputed);var A=z._getDoubles(),L=K(T,1,this._bitLength),E=(1<<A.step+1)-(A.step%2===0?2:1);E/=3;var S=[],j,k;for(j=0;j<L.length;j+=A.step){k=0;for(var B=j+A.step-1;B>=j;B--)k=(k<<1)+L[B];S.push(k)}var v=this.jpoint(null,null,null),x=this.jpoint(null,null,null);for(var N=E;N>0;N--){for(j=0;j<S.length;j++)if(k=S[j],k===N)x=x.mixedAdd(A.points[j]);else if(k===-N)x=x.mixedAdd(A.points[j].neg());v=v.add(x)}return v.toP()},q.prototype._wnafMul=function(z,T){var A=4,L=z._getNAFPoints(A);A=L.wnd;var E=L.points,S=K(T,A,this._bitLength),j=this.jpoint(null,null,null);for(var k=S.length-1;k>=0;k--){for(var B=0;k>=0&&S[k]===0;k--)B++;if(k>=0)B++;if(j=j.dblp(B),k<0)break;var v=S[k];if($(v!==0),z.type==="affine")if(v>0)j=j.mixedAdd(E[v-1>>1]);else j=j.mixedAdd(E[-v-1>>1].neg());else if(v>0)j=j.add(E[v-1>>1]);else j=j.add(E[-v-1>>1].neg())}return z.type==="affine"?j.toP():j},q.prototype._wnafMulAdd=function(z,T,A,L,E){var S=this._wnafT1,j=this._wnafT2,k=this._wnafT3,B=0,v,x,N;for(v=0;v<L;v++){N=T[v];var w=N._getNAFPoints(z);S[v]=w.wnd,j[v]=w.points}for(v=L-1;v>=1;v-=2){var u=v-1,Z0=v;if(S[u]!==1||S[Z0]!==1){k[u]=K(A[u],S[u],this._bitLength),k[Z0]=K(A[Z0],S[Z0],this._bitLength),B=Math.max(k[u].length,B),B=Math.max(k[Z0].length,B);continue}var V0=[T[u],null,null,T[Z0]];if(T[u].y.cmp(T[Z0].y)===0)V0[1]=T[u].add(T[Z0]),V0[2]=T[u].toJ().mixedAdd(T[Z0].neg());else if(T[u].y.cmp(T[Z0].y.redNeg())===0)V0[1]=T[u].toJ().mixedAdd(T[Z0]),V0[2]=T[u].add(T[Z0].neg());else V0[1]=T[u].toJ().mixedAdd(T[Z0]),V0[2]=T[u].toJ().mixedAdd(T[Z0].neg());var Y0=[-3,-1,-5,-7,0,7,5,1,3],b=F(A[u],A[Z0]);B=Math.max(b[0].length,B),k[u]=Array(B),k[Z0]=Array(B);for(x=0;x<B;x++){var i=b[0][x]|0,Y=b[1][x]|0;k[u][x]=Y0[(i+1)*3+(Y+1)],k[Z0][x]=0,j[u]=V0}}var V=this.jpoint(null,null,null),I=this._wnafT4;for(v=B;v>=0;v--){var G=0;while(v>=0){var W=!0;for(x=0;x<L;x++)if(I[x]=k[x][v]|0,I[x]!==0)W=!1;if(!W)break;G++,v--}if(v>=0)G++;if(V=V.dblp(G),v<0)break;for(x=0;x<L;x++){var C=I[x];if(C===0)continue;else if(C>0)N=j[x][C-1>>1];else if(C<0)N=j[x][-C-1>>1].neg();if(N.type==="affine")V=V.mixedAdd(N);else V=V.add(N)}}for(v=0;v<L;v++)j[v]=null;if(E)return V;else return V.toP()};function M(z,T){this.curve=z,this.type=T,this.precomputed=null}q.BasePoint=M,M.prototype.eq=function(){throw Error("Not implemented")},M.prototype.validate=function(){return this.curve.validate(this)},q.prototype.decodePoint=function(z,T){z=Q.toArray(z,T);var A=this.p.byteLength();if((z[0]===4||z[0]===6||z[0]===7)&&z.length-1===2*A){if(z[0]===6)$(z[z.length-1]%2===0);else if(z[0]===7)$(z[z.length-1]%2===1);var L=this.point(z.slice(1,1+A),z.slice(1+A,1+2*A));return L}else if((z[0]===2||z[0]===3)&&z.length-1===A)return this.pointFromX(z.slice(1,1+A),z[0]===3);throw Error("Unknown point format")},M.prototype.encodeCompressed=function(z){return this.encode(z,!0)},M.prototype._encode=function(z){var T=this.curve.p.byteLength(),A=this.getX().toArray("be",T);if(z)return[this.getY().isEven()?2:3].concat(A);return[4].concat(A,this.getY().toArray("be",T))},M.prototype.encode=function(z,T){return Q.encode(this._encode(T),z)},M.prototype.precompute=function(z){if(this.precomputed)return this;var T={doubles:null,naf:null,beta:null};return T.naf=this._getNAFPoints(8),T.doubles=this._getDoubles(4,z),T.beta=this._getBeta(),this.precomputed=T,this},M.prototype._hasDoubles=function(z){if(!this.precomputed)return!1;var T=this.precomputed.doubles;if(!T)return!1;return T.points.length>=Math.ceil((z.bitLength()+1)/T.step)},M.prototype._getDoubles=function(z,T){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;var A=[this],L=this;for(var E=0;E<T;E+=z){for(var S=0;S<z;S++)L=L.dbl();A.push(L)}return{step:z,points:A}},M.prototype._getNAFPoints=function(z){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;var T=[this],A=(1<<z)-1,L=A===1?null:this.dbl();for(var E=1;E<A;E++)T[E]=T[E-1].add(L);return{wnd:z,points:T}},M.prototype._getBeta=function(){return null},M.prototype.dblp=function(z){var T=this;for(var A=0;A<z;A++)T=T.dbl();return T}}),AF=$0((U,Z)=>{if(typeof Object.create==="function")Z.exports=function(X,Q){if(Q)X.super_=Q,X.prototype=Object.create(Q.prototype,{constructor:{value:X,enumerable:!1,writable:!0,configurable:!0}})};else Z.exports=function(X,Q){if(Q){X.super_=Q;var K=function(){};K.prototype=Q.prototype,X.prototype=new K,X.prototype.constructor=X}}}),YU=$0((U,Z)=>{try{if(X=(AG(),m0(CG)),typeof X.inherits!=="function")throw"";Z.exports=X.inherits}catch(Q){Z.exports=AF()}var X}),zF=$0((U,Z)=>{var X=WU(),Q=jU(),K=YU(),F=xX(),$=X.assert;function q(T){F.call(this,"short",T),this.a=new Q(T.a,16).toRed(this.red),this.b=new Q(T.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(T),this._endoWnafT1=[,,,,],this._endoWnafT2=[,,,,]}K(q,F),Z.exports=q,q.prototype._getEndomorphism=function(T){if(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)return;var A,L;if(T.beta)A=new Q(T.beta,16).toRed(this.red);else{var E=this._getEndoRoots(this.p);A=E[0].cmp(E[1])<0?E[0]:E[1],A=A.toRed(this.red)}if(T.lambda)L=new Q(T.lambda,16);else{var S=this._getEndoRoots(this.n);if(this.g.mul(S[0]).x.cmp(this.g.x.redMul(A))===0)L=S[0];else L=S[1],$(this.g.mul(L).x.cmp(this.g.x.redMul(A))===0)}var j;if(T.basis)j=T.basis.map(function(k){return{a:new Q(k.a,16),b:new Q(k.b,16)}});else j=this._getEndoBasis(L);return{beta:A,lambda:L,basis:j}},q.prototype._getEndoRoots=function(T){var A=T===this.p?this.red:Q.mont(T),L=new Q(2).toRed(A).redInvm(),E=L.redNeg(),S=new Q(3).toRed(A).redNeg().redSqrt().redMul(L),j=E.redAdd(S).fromRed(),k=E.redSub(S).fromRed();return[j,k]},q.prototype._getEndoBasis=function(T){var A=this.n.ushrn(Math.floor(this.n.bitLength()/2)),L=T,E=this.n.clone(),S=new Q(1),j=new Q(0),k=new Q(0),B=new Q(1),v,x,N,w,u,Z0,V0,Y0=0,b,i;while(L.cmpn(0)!==0){var Y=E.div(L);b=E.sub(Y.mul(L)),i=k.sub(Y.mul(S));var V=B.sub(Y.mul(j));if(!N&&b.cmp(A)<0)v=V0.neg(),x=S,N=b.neg(),w=i;else if(N&&++Y0===2)break;V0=b,E=L,L=b,k=S,S=i,B=j,j=V}u=b.neg(),Z0=i;var I=N.sqr().add(w.sqr()),G=u.sqr().add(Z0.sqr());if(G.cmp(I)>=0)u=v,Z0=x;if(N.negative)N=N.neg(),w=w.neg();if(u.negative)u=u.neg(),Z0=Z0.neg();return[{a:N,b:w},{a:u,b:Z0}]},q.prototype._endoSplit=function(T){var A=this.endo.basis,L=A[0],E=A[1],S=E.b.mul(T).divRound(this.n),j=L.b.neg().mul(T).divRound(this.n),k=S.mul(L.a),B=j.mul(E.a),v=S.mul(L.b),x=j.mul(E.b),N=T.sub(k).sub(B),w=v.add(x).neg();return{k1:N,k2:w}},q.prototype.pointFromX=function(T,A){if(T=new Q(T,16),!T.red)T=T.toRed(this.red);var L=T.redSqr().redMul(T).redIAdd(T.redMul(this.a)).redIAdd(this.b),E=L.redSqrt();if(E.redSqr().redSub(L).cmp(this.zero)!==0)throw Error("invalid point");var S=E.fromRed().isOdd();if(A&&!S||!A&&S)E=E.redNeg();return this.point(T,E)},q.prototype.validate=function(T){if(T.inf)return!0;var{x:A,y:L}=T,E=this.a.redMul(A),S=A.redSqr().redMul(A).redIAdd(E).redIAdd(this.b);return L.redSqr().redISub(S).cmpn(0)===0},q.prototype._endoWnafMulAdd=function(T,A,L){var E=this._endoWnafT1,S=this._endoWnafT2;for(var j=0;j<T.length;j++){var k=this._endoSplit(A[j]),B=T[j],v=B._getBeta();if(k.k1.negative)k.k1.ineg(),B=B.neg(!0);if(k.k2.negative)k.k2.ineg(),v=v.neg(!0);E[j*2]=B,E[j*2+1]=v,S[j*2]=k.k1,S[j*2+1]=k.k2}var x=this._wnafMulAdd(1,E,S,j*2,L);for(var N=0;N<j*2;N++)E[N]=null,S[N]=null;return x};function M(T,A,L,E){if(F.BasePoint.call(this,T,"affine"),A===null&&L===null)this.x=null,this.y=null,this.inf=!0;else{if(this.x=new Q(A,16),this.y=new Q(L,16),E)this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red);if(!this.x.red)this.x=this.x.toRed(this.curve.red);if(!this.y.red)this.y=this.y.toRed(this.curve.red);this.inf=!1}}K(M,F.BasePoint),q.prototype.point=function(T,A,L){return new M(this,T,A,L)},q.prototype.pointFromJSON=function(T,A){return M.fromJSON(this,T,A)},M.prototype._getBeta=function(){if(!this.curve.endo)return;var T=this.precomputed;if(T&&T.beta)return T.beta;var A=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(T){var L=this.curve,E=function(S){return L.point(S.x.redMul(L.endo.beta),S.y)};T.beta=A,A.precomputed={beta:null,naf:T.naf&&{wnd:T.naf.wnd,points:T.naf.points.map(E)},doubles:T.doubles&&{step:T.doubles.step,points:T.doubles.points.map(E)}}}return A},M.prototype.toJSON=function(){if(!this.precomputed)return[this.x,this.y];return[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]},M.fromJSON=function(T,A,L){if(typeof A==="string")A=JSON.parse(A);var E=T.point(A[0],A[1],L);if(!A[2])return E;function S(k){return T.point(k[0],k[1],L)}var j=A[2];return E.precomputed={beta:null,doubles:j.doubles&&{step:j.doubles.step,points:[E].concat(j.doubles.points.map(S))},naf:j.naf&&{wnd:j.naf.wnd,points:[E].concat(j.naf.points.map(S))}},E},M.prototype.inspect=function(){if(this.isInfinity())return"<EC Point Infinity>";return"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},M.prototype.isInfinity=function(){return this.inf},M.prototype.add=function(T){if(this.inf)return T;if(T.inf)return this;if(this.eq(T))return this.dbl();if(this.neg().eq(T))return this.curve.point(null,null);if(this.x.cmp(T.x)===0)return this.curve.point(null,null);var A=this.y.redSub(T.y);if(A.cmpn(0)!==0)A=A.redMul(this.x.redSub(T.x).redInvm());var L=A.redSqr().redISub(this.x).redISub(T.x),E=A.redMul(this.x.redSub(L)).redISub(this.y);return this.curve.point(L,E)},M.prototype.dbl=function(){if(this.inf)return this;var T=this.y.redAdd(this.y);if(T.cmpn(0)===0)return this.curve.point(null,null);var A=this.curve.a,L=this.x.redSqr(),E=T.redInvm(),S=L.redAdd(L).redIAdd(L).redIAdd(A).redMul(E),j=S.redSqr().redISub(this.x.redAdd(this.x)),k=S.redMul(this.x.redSub(j)).redISub(this.y);return this.curve.point(j,k)},M.prototype.getX=function(){return this.x.fromRed()},M.prototype.getY=function(){return this.y.fromRed()},M.prototype.mul=function(T){if(T=new Q(T,16),this.isInfinity())return this;else if(this._hasDoubles(T))return this.curve._fixedNafMul(this,T);else if(this.curve.endo)return this.curve._endoWnafMulAdd([this],[T]);else return this.curve._wnafMul(this,T)},M.prototype.mulAdd=function(T,A,L){var E=[this,A],S=[T,L];if(this.curve.endo)return this.curve._endoWnafMulAdd(E,S);else return this.curve._wnafMulAdd(1,E,S,2)},M.prototype.jmulAdd=function(T,A,L){var E=[this,A],S=[T,L];if(this.curve.endo)return this.curve._endoWnafMulAdd(E,S,!0);else return this.curve._wnafMulAdd(1,E,S,2,!0)},M.prototype.eq=function(T){return this===T||this.inf===T.inf&&(this.inf||this.x.cmp(T.x)===0&&this.y.cmp(T.y)===0)},M.prototype.neg=function(T){if(this.inf)return this;var A=this.curve.point(this.x,this.y.redNeg());if(T&&this.precomputed){var L=this.precomputed,E=function(S){return S.neg()};A.precomputed={naf:L.naf&&{wnd:L.naf.wnd,points:L.naf.points.map(E)},doubles:L.doubles&&{step:L.doubles.step,points:L.doubles.points.map(E)}}}return A},M.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var T=this.curve.jpoint(this.x,this.y,this.curve.one);return T};function z(T,A,L,E){if(F.BasePoint.call(this,T,"jacobian"),A===null&&L===null&&E===null)this.x=this.curve.one,this.y=this.curve.one,this.z=new Q(0);else this.x=new Q(A,16),this.y=new Q(L,16),this.z=new Q(E,16);if(!this.x.red)this.x=this.x.toRed(this.curve.red);if(!this.y.red)this.y=this.y.toRed(this.curve.red);if(!this.z.red)this.z=this.z.toRed(this.curve.red);this.zOne=this.z===this.curve.one}K(z,F.BasePoint),q.prototype.jpoint=function(T,A,L){return new z(this,T,A,L)},z.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var T=this.z.redInvm(),A=T.redSqr(),L=this.x.redMul(A),E=this.y.redMul(A).redMul(T);return this.curve.point(L,E)},z.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},z.prototype.add=function(T){if(this.isInfinity())return T;if(T.isInfinity())return this;var A=T.z.redSqr(),L=this.z.redSqr(),E=this.x.redMul(A),S=T.x.redMul(L),j=this.y.redMul(A.redMul(T.z)),k=T.y.redMul(L.redMul(this.z)),B=E.redSub(S),v=j.redSub(k);if(B.cmpn(0)===0)if(v.cmpn(0)!==0)return this.curve.jpoint(null,null,null);else return this.dbl();var x=B.redSqr(),N=x.redMul(B),w=E.redMul(x),u=v.redSqr().redIAdd(N).redISub(w).redISub(w),Z0=v.redMul(w.redISub(u)).redISub(j.redMul(N)),V0=this.z.redMul(T.z).redMul(B);return this.curve.jpoint(u,Z0,V0)},z.prototype.mixedAdd=function(T){if(this.isInfinity())return T.toJ();if(T.isInfinity())return this;var A=this.z.redSqr(),L=this.x,E=T.x.redMul(A),S=this.y,j=T.y.redMul(A).redMul(this.z),k=L.redSub(E),B=S.redSub(j);if(k.cmpn(0)===0)if(B.cmpn(0)!==0)return this.curve.jpoint(null,null,null);else return this.dbl();var v=k.redSqr(),x=v.redMul(k),N=L.redMul(v),w=B.redSqr().redIAdd(x).redISub(N).redISub(N),u=B.redMul(N.redISub(w)).redISub(S.redMul(x)),Z0=this.z.redMul(k);return this.curve.jpoint(w,u,Z0)},z.prototype.dblp=function(T){if(T===0)return this;if(this.isInfinity())return this;if(!T)return this.dbl();var A;if(this.curve.zeroA||this.curve.threeA){var L=this;for(A=0;A<T;A++)L=L.dbl();return L}var E=this.curve.a,S=this.curve.tinv,j=this.x,k=this.y,B=this.z,v=B.redSqr().redSqr(),x=k.redAdd(k);for(A=0;A<T;A++){var N=j.redSqr(),w=x.redSqr(),u=w.redSqr(),Z0=N.redAdd(N).redIAdd(N).redIAdd(E.redMul(v)),V0=j.redMul(w),Y0=Z0.redSqr().redISub(V0.redAdd(V0)),b=V0.redISub(Y0),i=Z0.redMul(b);i=i.redIAdd(i).redISub(u);var Y=x.redMul(B);if(A+1<T)v=v.redMul(u);j=Y0,B=Y,x=i}return this.curve.jpoint(j,x.redMul(S),B)},z.prototype.dbl=function(){if(this.isInfinity())return this;if(this.curve.zeroA)return this._zeroDbl();else if(this.curve.threeA)return this._threeDbl();else return this._dbl()},z.prototype._zeroDbl=function(){var T,A,L;if(this.zOne){var E=this.x.redSqr(),S=this.y.redSqr(),j=S.redSqr(),k=this.x.redAdd(S).redSqr().redISub(E).redISub(j);k=k.redIAdd(k);var B=E.redAdd(E).redIAdd(E),v=B.redSqr().redISub(k).redISub(k),x=j.redIAdd(j);x=x.redIAdd(x),x=x.redIAdd(x),T=v,A=B.redMul(k.redISub(v)).redISub(x),L=this.y.redAdd(this.y)}else{var N=this.x.redSqr(),w=this.y.redSqr(),u=w.redSqr(),Z0=this.x.redAdd(w).redSqr().redISub(N).redISub(u);Z0=Z0.redIAdd(Z0);var V0=N.redAdd(N).redIAdd(N),Y0=V0.redSqr(),b=u.redIAdd(u);b=b.redIAdd(b),b=b.redIAdd(b),T=Y0.redISub(Z0).redISub(Z0),A=V0.redMul(Z0.redISub(T)).redISub(b),L=this.y.redMul(this.z),L=L.redIAdd(L)}return this.curve.jpoint(T,A,L)},z.prototype._threeDbl=function(){var T,A,L;if(this.zOne){var E=this.x.redSqr(),S=this.y.redSqr(),j=S.redSqr(),k=this.x.redAdd(S).redSqr().redISub(E).redISub(j);k=k.redIAdd(k);var B=E.redAdd(E).redIAdd(E).redIAdd(this.curve.a),v=B.redSqr().redISub(k).redISub(k);T=v;var x=j.redIAdd(j);x=x.redIAdd(x),x=x.redIAdd(x),A=B.redMul(k.redISub(v)).redISub(x),L=this.y.redAdd(this.y)}else{var N=this.z.redSqr(),w=this.y.redSqr(),u=this.x.redMul(w),Z0=this.x.redSub(N).redMul(this.x.redAdd(N));Z0=Z0.redAdd(Z0).redIAdd(Z0);var V0=u.redIAdd(u);V0=V0.redIAdd(V0);var Y0=V0.redAdd(V0);T=Z0.redSqr().redISub(Y0),L=this.y.redAdd(this.z).redSqr().redISub(w).redISub(N);var b=w.redSqr();b=b.redIAdd(b),b=b.redIAdd(b),b=b.redIAdd(b),A=Z0.redMul(V0.redISub(T)).redISub(b)}return this.curve.jpoint(T,A,L)},z.prototype._dbl=function(){var T=this.curve.a,A=this.x,L=this.y,E=this.z,S=E.redSqr().redSqr(),j=A.redSqr(),k=L.redSqr(),B=j.redAdd(j).redIAdd(j).redIAdd(T.redMul(S)),v=A.redAdd(A);v=v.redIAdd(v);var x=v.redMul(k),N=B.redSqr().redISub(x.redAdd(x)),w=x.redISub(N),u=k.redSqr();u=u.redIAdd(u),u=u.redIAdd(u),u=u.redIAdd(u);var Z0=B.redMul(w).redISub(u),V0=L.redAdd(L).redMul(E);return this.curve.jpoint(N,Z0,V0)},z.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var T=this.x.redSqr(),A=this.y.redSqr(),L=this.z.redSqr(),E=A.redSqr(),S=T.redAdd(T).redIAdd(T),j=S.redSqr(),k=this.x.redAdd(A).redSqr().redISub(T).redISub(E);k=k.redIAdd(k),k=k.redAdd(k).redIAdd(k),k=k.redISub(j);var B=k.redSqr(),v=E.redIAdd(E);v=v.redIAdd(v),v=v.redIAdd(v),v=v.redIAdd(v);var x=S.redIAdd(k).redSqr().redISub(j).redISub(B).redISub(v),N=A.redMul(x);N=N.redIAdd(N),N=N.redIAdd(N);var w=this.x.redMul(B).redISub(N);w=w.redIAdd(w),w=w.redIAdd(w);var u=this.y.redMul(x.redMul(v.redISub(x)).redISub(k.redMul(B)));u=u.redIAdd(u),u=u.redIAdd(u),u=u.redIAdd(u);var Z0=this.z.redAdd(k).redSqr().redISub(L).redISub(B);return this.curve.jpoint(w,u,Z0)},z.prototype.mul=function(T,A){return T=new Q(T,A),this.curve._wnafMul(this,T)},z.prototype.eq=function(T){if(T.type==="affine")return this.eq(T.toJ());if(this===T)return!0;var A=this.z.redSqr(),L=T.z.redSqr();if(this.x.redMul(L).redISub(T.x.redMul(A)).cmpn(0)!==0)return!1;var E=A.redMul(this.z),S=L.redMul(T.z);return this.y.redMul(S).redISub(T.y.redMul(E)).cmpn(0)===0},z.prototype.eqXToP=function(T){var A=this.z.redSqr(),L=T.toRed(this.curve.red).redMul(A);if(this.x.cmp(L)===0)return!0;var E=T.clone(),S=this.curve.redN.redMul(A);for(;;){if(E.iadd(this.curve.n),E.cmp(this.curve.p)>=0)return!1;if(L.redIAdd(S),this.x.cmp(L)===0)return!0}},z.prototype.inspect=function(){if(this.isInfinity())return"<EC JPoint Infinity>";return"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},z.prototype.isInfinity=function(){return this.z.cmpn(0)===0}}),DF=$0((U,Z)=>{var X=jU(),Q=YU(),K=xX(),F=WU();function $(M){K.call(this,"mont",M),this.a=new X(M.a,16).toRed(this.red),this.b=new X(M.b,16).toRed(this.red),this.i4=new X(4).toRed(this.red).redInvm(),this.two=new X(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}Q($,K),Z.exports=$,$.prototype.validate=function(M){var z=M.normalize().x,T=z.redSqr(),A=T.redMul(z).redAdd(T.redMul(this.a)).redAdd(z),L=A.redSqrt();return L.redSqr().cmp(A)===0};function q(M,z,T){if(K.BasePoint.call(this,M,"projective"),z===null&&T===null)this.x=this.curve.one,this.z=this.curve.zero;else{if(this.x=new X(z,16),this.z=new X(T,16),!this.x.red)this.x=this.x.toRed(this.curve.red);if(!this.z.red)this.z=this.z.toRed(this.curve.red)}}Q(q,K.BasePoint),$.prototype.decodePoint=function(M,z){return this.point(F.toArray(M,z),1)},$.prototype.point=function(M,z){return new q(this,M,z)},$.prototype.pointFromJSON=function(M){return q.fromJSON(this,M)},q.prototype.precompute=function(){},q.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},q.fromJSON=function(M,z){return new q(M,z[0],z[1]||M.one)},q.prototype.inspect=function(){if(this.isInfinity())return"<EC Point Infinity>";return"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},q.prototype.isInfinity=function(){return this.z.cmpn(0)===0},q.prototype.dbl=function(){var M=this.x.redAdd(this.z),z=M.redSqr(),T=this.x.redSub(this.z),A=T.redSqr(),L=z.redSub(A),E=z.redMul(A),S=L.redMul(A.redAdd(this.curve.a24.redMul(L)));return this.curve.point(E,S)},q.prototype.add=function(){throw Error("Not supported on Montgomery curve")},q.prototype.diffAdd=function(M,z){var T=this.x.redAdd(this.z),A=this.x.redSub(this.z),L=M.x.redAdd(M.z),E=M.x.redSub(M.z),S=E.redMul(T),j=L.redMul(A),k=z.z.redMul(S.redAdd(j).redSqr()),B=z.x.redMul(S.redISub(j).redSqr());return this.curve.point(k,B)},q.prototype.mul=function(M){var z=M.clone(),T=this,A=this.curve.point(null,null),L=this;for(var E=[];z.cmpn(0)!==0;z.iushrn(1))E.push(z.andln(1));for(var S=E.length-1;S>=0;S--)if(E[S]===0)T=T.diffAdd(A,L),A=A.dbl();else A=T.diffAdd(A,L),T=T.dbl();return A},q.prototype.mulAdd=function(){throw Error("Not supported on Montgomery curve")},q.prototype.jumlAdd=function(){throw Error("Not supported on Montgomery curve")},q.prototype.eq=function(M){return this.getX().cmp(M.getX())===0},q.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},q.prototype.getX=function(){return this.normalize(),this.x.fromRed()}}),qF=$0((U,Z)=>{var X=WU(),Q=jU(),K=YU(),F=xX(),$=X.assert;function q(z){this.twisted=(z.a|0)!==1,this.mOneA=this.twisted&&(z.a|0)===-1,this.extended=this.mOneA,F.call(this,"edwards",z),this.a=new Q(z.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new Q(z.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new Q(z.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),$(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(z.c|0)===1}K(q,F),Z.exports=q,q.prototype._mulA=function(z){if(this.mOneA)return z.redNeg();else return this.a.redMul(z)},q.prototype._mulC=function(z){if(this.oneC)return z;else return this.c.redMul(z)},q.prototype.jpoint=function(z,T,A,L){return this.point(z,T,A,L)},q.prototype.pointFromX=function(z,T){if(z=new Q(z,16),!z.red)z=z.toRed(this.red);var A=z.redSqr(),L=this.c2.redSub(this.a.redMul(A)),E=this.one.redSub(this.c2.redMul(this.d).redMul(A)),S=L.redMul(E.redInvm()),j=S.redSqrt();if(j.redSqr().redSub(S).cmp(this.zero)!==0)throw Error("invalid point");var k=j.fromRed().isOdd();if(T&&!k||!T&&k)j=j.redNeg();return this.point(z,j)},q.prototype.pointFromY=function(z,T){if(z=new Q(z,16),!z.red)z=z.toRed(this.red);var A=z.redSqr(),L=A.redSub(this.c2),E=A.redMul(this.d).redMul(this.c2).redSub(this.a),S=L.redMul(E.redInvm());if(S.cmp(this.zero)===0)if(T)throw Error("invalid point");else return this.point(this.zero,z);var j=S.redSqrt();if(j.redSqr().redSub(S).cmp(this.zero)!==0)throw Error("invalid point");if(j.fromRed().isOdd()!==T)j=j.redNeg();return this.point(j,z)},q.prototype.validate=function(z){if(z.isInfinity())return!0;z.normalize();var T=z.x.redSqr(),A=z.y.redSqr(),L=T.redMul(this.a).redAdd(A),E=this.c2.redMul(this.one.redAdd(this.d.redMul(T).redMul(A)));return L.cmp(E)===0};function M(z,T,A,L,E){if(F.BasePoint.call(this,z,"projective"),T===null&&A===null&&L===null)this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0;else{if(this.x=new Q(T,16),this.y=new Q(A,16),this.z=L?new Q(L,16):this.curve.one,this.t=E&&new Q(E,16),!this.x.red)this.x=this.x.toRed(this.curve.red);if(!this.y.red)this.y=this.y.toRed(this.curve.red);if(!this.z.red)this.z=this.z.toRed(this.curve.red);if(this.t&&!this.t.red)this.t=this.t.toRed(this.curve.red);if(this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t){if(this.t=this.x.redMul(this.y),!this.zOne)this.t=this.t.redMul(this.z.redInvm())}}}K(M,F.BasePoint),q.prototype.pointFromJSON=function(z){return M.fromJSON(this,z)},q.prototype.point=function(z,T,A,L){return new M(this,z,T,A,L)},M.fromJSON=function(z,T){return new M(z,T[0],T[1],T[2])},M.prototype.inspect=function(){if(this.isInfinity())return"<EC Point Infinity>";return"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},M.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},M.prototype._extDbl=function(){var z=this.x.redSqr(),T=this.y.redSqr(),A=this.z.redSqr();A=A.redIAdd(A);var L=this.curve._mulA(z),E=this.x.redAdd(this.y).redSqr().redISub(z).redISub(T),S=L.redAdd(T),j=S.redSub(A),k=L.redSub(T),B=E.redMul(j),v=S.redMul(k),x=E.redMul(k),N=j.redMul(S);return this.curve.point(B,v,N,x)},M.prototype._projDbl=function(){var z=this.x.redAdd(this.y).redSqr(),T=this.x.redSqr(),A=this.y.redSqr(),L,E,S,j,k,B;if(this.curve.twisted){j=this.curve._mulA(T);var v=j.redAdd(A);if(this.zOne)L=z.redSub(T).redSub(A).redMul(v.redSub(this.curve.two)),E=v.redMul(j.redSub(A)),S=v.redSqr().redSub(v).redSub(v);else k=this.z.redSqr(),B=v.redSub(k).redISub(k),L=z.redSub(T).redISub(A).redMul(B),E=v.redMul(j.redSub(A)),S=v.redMul(B)}else j=T.redAdd(A),k=this.curve._mulC(this.z).redSqr(),B=j.redSub(k).redSub(k),L=this.curve._mulC(z.redISub(j)).redMul(B),E=this.curve._mulC(j).redMul(T.redISub(A)),S=j.redMul(B);return this.curve.point(L,E,S)},M.prototype.dbl=function(){if(this.isInfinity())return this;if(this.curve.extended)return this._extDbl();else return this._projDbl()},M.prototype._extAdd=function(z){var T=this.y.redSub(this.x).redMul(z.y.redSub(z.x)),A=this.y.redAdd(this.x).redMul(z.y.redAdd(z.x)),L=this.t.redMul(this.curve.dd).redMul(z.t),E=this.z.redMul(z.z.redAdd(z.z)),S=A.redSub(T),j=E.redSub(L),k=E.redAdd(L),B=A.redAdd(T),v=S.redMul(j),x=k.redMul(B),N=S.redMul(B),w=j.redMul(k);return this.curve.point(v,x,w,N)},M.prototype._projAdd=function(z){var T=this.z.redMul(z.z),A=T.redSqr(),L=this.x.redMul(z.x),E=this.y.redMul(z.y),S=this.curve.d.redMul(L).redMul(E),j=A.redSub(S),k=A.redAdd(S),B=this.x.redAdd(this.y).redMul(z.x.redAdd(z.y)).redISub(L).redISub(E),v=T.redMul(j).redMul(B),x,N;if(this.curve.twisted)x=T.redMul(k).redMul(E.redSub(this.curve._mulA(L))),N=j.redMul(k);else x=T.redMul(k).redMul(E.redSub(L)),N=this.curve._mulC(j).redMul(k);return this.curve.point(v,x,N)},M.prototype.add=function(z){if(this.isInfinity())return z;if(z.isInfinity())return this;if(this.curve.extended)return this._extAdd(z);else return this._projAdd(z)},M.prototype.mul=function(z){if(this._hasDoubles(z))return this.curve._fixedNafMul(this,z);else return this.curve._wnafMul(this,z)},M.prototype.mulAdd=function(z,T,A){return this.curve._wnafMulAdd(1,[this,T],[z,A],2,!1)},M.prototype.jmulAdd=function(z,T,A){return this.curve._wnafMulAdd(1,[this,T],[z,A],2,!0)},M.prototype.normalize=function(){if(this.zOne)return this;var z=this.z.redInvm();if(this.x=this.x.redMul(z),this.y=this.y.redMul(z),this.t)this.t=this.t.redMul(z);return this.z=this.curve.one,this.zOne=!0,this},M.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},M.prototype.getX=function(){return this.normalize(),this.x.fromRed()},M.prototype.getY=function(){return this.normalize(),this.y.fromRed()},M.prototype.eq=function(z){return this===z||this.getX().cmp(z.getX())===0&&this.getY().cmp(z.getY())===0},M.prototype.eqXToP=function(z){var T=z.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(T)===0)return!0;var A=z.clone(),L=this.curve.redN.redMul(this.z);for(;;){if(A.iadd(this.curve.n),A.cmp(this.curve.p)>=0)return!1;if(T.redIAdd(L),this.x.cmp(T)===0)return!0}},M.prototype.toP=M.prototype.normalize,M.prototype.mixedAdd=M.prototype.add}),XV=$0((U)=>{var Z=U;Z.base=xX(),Z.short=zF(),Z.mont=DF(),Z.edwards=qF()}),DU=$0((U)=>{var Z=cU(),X=YU();U.inherits=X;function Q(V,I){if((V.charCodeAt(I)&64512)!==55296)return!1;if(I<0||I+1>=V.length)return!1;return(V.charCodeAt(I+1)&64512)===56320}function K(V,I){if(Array.isArray(V))return V.slice();if(!V)return[];var G=[];if(typeof V==="string"){if(!I){var W=0;for(var C=0;C<V.length;C++){var D=V.charCodeAt(C);if(D<128)G[W++]=D;else if(D<2048)G[W++]=D>>6|192,G[W++]=D&63|128;else if(Q(V,C))D=65536+((D&1023)<<10)+(V.charCodeAt(++C)&1023),G[W++]=D>>18|240,G[W++]=D>>12&63|128,G[W++]=D>>6&63|128,G[W++]=D&63|128;else G[W++]=D>>12|224,G[W++]=D>>6&63|128,G[W++]=D&63|128}}else if(I==="hex"){if(V=V.replace(/[^a-z0-9]+/ig,""),V.length%2!==0)V="0"+V;for(C=0;C<V.length;C+=2)G.push(parseInt(V[C]+V[C+1],16))}}else for(C=0;C<V.length;C++)G[C]=V[C]|0;return G}U.toArray=K;function F(V){var I="";for(var G=0;G<V.length;G++)I+=M(V[G].toString(16));return I}U.toHex=F;function $(V){var I=V>>>24|V>>>8&65280|V<<8&16711680|(V&255)<<24;return I>>>0}U.htonl=$;function q(V,I){var G="";for(var W=0;W<V.length;W++){var C=V[W];if(I==="little")C=$(C);G+=z(C.toString(16))}return G}U.toHex32=q;function M(V){if(V.length===1)return"0"+V;else return V}U.zero2=M;function z(V){if(V.length===7)return"0"+V;else if(V.length===6)return"00"+V;else if(V.length===5)return"000"+V;else if(V.length===4)return"0000"+V;else if(V.length===3)return"00000"+V;else if(V.length===2)return"000000"+V;else if(V.length===1)return"0000000"+V;else return V}U.zero8=z;function T(V,I,G,W){var C=G-I;Z(C%4===0);var D=Array(C/4);for(var H=0,J=I;H<D.length;H++,J+=4){var O;if(W==="big")O=V[J]<<24|V[J+1]<<16|V[J+2]<<8|V[J+3];else O=V[J+3]<<24|V[J+2]<<16|V[J+1]<<8|V[J];D[H]=O>>>0}return D}U.join32=T;function A(V,I){var G=Array(V.length*4);for(var W=0,C=0;W<V.length;W++,C+=4){var D=V[W];if(I==="big")G[C]=D>>>24,G[C+1]=D>>>16&255,G[C+2]=D>>>8&255,G[C+3]=D&255;else G[C+3]=D>>>24,G[C+2]=D>>>16&255,G[C+1]=D>>>8&255,G[C]=D&255}return G}U.split32=A;function L(V,I){return V>>>I|V<<32-I}U.rotr32=L;function E(V,I){return V<<I|V>>>32-I}U.rotl32=E;function S(V,I){return V+I>>>0}U.sum32=S;function j(V,I,G){return V+I+G>>>0}U.sum32_3=j;function k(V,I,G,W){return V+I+G+W>>>0}U.sum32_4=k;function B(V,I,G,W,C){return V+I+G+W+C>>>0}U.sum32_5=B;function v(V,I,G,W){var C=V[I],D=V[I+1],H=W+D>>>0,J=(H<W?1:0)+G+C;V[I]=J>>>0,V[I+1]=H}U.sum64=v;function x(V,I,G,W){var C=I+W>>>0,D=(C<I?1:0)+V+G;return D>>>0}U.sum64_hi=x;function N(V,I,G,W){var C=I+W;return C>>>0}U.sum64_lo=N;function w(V,I,G,W,C,D,H,J){var O=0,P=I;P=P+W>>>0,O+=P<I?1:0,P=P+D>>>0,O+=P<D?1:0,P=P+J>>>0,O+=P<J?1:0;var R=V+G+C+H+O;return R>>>0}U.sum64_4_hi=w;function u(V,I,G,W,C,D,H,J){var O=I+W+D+J;return O>>>0}U.sum64_4_lo=u;function Z0(V,I,G,W,C,D,H,J,O,P){var R=0,_=I;_=_+W>>>0,R+=_<I?1:0,_=_+D>>>0,R+=_<D?1:0,_=_+J>>>0,R+=_<J?1:0,_=_+P>>>0,R+=_<P?1:0;var f=V+G+C+H+O+R;return f>>>0}U.sum64_5_hi=Z0;function V0(V,I,G,W,C,D,H,J,O,P){var R=I+W+D+J+P;return R>>>0}U.sum64_5_lo=V0;function Y0(V,I,G){var W=I<<32-G|V>>>G;return W>>>0}U.rotr64_hi=Y0;function b(V,I,G){var W=V<<32-G|I>>>G;return W>>>0}U.rotr64_lo=b;function i(V,I,G){return V>>>G}U.shr64_hi=i;function Y(V,I,G){var W=V<<32-G|I>>>G;return W>>>0}U.shr64_lo=Y}),hZ=$0((U)=>{var Z=DU(),X=cU();function Q(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}U.BlockHash=Q,Q.prototype.update=function(K,F){if(K=Z.toArray(K,F),!this.pending)this.pending=K;else this.pending=this.pending.concat(K);if(this.pendingTotal+=K.length,this.pending.length>=this._delta8){K=this.pending;var $=K.length%this._delta8;if(this.pending=K.slice(K.length-$,K.length),this.pending.length===0)this.pending=null;K=Z.join32(K,0,K.length-$,this.endian);for(var q=0;q<K.length;q+=this._delta32)this._update(K,q,q+this._delta32)}return this},Q.prototype.digest=function(K){return this.update(this._pad()),X(this.pending===null),this._digest(K)},Q.prototype._pad=function(){var K=this.pendingTotal,F=this._delta8,$=F-(K+this.padLength)%F,q=Array($+this.padLength);q[0]=128;for(var M=1;M<$;M++)q[M]=0;if(K<<=3,this.endian==="big"){for(var z=8;z<this.padLength;z++)q[M++]=0;q[M++]=0,q[M++]=0,q[M++]=0,q[M++]=0,q[M++]=K>>>24&255,q[M++]=K>>>16&255,q[M++]=K>>>8&255,q[M++]=K&255}else{q[M++]=K&255,q[M++]=K>>>8&255,q[M++]=K>>>16&255,q[M++]=K>>>24&255,q[M++]=0,q[M++]=0,q[M++]=0,q[M++]=0;for(z=8;z<this.padLength;z++)q[M++]=0}return q}}),YV=$0((U)=>{var Z=DU(),X=Z.rotr32;function Q(A,L,E,S){if(A===0)return K(L,E,S);if(A===1||A===3)return $(L,E,S);if(A===2)return F(L,E,S)}U.ft_1=Q;function K(A,L,E){return A&L^~A&E}U.ch32=K;function F(A,L,E){return A&L^A&E^L&E}U.maj32=F;function $(A,L,E){return A^L^E}U.p32=$;function q(A){return X(A,2)^X(A,13)^X(A,22)}U.s0_256=q;function M(A){return X(A,6)^X(A,11)^X(A,25)}U.s1_256=M;function z(A){return X(A,7)^X(A,18)^A>>>3}U.g0_256=z;function T(A){return X(A,17)^X(A,19)^A>>>10}U.g1_256=T}),MF=$0((U,Z)=>{var X=DU(),Q=hZ(),K=YV(),F=X.rotl32,$=X.sum32,q=X.sum32_5,M=K.ft_1,z=Q.BlockHash,T=[1518500249,1859775393,2400959708,3395469782];function A(){if(!(this instanceof A))return new A;z.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=Array(80)}X.inherits(A,z),Z.exports=A,A.blockSize=512,A.outSize=160,A.hmacStrength=80,A.padLength=64,A.prototype._update=function(L,E){var S=this.W;for(var j=0;j<16;j++)S[j]=L[E+j];for(;j<S.length;j++)S[j]=F(S[j-3]^S[j-8]^S[j-14]^S[j-16],1);var k=this.h[0],B=this.h[1],v=this.h[2],x=this.h[3],N=this.h[4];for(j=0;j<S.length;j++){var w=~~(j/20),u=q(F(k,5),M(w,B,v,x),N,S[j],T[w]);N=x,x=v,v=F(B,30),B=k,k=u}this.h[0]=$(this.h[0],k),this.h[1]=$(this.h[1],B),this.h[2]=$(this.h[2],v),this.h[3]=$(this.h[3],x),this.h[4]=$(this.h[4],N)},A.prototype._digest=function(L){if(L==="hex")return X.toHex32(this.h,"big");else return X.split32(this.h,"big")}}),JV=$0((U,Z)=>{var X=DU(),Q=hZ(),K=YV(),F=cU(),$=X.sum32,q=X.sum32_4,M=X.sum32_5,z=K.ch32,T=K.maj32,A=K.s0_256,L=K.s1_256,E=K.g0_256,S=K.g1_256,j=Q.BlockHash,k=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function B(){if(!(this instanceof B))return new B;j.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=k,this.W=Array(64)}X.inherits(B,j),Z.exports=B,B.blockSize=512,B.outSize=256,B.hmacStrength=192,B.padLength=64,B.prototype._update=function(v,x){var N=this.W;for(var w=0;w<16;w++)N[w]=v[x+w];for(;w<N.length;w++)N[w]=q(S(N[w-2]),N[w-7],E(N[w-15]),N[w-16]);var u=this.h[0],Z0=this.h[1],V0=this.h[2],Y0=this.h[3],b=this.h[4],i=this.h[5],Y=this.h[6],V=this.h[7];F(this.k.length===N.length);for(w=0;w<N.length;w++){var I=M(V,L(b),z(b,i,Y),this.k[w],N[w]),G=$(A(u),T(u,Z0,V0));V=Y,Y=i,i=b,b=$(Y0,I),Y0=V0,V0=Z0,Z0=u,u=$(I,G)}this.h[0]=$(this.h[0],u),this.h[1]=$(this.h[1],Z0),this.h[2]=$(this.h[2],V0),this.h[3]=$(this.h[3],Y0),this.h[4]=$(this.h[4],b),this.h[5]=$(this.h[5],i),this.h[6]=$(this.h[6],Y),this.h[7]=$(this.h[7],V)},B.prototype._digest=function(v){if(v==="hex")return X.toHex32(this.h,"big");else return X.split32(this.h,"big")}}),LF=$0((U,Z)=>{var X=DU(),Q=JV();function K(){if(!(this instanceof K))return new K;Q.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}X.inherits(K,Q),Z.exports=K,K.blockSize=512,K.outSize=224,K.hmacStrength=192,K.padLength=64,K.prototype._digest=function(F){if(F==="hex")return X.toHex32(this.h.slice(0,7),"big");else return X.split32(this.h.slice(0,7),"big")}}),QV=$0((U,Z)=>{var X=DU(),Q=hZ(),K=cU(),F=X.rotr64_hi,$=X.rotr64_lo,q=X.shr64_hi,M=X.shr64_lo,z=X.sum64,T=X.sum64_hi,A=X.sum64_lo,L=X.sum64_4_hi,E=X.sum64_4_lo,S=X.sum64_5_hi,j=X.sum64_5_lo,k=Q.BlockHash,B=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function v(){if(!(this instanceof v))return new v;k.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=B,this.W=Array(160)}X.inherits(v,k),Z.exports=v,v.blockSize=1024,v.outSize=512,v.hmacStrength=192,v.padLength=128,v.prototype._prepareBlock=function(G,W){var C=this.W;for(var D=0;D<32;D++)C[D]=G[W+D];for(;D<C.length;D+=2){var H=V(C[D-4],C[D-3]),J=I(C[D-4],C[D-3]),O=C[D-14],P=C[D-13],R=i(C[D-30],C[D-29]),_=Y(C[D-30],C[D-29]),f=C[D-32],c=C[D-31];C[D]=L(H,J,O,P,R,_,f,c),C[D+1]=E(H,J,O,P,R,_,f,c)}},v.prototype._update=function(G,W){this._prepareBlock(G,W);var C=this.W,D=this.h[0],H=this.h[1],J=this.h[2],O=this.h[3],P=this.h[4],R=this.h[5],_=this.h[6],f=this.h[7],c=this.h[8],o=this.h[9],K0=this.h[10],a=this.h[11],l=this.h[12],Q0=this.h[13],n=this.h[14],s=this.h[15];K(this.k.length===C.length);for(var f0=0;f0<C.length;f0+=2){var y=n,h=s,G0=Y0(c,o),t=b(c,o),U0=x(c,o,K0,a,l,Q0),L0=N(c,o,K0,a,l,Q0),p=this.k[f0],m=this.k[f0+1],g0=C[f0],r=C[f0+1],J0=S(y,h,G0,t,U0,L0,p,m,g0,r),h0=j(y,h,G0,t,U0,L0,p,m,g0,r);y=Z0(D,H),h=V0(D,H),G0=w(D,H,J,O,P,R),t=u(D,H,J,O,P,R);var H0=T(y,h,G0,t),O0=A(y,h,G0,t);n=l,s=Q0,l=K0,Q0=a,K0=c,a=o,c=T(_,f,J0,h0),o=A(f,f,J0,h0),_=P,f=R,P=J,R=O,J=D,O=H,D=T(J0,h0,H0,O0),H=A(J0,h0,H0,O0)}z(this.h,0,D,H),z(this.h,2,J,O),z(this.h,4,P,R),z(this.h,6,_,f),z(this.h,8,c,o),z(this.h,10,K0,a),z(this.h,12,l,Q0),z(this.h,14,n,s)},v.prototype._digest=function(G){if(G==="hex")return X.toHex32(this.h,"big");else return X.split32(this.h,"big")};function x(G,W,C,D,H){var J=G&C^~G&H;if(J<0)J+=4294967296;return J}function N(G,W,C,D,H,J){var O=W&D^~W&J;if(O<0)O+=4294967296;return O}function w(G,W,C,D,H){var J=G&C^G&H^C&H;if(J<0)J+=4294967296;return J}function u(G,W,C,D,H,J){var O=W&D^W&J^D&J;if(O<0)O+=4294967296;return O}function Z0(G,W){var C=F(G,W,28),D=F(W,G,2),H=F(W,G,7),J=C^D^H;if(J<0)J+=4294967296;return J}function V0(G,W){var C=$(G,W,28),D=$(W,G,2),H=$(W,G,7),J=C^D^H;if(J<0)J+=4294967296;return J}function Y0(G,W){var C=F(G,W,14),D=F(G,W,18),H=F(W,G,9),J=C^D^H;if(J<0)J+=4294967296;return J}function b(G,W){var C=$(G,W,14),D=$(G,W,18),H=$(W,G,9),J=C^D^H;if(J<0)J+=4294967296;return J}function i(G,W){var C=F(G,W,1),D=F(G,W,8),H=q(G,W,7),J=C^D^H;if(J<0)J+=4294967296;return J}function Y(G,W){var C=$(G,W,1),D=$(G,W,8),H=M(G,W,7),J=C^D^H;if(J<0)J+=4294967296;return J}function V(G,W){var C=F(G,W,19),D=F(W,G,29),H=q(G,W,6),J=C^D^H;if(J<0)J+=4294967296;return J}function I(G,W){var C=$(G,W,19),D=$(W,G,29),H=M(G,W,6),J=C^D^H;if(J<0)J+=4294967296;return J}}),TF=$0((U,Z)=>{var X=DU(),Q=QV();function K(){if(!(this instanceof K))return new K;Q.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}X.inherits(K,Q),Z.exports=K,K.blockSize=1024,K.outSize=384,K.hmacStrength=192,K.padLength=128,K.prototype._digest=function(F){if(F==="hex")return X.toHex32(this.h.slice(0,12),"big");else return X.split32(this.h.slice(0,12),"big")}}),RF=$0((U)=>{U.sha1=MF(),U.sha224=LF(),U.sha256=JV(),U.sha384=TF(),U.sha512=QV()}),EF=$0((U)=>{var Z=DU(),X=hZ(),Q=Z.rotl32,K=Z.sum32,F=Z.sum32_3,$=Z.sum32_4,q=X.BlockHash;function M(){if(!(this instanceof M))return new M;q.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}Z.inherits(M,q),U.ripemd160=M,M.blockSize=512,M.outSize=160,M.hmacStrength=192,M.padLength=64,M.prototype._update=function(k,B){var v=this.h[0],x=this.h[1],N=this.h[2],w=this.h[3],u=this.h[4],Z0=v,V0=x,Y0=N,b=w,i=u;for(var Y=0;Y<80;Y++){var V=K(Q($(v,z(Y,x,N,w),k[L[Y]+B],T(Y)),S[Y]),u);v=u,u=w,w=Q(N,10),N=x,x=V,V=K(Q($(Z0,z(79-Y,V0,Y0,b),k[E[Y]+B],A(Y)),j[Y]),i),Z0=i,i=b,b=Q(Y0,10),Y0=V0,V0=V}V=F(this.h[1],N,b),this.h[1]=F(this.h[2],w,i),this.h[2]=F(this.h[3],u,Z0),this.h[3]=F(this.h[4],v,V0),this.h[4]=F(this.h[0],x,Y0),this.h[0]=V},M.prototype._digest=function(k){if(k==="hex")return Z.toHex32(this.h,"little");else return Z.split32(this.h,"little")};function z(k,B,v,x){if(k<=15)return B^v^x;else if(k<=31)return B&v|~B&x;else if(k<=47)return(B|~v)^x;else if(k<=63)return B&x|v&~x;else return B^(v|~x)}function T(k){if(k<=15)return 0;else if(k<=31)return 1518500249;else if(k<=47)return 1859775393;else if(k<=63)return 2400959708;else return 2840853838}function A(k){if(k<=15)return 1352829926;else if(k<=31)return 1548603684;else if(k<=47)return 1836072691;else if(k<=63)return 2053994217;else return 0}var L=[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],E=[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],S=[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],j=[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]}),SF=$0((U,Z)=>{var X=DU(),Q=cU();function K(F,$,q){if(!(this instanceof K))return new K(F,$,q);this.Hash=F,this.blockSize=F.blockSize/8,this.outSize=F.outSize/8,this.inner=null,this.outer=null,this._init(X.toArray($,q))}Z.exports=K,K.prototype._init=function(F){if(F.length>this.blockSize)F=new this.Hash().update(F).digest();Q(F.length<=this.blockSize);for(var $=F.length;$<this.blockSize;$++)F.push(0);for($=0;$<F.length;$++)F[$]^=54;this.inner=new this.Hash().update(F);for($=0;$<F.length;$++)F[$]^=106;this.outer=new this.Hash().update(F)},K.prototype.update=function(F,$){return this.inner.update(F,$),this},K.prototype.digest=function(F){return this.outer.update(this.inner.digest()),this.outer.digest(F)}}),ZJ=$0((U)=>{var Z=U;Z.utils=DU(),Z.common=hZ(),Z.sha=RF(),Z.ripemd=EF(),Z.hmac=SF(),Z.sha1=Z.sha.sha1,Z.sha256=Z.sha.sha256,Z.sha224=Z.sha.sha224,Z.sha384=Z.sha.sha384,Z.sha512=Z.sha.sha512,Z.ripemd160=Z.ripemd.ripemd160}),PF=$0((U,Z)=>{Z.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}}),XJ=$0((U)=>{var Z=U,X=ZJ(),Q=XV(),K=WU(),F=K.assert;function $(z){if(z.type==="short")this.curve=new Q.short(z);else if(z.type==="edwards")this.curve=new Q.edwards(z);else this.curve=new Q.mont(z);this.g=this.curve.g,this.n=this.curve.n,this.hash=z.hash,F(this.g.validate(),"Invalid curve"),F(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}Z.PresetCurve=$;function q(z,T){Object.defineProperty(Z,z,{configurable:!0,enumerable:!0,get:function(){var A=new $(T);return Object.defineProperty(Z,z,{configurable:!0,enumerable:!0,value:A}),A}})}q("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:X.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),q("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:X.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),q("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:X.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),q("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:X.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),q("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:X.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),q("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:X.sha256,gRed:!1,g:["9"]}),q("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:X.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var M;try{M=PF()}catch(z){M=void 0}q("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:X.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",M]})}),kF=$0((U,Z)=>{var X=ZJ(),Q=UV(),K=cU();function F($){if(!(this instanceof F))return new F($);this.hash=$.hash,this.predResist=!!$.predResist,this.outLen=this.hash.outSize,this.minEntropy=$.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var q=Q.toArray($.entropy,$.entropyEnc||"hex"),M=Q.toArray($.nonce,$.nonceEnc||"hex"),z=Q.toArray($.pers,$.persEnc||"hex");K(q.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(q,M,z)}Z.exports=F,F.prototype._init=function($,q,M){var z=$.concat(q).concat(M);this.K=Array(this.outLen/8),this.V=Array(this.outLen/8);for(var T=0;T<this.V.length;T++)this.K[T]=0,this.V[T]=1;this._update(z),this._reseed=1,this.reseedInterval=281474976710656},F.prototype._hmac=function(){return new X.hmac(this.hash,this.K)},F.prototype._update=function($){var q=this._hmac().update(this.V).update([0]);if($)q=q.update($);if(this.K=q.digest(),this.V=this._hmac().update(this.V).digest(),!$)return;this.K=this._hmac().update(this.V).update([1]).update($).digest(),this.V=this._hmac().update(this.V).digest()},F.prototype.reseed=function($,q,M,z){if(typeof q!=="string")z=M,M=q,q=null;$=Q.toArray($,q),M=Q.toArray(M,z),K($.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update($.concat(M||[])),this._reseed=1},F.prototype.generate=function($,q,M,z){if(this._reseed>this.reseedInterval)throw Error("Reseed is required");if(typeof q!=="string")z=M,M=q,q=null;if(M)M=Q.toArray(M,z||"hex"),this._update(M);var T=[];while(T.length<$)this.V=this._hmac().update(this.V).digest(),T=T.concat(this.V);var A=T.slice(0,$);return this._update(M),this._reseed++,Q.encode(A,q)}}),jF=$0((U,Z)=>{var X=jU(),Q=WU(),K=Q.assert;function F($,q){if(this.ec=$,this.priv=null,this.pub=null,q.priv)this._importPrivate(q.priv,q.privEnc);if(q.pub)this._importPublic(q.pub,q.pubEnc)}Z.exports=F,F.fromPublic=function($,q,M){if(q instanceof F)return q;return new F($,{pub:q,pubEnc:M})},F.fromPrivate=function($,q,M){if(q instanceof F)return q;return new F($,{priv:q,privEnc:M})},F.prototype.validate=function(){var $=this.getPublic();if($.isInfinity())return{result:!1,reason:"Invalid public key"};if(!$.validate())return{result:!1,reason:"Public key is not a point"};if(!$.mul(this.ec.curve.n).isInfinity())return{result:!1,reason:"Public key * N != O"};return{result:!0,reason:null}},F.prototype.getPublic=function($,q){if(typeof $==="string")q=$,$=null;if(!this.pub)this.pub=this.ec.g.mul(this.priv);if(!q)return this.pub;return this.pub.encode(q,$)},F.prototype.getPrivate=function($){if($==="hex")return this.priv.toString(16,2);else return this.priv},F.prototype._importPrivate=function($,q){this.priv=new X($,q||16),this.priv=this.priv.umod(this.ec.curve.n)},F.prototype._importPublic=function($,q){if($.x||$.y){if(this.ec.curve.type==="mont")K($.x,"Need x coordinate");else if(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")K($.x&&$.y,"Need both x and y coordinate");this.pub=this.ec.curve.point($.x,$.y);return}this.pub=this.ec.curve.decodePoint($,q)},F.prototype.derive=function($){if(!$.validate())K($.validate(),"public point not validated");return $.mul(this.priv).getX()},F.prototype.sign=function($,q,M){return this.ec.sign($,this,q,M)},F.prototype.verify=function($,q,M){return this.ec.verify($,q,this,void 0,M)},F.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"}}),vF=$0((U,Z)=>{var X=jU(),Q=WU(),K=Q.assert;function F(T,A){if(T instanceof F)return T;if(this._importDER(T,A))return;if(K(T.r&&T.s,"Signature without r or s"),this.r=new X(T.r,16),this.s=new X(T.s,16),T.recoveryParam===void 0)this.recoveryParam=null;else this.recoveryParam=T.recoveryParam}Z.exports=F;function $(){this.place=0}function q(T,A){var L=T[A.place++];if(!(L&128))return L;var E=L&15;if(E===0||E>4)return!1;if(T[A.place]===0)return!1;var S=0;for(var j=0,k=A.place;j<E;j++,k++)S<<=8,S|=T[k],S>>>=0;if(S<=127)return!1;return A.place=k,S}function M(T){var A=0,L=T.length-1;while(!T[A]&&!(T[A+1]&128)&&A<L)A++;if(A===0)return T;return T.slice(A)}F.prototype._importDER=function(T,A){T=Q.toArray(T,A);var L=new $;if(T[L.place++]!==48)return!1;var E=q(T,L);if(E===!1)return!1;if(E+L.place!==T.length)return!1;if(T[L.place++]!==2)return!1;var S=q(T,L);if(S===!1)return!1;if((T[L.place]&128)!==0)return!1;var j=T.slice(L.place,S+L.place);if(L.place+=S,T[L.place++]!==2)return!1;var k=q(T,L);if(k===!1)return!1;if(T.length!==k+L.place)return!1;if((T[L.place]&128)!==0)return!1;var B=T.slice(L.place,k+L.place);if(j[0]===0)if(j[1]&128)j=j.slice(1);else return!1;if(B[0]===0)if(B[1]&128)B=B.slice(1);else return!1;return this.r=new X(j),this.s=new X(B),this.recoveryParam=null,!0};function z(T,A){if(A<128){T.push(A);return}var L=1+(Math.log(A)/Math.LN2>>>3);T.push(L|128);while(--L)T.push(A>>>(L<<3)&255);T.push(A)}F.prototype.toDER=function(T){var A=this.r.toArray(),L=this.s.toArray();if(A[0]&128)A=[0].concat(A);if(L[0]&128)L=[0].concat(L);A=M(A),L=M(L);while(!L[0]&&!(L[1]&128))L=L.slice(1);var E=[2];z(E,A.length),E=E.concat(A),E.push(2),z(E,L.length);var S=E.concat(L),j=[48];return z(j,S.length),j=j.concat(S),Q.encode(j,T)}}),_F=$0((U,Z)=>{var X=jU(),Q=kF(),K=WU(),F=XJ(),$=ZV(),q=K.assert,M=jF(),z=vF();function T(A){if(!(this instanceof T))return new T(A);if(typeof A==="string")q(Object.prototype.hasOwnProperty.call(F,A),"Unknown curve "+A),A=F[A];if(A instanceof F.PresetCurve)A={curve:A};this.curve=A.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=A.curve.g,this.g.precompute(A.curve.n.bitLength()+1),this.hash=A.hash||A.curve.hash}Z.exports=T,T.prototype.keyPair=function(A){return new M(this,A)},T.prototype.keyFromPrivate=function(A,L){return M.fromPrivate(this,A,L)},T.prototype.keyFromPublic=function(A,L){return M.fromPublic(this,A,L)},T.prototype.genKeyPair=function(A){if(!A)A={};var L=new Q({hash:this.hash,pers:A.pers,persEnc:A.persEnc||"utf8",entropy:A.entropy||$(this.hash.hmacStrength),entropyEnc:A.entropy&&A.entropyEnc||"utf8",nonce:this.n.toArray()}),E=this.n.byteLength(),S=this.n.sub(new X(2));for(;;){var j=new X(L.generate(E));if(j.cmp(S)>0)continue;return j.iaddn(1),this.keyFromPrivate(j)}},T.prototype._truncateToN=function(A,L,E){var S;if(X.isBN(A)||typeof A==="number")A=new X(A,16),S=A.byteLength();else if(typeof A==="object")S=A.length,A=new X(A,16);else{var j=A.toString();S=j.length+1>>>1,A=new X(j,16)}if(typeof E!=="number")E=S*8;var k=E-this.n.bitLength();if(k>0)A=A.ushrn(k);if(!L&&A.cmp(this.n)>=0)return A.sub(this.n);else return A},T.prototype.sign=function(A,L,E,S){if(typeof E==="object")S=E,E=null;if(!S)S={};if(typeof A!=="string"&&typeof A!=="number"&&!X.isBN(A)){q(typeof A==="object"&&A&&typeof A.length==="number","Expected message to be an array-like, a hex string, or a BN instance"),q(A.length>>>0===A.length);for(var j=0;j<A.length;j++)q((A[j]&255)===A[j])}L=this.keyFromPrivate(L,E),A=this._truncateToN(A,!1,S.msgBitLength),q(!A.isNeg(),"Can not sign a negative message");var k=this.n.byteLength(),B=L.getPrivate().toArray("be",k),v=A.toArray("be",k);q(new X(v).eq(A),"Can not sign message");var x=new Q({hash:this.hash,entropy:B,nonce:v,pers:S.pers,persEnc:S.persEnc||"utf8"}),N=this.n.sub(new X(1));for(var w=0;;w++){var u=S.k?S.k(w):new X(x.generate(this.n.byteLength()));if(u=this._truncateToN(u,!0),u.cmpn(1)<=0||u.cmp(N)>=0)continue;var Z0=this.g.mul(u);if(Z0.isInfinity())continue;var V0=Z0.getX(),Y0=V0.umod(this.n);if(Y0.cmpn(0)===0)continue;var b=u.invm(this.n).mul(Y0.mul(L.getPrivate()).iadd(A));if(b=b.umod(this.n),b.cmpn(0)===0)continue;var i=(Z0.getY().isOdd()?1:0)|(V0.cmp(Y0)!==0?2:0);if(S.canonical&&b.cmp(this.nh)>0)b=this.n.sub(b),i^=1;return new z({r:Y0,s:b,recoveryParam:i})}},T.prototype.verify=function(A,L,E,S,j){if(!j)j={};A=this._truncateToN(A,!1,j.msgBitLength),E=this.keyFromPublic(E,S),L=new z(L,"hex");var{r:k,s:B}=L;if(k.cmpn(1)<0||k.cmp(this.n)>=0)return!1;if(B.cmpn(1)<0||B.cmp(this.n)>=0)return!1;var v=B.invm(this.n),x=v.mul(A).umod(this.n),N=v.mul(k).umod(this.n),w;if(!this.curve._maxwellTrick){if(w=this.g.mulAdd(x,E.getPublic(),N),w.isInfinity())return!1;return w.getX().umod(this.n).cmp(k)===0}if(w=this.g.jmulAdd(x,E.getPublic(),N),w.isInfinity())return!1;return w.eqXToP(k)},T.prototype.recoverPubKey=function(A,L,E,S){q((3&E)===E,"The recovery param is more than two bits"),L=new z(L,S);var j=this.n,k=new X(A),B=L.r,v=L.s,x=E&1,N=E>>1;if(B.cmp(this.curve.p.umod(this.curve.n))>=0&&N)throw Error("Unable to find sencond key candinate");if(N)B=this.curve.pointFromX(B.add(this.curve.n),x);else B=this.curve.pointFromX(B,x);var w=L.r.invm(j),u=j.sub(k).mul(w).umod(j),Z0=v.mul(w).umod(j);return this.g.mulAdd(u,B,Z0)},T.prototype.getKeyRecoveryParam=function(A,L,E,S){if(L=new z(L,S),L.recoveryParam!==null)return L.recoveryParam;for(var j=0;j<4;j++){var k;try{k=this.recoverPubKey(A,L,j)}catch(B){continue}if(k.eq(E))return j}throw Error("Unable to find valid recovery factor")}}),BF=$0((U,Z)=>{var X=WU(),Q=X.assert,K=X.parseBytes,F=X.cachedProperty;function $(q,M){if(this.eddsa=q,this._secret=K(M.secret),q.isPoint(M.pub))this._pub=M.pub;else this._pubBytes=K(M.pub)}$.fromPublic=function(q,M){if(M instanceof $)return M;return new $(q,{pub:M})},$.fromSecret=function(q,M){if(M instanceof $)return M;return new $(q,{secret:M})},$.prototype.secret=function(){return this._secret},F($,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),F($,"pub",function(){if(this._pubBytes)return this.eddsa.decodePoint(this._pubBytes);return this.eddsa.g.mul(this.priv())}),F($,"privBytes",function(){var q=this.eddsa,M=this.hash(),z=q.encodingLength-1,T=M.slice(0,q.encodingLength);return T[0]&=248,T[z]&=127,T[z]|=64,T}),F($,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),F($,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),F($,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),$.prototype.sign=function(q){return Q(this._secret,"KeyPair can only verify"),this.eddsa.sign(q,this)},$.prototype.verify=function(q,M){return this.eddsa.verify(q,M,this)},$.prototype.getSecret=function(q){return Q(this._secret,"KeyPair is public only"),X.encode(this.secret(),q)},$.prototype.getPublic=function(q){return X.encode(this.pubBytes(),q)},Z.exports=$}),xF=$0((U,Z)=>{var X=jU(),Q=WU(),K=Q.assert,F=Q.cachedProperty,$=Q.parseBytes;function q(M,z){if(this.eddsa=M,typeof z!=="object")z=$(z);if(Array.isArray(z))K(z.length===M.encodingLength*2,"Signature has invalid size"),z={R:z.slice(0,M.encodingLength),S:z.slice(M.encodingLength)};if(K(z.R&&z.S,"Signature without R or S"),M.isPoint(z.R))this._R=z.R;if(z.S instanceof X)this._S=z.S;this._Rencoded=Array.isArray(z.R)?z.R:z.Rencoded,this._Sencoded=Array.isArray(z.S)?z.S:z.Sencoded}F(q,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),F(q,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),F(q,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),F(q,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),q.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},q.prototype.toHex=function(){return Q.encode(this.toBytes(),"hex").toUpperCase()},Z.exports=q}),NF=$0((U,Z)=>{var X=ZJ(),Q=XJ(),K=WU(),F=K.assert,$=K.parseBytes,q=BF(),M=xF();function z(T){if(F(T==="ed25519","only tested with ed25519 so far"),!(this instanceof z))return new z(T);T=Q[T].curve,this.curve=T,this.g=T.g,this.g.precompute(T.n.bitLength()+1),this.pointClass=T.point().constructor,this.encodingLength=Math.ceil(T.n.bitLength()/8),this.hash=X.sha512}Z.exports=z,z.prototype.sign=function(T,A){T=$(T);var L=this.keyFromSecret(A),E=this.hashInt(L.messagePrefix(),T),S=this.g.mul(E),j=this.encodePoint(S),k=this.hashInt(j,L.pubBytes(),T).mul(L.priv()),B=E.add(k).umod(this.curve.n);return this.makeSignature({R:S,S:B,Rencoded:j})},z.prototype.verify=function(T,A,L){if(T=$(T),A=this.makeSignature(A),A.S().gte(A.eddsa.curve.n)||A.S().isNeg())return!1;var E=this.keyFromPublic(L),S=this.hashInt(A.Rencoded(),E.pubBytes(),T),j=this.g.mul(A.S()),k=A.R().add(E.pub().mul(S));return k.eq(j)},z.prototype.hashInt=function(){var T=this.hash();for(var A=0;A<arguments.length;A++)T.update(arguments[A]);return K.intFromLE(T.digest()).umod(this.curve.n)},z.prototype.keyFromPublic=function(T){return q.fromPublic(this,T)},z.prototype.keyFromSecret=function(T){return q.fromSecret(this,T)},z.prototype.makeSignature=function(T){if(T instanceof M)return T;return new M(this,T)},z.prototype.encodePoint=function(T){var A=T.getY().toArray("le",this.encodingLength);return A[this.encodingLength-1]|=T.getX().isOdd()?128:0,A},z.prototype.decodePoint=function(T){T=K.parseBytes(T);var A=T.length-1,L=T.slice(0,A).concat(T[A]&-129),E=(T[A]&128)!==0,S=K.intFromLE(L);return this.curve.pointFromY(S,E)},z.prototype.encodeInt=function(T){return T.toArray("le",this.encodingLength)},z.prototype.decodeInt=function(T){return K.intFromLE(T)},z.prototype.isPoint=function(T){return T instanceof this.pointClass}}),gF=$0((U)=>{var Z=U;Z.version=CF().version,Z.utils=WU(),Z.rand=ZV(),Z.curve=XV(),Z.curves=XJ(),Z.ec=_F(),Z.eddsa=NF()}),fF=$0((U,Z)=>{(function(X,Q){function K(Y,V){if(!Y)throw Error(V||"Assertion failed")}function F(Y,V){Y.super_=V;var I=function(){};I.prototype=V.prototype,Y.prototype=new I,Y.prototype.constructor=Y}function $(Y,V,I){if($.isBN(Y))return Y;if(this.negative=0,this.words=null,this.length=0,this.red=null,Y!==null){if(V==="le"||V==="be")I=V,V=10;this._init(Y||0,V||10,I||"be")}}if(typeof X==="object")X.exports=$;else Q.BN=$;$.BN=$,$.wordSize=26;var q;try{if(typeof window<"u"&&typeof window.Buffer<"u")q=window.Buffer;else q=(g1(),m0(N1)).Buffer}catch(Y){}$.isBN=function(Y){if(Y instanceof $)return!0;return Y!==null&&typeof Y==="object"&&Y.constructor.wordSize===$.wordSize&&Array.isArray(Y.words)},$.max=function(Y,V){if(Y.cmp(V)>0)return Y;return V},$.min=function(Y,V){if(Y.cmp(V)<0)return Y;return V},$.prototype._init=function(Y,V,I){if(typeof Y==="number")return this._initNumber(Y,V,I);if(typeof Y==="object")return this._initArray(Y,V,I);if(V==="hex")V=16;K(V===(V|0)&&V>=2&&V<=36),Y=Y.toString().replace(/\s+/g,"");var G=0;if(Y[0]==="-")G++,this.negative=1;if(G<Y.length){if(V===16)this._parseHex(Y,G,I);else if(this._parseBase(Y,V,G),I==="le")this._initArray(this.toArray(),V,I)}},$.prototype._initNumber=function(Y,V,I){if(Y<0)this.negative=1,Y=-Y;if(Y<67108864)this.words=[Y&67108863],this.length=1;else if(Y<4503599627370496)this.words=[Y&67108863,Y/67108864&67108863],this.length=2;else K(Y<9007199254740992),this.words=[Y&67108863,Y/67108864&67108863,1],this.length=3;if(I!=="le")return;this._initArray(this.toArray(),V,I)},$.prototype._initArray=function(Y,V,I){if(K(typeof Y.length==="number"),Y.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(Y.length/3),this.words=Array(this.length);for(var G=0;G<this.length;G++)this.words[G]=0;var W,C,D=0;if(I==="be"){for(G=Y.length-1,W=0;G>=0;G-=3)if(C=Y[G]|Y[G-1]<<8|Y[G-2]<<16,this.words[W]|=C<<D&67108863,this.words[W+1]=C>>>26-D&67108863,D+=24,D>=26)D-=26,W++}else if(I==="le"){for(G=0,W=0;G<Y.length;G+=3)if(C=Y[G]|Y[G+1]<<8|Y[G+2]<<16,this.words[W]|=C<<D&67108863,this.words[W+1]=C>>>26-D&67108863,D+=24,D>=26)D-=26,W++}return this.strip()};function M(Y,V){var I=Y.charCodeAt(V);if(I>=65&&I<=70)return I-55;else if(I>=97&&I<=102)return I-87;else return I-48&15}function z(Y,V,I){var G=M(Y,I);if(I-1>=V)G|=M(Y,I-1)<<4;return G}$.prototype._parseHex=function(Y,V,I){this.length=Math.ceil((Y.length-V)/6),this.words=Array(this.length);for(var G=0;G<this.length;G++)this.words[G]=0;var W=0,C=0,D;if(I==="be")for(G=Y.length-1;G>=V;G-=2)if(D=z(Y,V,G)<<W,this.words[C]|=D&67108863,W>=18)W-=18,C+=1,this.words[C]|=D>>>26;else W+=8;else{var H=Y.length-V;for(G=H%2===0?V+1:V;G<Y.length;G+=2)if(D=z(Y,V,G)<<W,this.words[C]|=D&67108863,W>=18)W-=18,C+=1,this.words[C]|=D>>>26;else W+=8}this.strip()};function T(Y,V,I,G){var W=0,C=Math.min(Y.length,I);for(var D=V;D<C;D++){var H=Y.charCodeAt(D)-48;if(W*=G,H>=49)W+=H-49+10;else if(H>=17)W+=H-17+10;else W+=H}return W}$.prototype._parseBase=function(Y,V,I){this.words=[0],this.length=1;for(var G=0,W=1;W<=67108863;W*=V)G++;G--,W=W/V|0;var C=Y.length-I,D=C%G,H=Math.min(C,C-D)+I,J=0;for(var O=I;O<H;O+=G)if(J=T(Y,O,O+G,V),this.imuln(W),this.words[0]+J<67108864)this.words[0]+=J;else this._iaddn(J);if(D!==0){var P=1;J=T(Y,O,Y.length,V);for(O=0;O<D;O++)P*=V;if(this.imuln(P),this.words[0]+J<67108864)this.words[0]+=J;else this._iaddn(J)}this.strip()},$.prototype.copy=function(Y){Y.words=Array(this.length);for(var V=0;V<this.length;V++)Y.words[V]=this.words[V];Y.length=this.length,Y.negative=this.negative,Y.red=this.red},$.prototype.clone=function(){var Y=new $(null);return this.copy(Y),Y},$.prototype._expand=function(Y){while(this.length<Y)this.words[this.length++]=0;return this},$.prototype.strip=function(){while(this.length>1&&this.words[this.length-1]===0)this.length--;return this._normSign()},$.prototype._normSign=function(){if(this.length===1&&this.words[0]===0)this.negative=0;return this},$.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var A=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],L=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],E=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64000000,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,24300000,28629151,33554432,39135393,45435424,52521875,60466176];if($.prototype.toString=function(Y,V){Y=Y||10,V=V|0||1;var I;if(Y===16||Y==="hex"){I="";var G=0,W=0;for(var C=0;C<this.length;C++){var D=this.words[C],H=((D<<G|W)&16777215).toString(16);if(W=D>>>24-G&16777215,G+=2,G>=26)G-=26,C--;if(W!==0||C!==this.length-1)I=A[6-H.length]+H+I;else I=H+I}if(W!==0)I=W.toString(16)+I;while(I.length%V!==0)I="0"+I;if(this.negative!==0)I="-"+I;return I}if(Y===(Y|0)&&Y>=2&&Y<=36){var J=L[Y],O=E[Y];I="";var P=this.clone();P.negative=0;while(!P.isZero()){var R=P.modn(O).toString(Y);if(P=P.idivn(O),!P.isZero())I=A[J-R.length]+R+I;else I=R+I}if(this.isZero())I="0"+I;while(I.length%V!==0)I="0"+I;if(this.negative!==0)I="-"+I;return I}K(!1,"Base should be between 2 and 36")},$.prototype.toNumber=function(){var Y=this.words[0];if(this.length===2)Y+=this.words[1]*67108864;else if(this.length===3&&this.words[2]===1)Y+=4503599627370496+this.words[1]*67108864;else if(this.length>2)K(!1,"Number can only safely store up to 53 bits");return this.negative!==0?-Y:Y},$.prototype.toJSON=function(){return this.toString(16)},$.prototype.toBuffer=function(Y,V){return K(typeof q<"u"),this.toArrayLike(q,Y,V)},$.prototype.toArray=function(Y,V){return this.toArrayLike(Array,Y,V)},$.prototype.toArrayLike=function(Y,V,I){var G=this.byteLength(),W=I||Math.max(1,G);K(G<=W,"byte array longer than desired length"),K(W>0,"Requested array length <= 0"),this.strip();var C=V==="le",D=new Y(W),H,J,O=this.clone();if(!C){for(J=0;J<W-G;J++)D[J]=0;for(J=0;!O.isZero();J++)H=O.andln(255),O.iushrn(8),D[W-J-1]=H}else{for(J=0;!O.isZero();J++)H=O.andln(255),O.iushrn(8),D[J]=H;for(;J<W;J++)D[J]=0}return D},Math.clz32)$.prototype._countBits=function(Y){return 32-Math.clz32(Y)};else $.prototype._countBits=function(Y){var V=Y,I=0;if(V>=4096)I+=13,V>>>=13;if(V>=64)I+=7,V>>>=7;if(V>=8)I+=4,V>>>=4;if(V>=2)I+=2,V>>>=2;return I+V};$.prototype._zeroBits=function(Y){if(Y===0)return 26;var V=Y,I=0;if((V&8191)===0)I+=13,V>>>=13;if((V&127)===0)I+=7,V>>>=7;if((V&15)===0)I+=4,V>>>=4;if((V&3)===0)I+=2,V>>>=2;if((V&1)===0)I++;return I},$.prototype.bitLength=function(){var Y=this.words[this.length-1],V=this._countBits(Y);return(this.length-1)*26+V};function S(Y){var V=Array(Y.bitLength());for(var I=0;I<V.length;I++){var G=I/26|0,W=I%26;V[I]=(Y.words[G]&1<<W)>>>W}return V}$.prototype.zeroBits=function(){if(this.isZero())return 0;var Y=0;for(var V=0;V<this.length;V++){var I=this._zeroBits(this.words[V]);if(Y+=I,I!==26)break}return Y},$.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},$.prototype.toTwos=function(Y){if(this.negative!==0)return this.abs().inotn(Y).iaddn(1);return this.clone()},$.prototype.fromTwos=function(Y){if(this.testn(Y-1))return this.notn(Y).iaddn(1).ineg();return this.clone()},$.prototype.isNeg=function(){return this.negative!==0},$.prototype.neg=function(){return this.clone().ineg()},$.prototype.ineg=function(){if(!this.isZero())this.negative^=1;return this},$.prototype.iuor=function(Y){while(this.length<Y.length)this.words[this.length++]=0;for(var V=0;V<Y.length;V++)this.words[V]=this.words[V]|Y.words[V];return this.strip()},$.prototype.ior=function(Y){return K((this.negative|Y.negative)===0),this.iuor(Y)},$.prototype.or=function(Y){if(this.length>Y.length)return this.clone().ior(Y);return Y.clone().ior(this)},$.prototype.uor=function(Y){if(this.length>Y.length)return this.clone().iuor(Y);return Y.clone().iuor(this)},$.prototype.iuand=function(Y){var V;if(this.length>Y.length)V=Y;else V=this;for(var I=0;I<V.length;I++)this.words[I]=this.words[I]&Y.words[I];return this.length=V.length,this.strip()},$.prototype.iand=function(Y){return K((this.negative|Y.negative)===0),this.iuand(Y)},$.prototype.and=function(Y){if(this.length>Y.length)return this.clone().iand(Y);return Y.clone().iand(this)},$.prototype.uand=function(Y){if(this.length>Y.length)return this.clone().iuand(Y);return Y.clone().iuand(this)},$.prototype.iuxor=function(Y){var V,I;if(this.length>Y.length)V=this,I=Y;else V=Y,I=this;for(var G=0;G<I.length;G++)this.words[G]=V.words[G]^I.words[G];if(this!==V)for(;G<V.length;G++)this.words[G]=V.words[G];return this.length=V.length,this.strip()},$.prototype.ixor=function(Y){return K((this.negative|Y.negative)===0),this.iuxor(Y)},$.prototype.xor=function(Y){if(this.length>Y.length)return this.clone().ixor(Y);return Y.clone().ixor(this)},$.prototype.uxor=function(Y){if(this.length>Y.length)return this.clone().iuxor(Y);return Y.clone().iuxor(this)},$.prototype.inotn=function(Y){K(typeof Y==="number"&&Y>=0);var V=Math.ceil(Y/26)|0,I=Y%26;if(this._expand(V),I>0)V--;for(var G=0;G<V;G++)this.words[G]=~this.words[G]&67108863;if(I>0)this.words[G]=~this.words[G]&67108863>>26-I;return this.strip()},$.prototype.notn=function(Y){return this.clone().inotn(Y)},$.prototype.setn=function(Y,V){K(typeof Y==="number"&&Y>=0);var I=Y/26|0,G=Y%26;if(this._expand(I+1),V)this.words[I]=this.words[I]|1<<G;else this.words[I]=this.words[I]&~(1<<G);return this.strip()},$.prototype.iadd=function(Y){var V;if(this.negative!==0&&Y.negative===0)return this.negative=0,V=this.isub(Y),this.negative^=1,this._normSign();else if(this.negative===0&&Y.negative!==0)return Y.negative=0,V=this.isub(Y),Y.negative=1,V._normSign();var I,G;if(this.length>Y.length)I=this,G=Y;else I=Y,G=this;var W=0;for(var C=0;C<G.length;C++)V=(I.words[C]|0)+(G.words[C]|0)+W,this.words[C]=V&67108863,W=V>>>26;for(;W!==0&&C<I.length;C++)V=(I.words[C]|0)+W,this.words[C]=V&67108863,W=V>>>26;if(this.length=I.length,W!==0)this.words[this.length]=W,this.length++;else if(I!==this)for(;C<I.length;C++)this.words[C]=I.words[C];return this},$.prototype.add=function(Y){var V;if(Y.negative!==0&&this.negative===0)return Y.negative=0,V=this.sub(Y),Y.negative^=1,V;else if(Y.negative===0&&this.negative!==0)return this.negative=0,V=Y.sub(this),this.negative=1,V;if(this.length>Y.length)return this.clone().iadd(Y);return Y.clone().iadd(this)},$.prototype.isub=function(Y){if(Y.negative!==0){Y.negative=0;var V=this.iadd(Y);return Y.negative=1,V._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(Y),this.negative=1,this._normSign();var I=this.cmp(Y);if(I===0)return this.negative=0,this.length=1,this.words[0]=0,this;var G,W;if(I>0)G=this,W=Y;else G=Y,W=this;var C=0;for(var D=0;D<W.length;D++)V=(G.words[D]|0)-(W.words[D]|0)+C,C=V>>26,this.words[D]=V&67108863;for(;C!==0&&D<G.length;D++)V=(G.words[D]|0)+C,C=V>>26,this.words[D]=V&67108863;if(C===0&&D<G.length&&G!==this)for(;D<G.length;D++)this.words[D]=G.words[D];if(this.length=Math.max(this.length,D),G!==this)this.negative=1;return this.strip()},$.prototype.sub=function(Y){return this.clone().isub(Y)};function j(Y,V,I){I.negative=V.negative^Y.negative;var G=Y.length+V.length|0;I.length=G,G=G-1|0;var W=Y.words[0]|0,C=V.words[0]|0,D=W*C,H=D&67108863,J=D/67108864|0;I.words[0]=H;for(var O=1;O<G;O++){var P=J>>>26,R=J&67108863,_=Math.min(O,V.length-1);for(var f=Math.max(0,O-Y.length+1);f<=_;f++){var c=O-f|0;W=Y.words[c]|0,C=V.words[f]|0,D=W*C+R,P+=D/67108864|0,R=D&67108863}I.words[O]=R|0,J=P|0}if(J!==0)I.words[O]=J|0;else I.length--;return I.strip()}var k=function(Y,V,I){var G=Y.words,W=V.words,C=I.words,D=0,H,J,O,P=G[0]|0,R=P&8191,_=P>>>13,f=G[1]|0,c=f&8191,o=f>>>13,K0=G[2]|0,a=K0&8191,l=K0>>>13,Q0=G[3]|0,n=Q0&8191,s=Q0>>>13,f0=G[4]|0,y=f0&8191,h=f0>>>13,G0=G[5]|0,t=G0&8191,U0=G0>>>13,L0=G[6]|0,p=L0&8191,m=L0>>>13,g0=G[7]|0,r=g0&8191,J0=g0>>>13,h0=G[8]|0,H0=h0&8191,O0=h0>>>13,J1=G[9]|0,I0=J1&8191,C0=J1>>>13,K1=W[0]|0,q0=K1&8191,z0=K1>>>13,d1=W[1]|0,T0=d1&8191,j0=d1>>>13,l1=W[2]|0,v0=l1&8191,R0=l1>>>13,h1=W[3]|0,_0=h1&8191,E0=h1>>>13,_1=W[4]|0,B0=_1&8191,x0=_1>>>13,B1=W[5]|0,S0=B1&8191,g=B1>>>13,d=W[6]|0,e=d&8191,X0=d>>>13,y0=W[7]|0,F0=y0&8191,A0=y0>>>13,Q1=W[8]|0,P0=Q1&8191,N0=Q1>>>13,u1=W[9]|0,k0=u1&8191,M0=u1>>>13;I.negative=Y.negative^V.negative,I.length=19,H=Math.imul(R,q0),J=Math.imul(R,z0),J=J+Math.imul(_,q0)|0,O=Math.imul(_,z0);var G1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(G1>>>26)|0,G1&=67108863,H=Math.imul(c,q0),J=Math.imul(c,z0),J=J+Math.imul(o,q0)|0,O=Math.imul(o,z0),H=H+Math.imul(R,T0)|0,J=J+Math.imul(R,j0)|0,J=J+Math.imul(_,T0)|0,O=O+Math.imul(_,j0)|0;var l0=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(l0>>>26)|0,l0&=67108863,H=Math.imul(a,q0),J=Math.imul(a,z0),J=J+Math.imul(l,q0)|0,O=Math.imul(l,z0),H=H+Math.imul(c,T0)|0,J=J+Math.imul(c,j0)|0,J=J+Math.imul(o,T0)|0,O=O+Math.imul(o,j0)|0,H=H+Math.imul(R,v0)|0,J=J+Math.imul(R,R0)|0,J=J+Math.imul(_,v0)|0,O=O+Math.imul(_,R0)|0;var b0=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(b0>>>26)|0,b0&=67108863,H=Math.imul(n,q0),J=Math.imul(n,z0),J=J+Math.imul(s,q0)|0,O=Math.imul(s,z0),H=H+Math.imul(a,T0)|0,J=J+Math.imul(a,j0)|0,J=J+Math.imul(l,T0)|0,O=O+Math.imul(l,j0)|0,H=H+Math.imul(c,v0)|0,J=J+Math.imul(c,R0)|0,J=J+Math.imul(o,v0)|0,O=O+Math.imul(o,R0)|0,H=H+Math.imul(R,_0)|0,J=J+Math.imul(R,E0)|0,J=J+Math.imul(_,_0)|0,O=O+Math.imul(_,E0)|0;var t0=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(t0>>>26)|0,t0&=67108863,H=Math.imul(y,q0),J=Math.imul(y,z0),J=J+Math.imul(h,q0)|0,O=Math.imul(h,z0),H=H+Math.imul(n,T0)|0,J=J+Math.imul(n,j0)|0,J=J+Math.imul(s,T0)|0,O=O+Math.imul(s,j0)|0,H=H+Math.imul(a,v0)|0,J=J+Math.imul(a,R0)|0,J=J+Math.imul(l,v0)|0,O=O+Math.imul(l,R0)|0,H=H+Math.imul(c,_0)|0,J=J+Math.imul(c,E0)|0,J=J+Math.imul(o,_0)|0,O=O+Math.imul(o,E0)|0,H=H+Math.imul(R,B0)|0,J=J+Math.imul(R,x0)|0,J=J+Math.imul(_,B0)|0,O=O+Math.imul(_,x0)|0;var r0=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(r0>>>26)|0,r0&=67108863,H=Math.imul(t,q0),J=Math.imul(t,z0),J=J+Math.imul(U0,q0)|0,O=Math.imul(U0,z0),H=H+Math.imul(y,T0)|0,J=J+Math.imul(y,j0)|0,J=J+Math.imul(h,T0)|0,O=O+Math.imul(h,j0)|0,H=H+Math.imul(n,v0)|0,J=J+Math.imul(n,R0)|0,J=J+Math.imul(s,v0)|0,O=O+Math.imul(s,R0)|0,H=H+Math.imul(a,_0)|0,J=J+Math.imul(a,E0)|0,J=J+Math.imul(l,_0)|0,O=O+Math.imul(l,E0)|0,H=H+Math.imul(c,B0)|0,J=J+Math.imul(c,x0)|0,J=J+Math.imul(o,B0)|0,O=O+Math.imul(o,x0)|0,H=H+Math.imul(R,S0)|0,J=J+Math.imul(R,g)|0,J=J+Math.imul(_,S0)|0,O=O+Math.imul(_,g)|0;var H1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(H1>>>26)|0,H1&=67108863,H=Math.imul(p,q0),J=Math.imul(p,z0),J=J+Math.imul(m,q0)|0,O=Math.imul(m,z0),H=H+Math.imul(t,T0)|0,J=J+Math.imul(t,j0)|0,J=J+Math.imul(U0,T0)|0,O=O+Math.imul(U0,j0)|0,H=H+Math.imul(y,v0)|0,J=J+Math.imul(y,R0)|0,J=J+Math.imul(h,v0)|0,O=O+Math.imul(h,R0)|0,H=H+Math.imul(n,_0)|0,J=J+Math.imul(n,E0)|0,J=J+Math.imul(s,_0)|0,O=O+Math.imul(s,E0)|0,H=H+Math.imul(a,B0)|0,J=J+Math.imul(a,x0)|0,J=J+Math.imul(l,B0)|0,O=O+Math.imul(l,x0)|0,H=H+Math.imul(c,S0)|0,J=J+Math.imul(c,g)|0,J=J+Math.imul(o,S0)|0,O=O+Math.imul(o,g)|0,H=H+Math.imul(R,e)|0,J=J+Math.imul(R,X0)|0,J=J+Math.imul(_,e)|0,O=O+Math.imul(_,X0)|0;var O1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(O1>>>26)|0,O1&=67108863,H=Math.imul(r,q0),J=Math.imul(r,z0),J=J+Math.imul(J0,q0)|0,O=Math.imul(J0,z0),H=H+Math.imul(p,T0)|0,J=J+Math.imul(p,j0)|0,J=J+Math.imul(m,T0)|0,O=O+Math.imul(m,j0)|0,H=H+Math.imul(t,v0)|0,J=J+Math.imul(t,R0)|0,J=J+Math.imul(U0,v0)|0,O=O+Math.imul(U0,R0)|0,H=H+Math.imul(y,_0)|0,J=J+Math.imul(y,E0)|0,J=J+Math.imul(h,_0)|0,O=O+Math.imul(h,E0)|0,H=H+Math.imul(n,B0)|0,J=J+Math.imul(n,x0)|0,J=J+Math.imul(s,B0)|0,O=O+Math.imul(s,x0)|0,H=H+Math.imul(a,S0)|0,J=J+Math.imul(a,g)|0,J=J+Math.imul(l,S0)|0,O=O+Math.imul(l,g)|0,H=H+Math.imul(c,e)|0,J=J+Math.imul(c,X0)|0,J=J+Math.imul(o,e)|0,O=O+Math.imul(o,X0)|0,H=H+Math.imul(R,F0)|0,J=J+Math.imul(R,A0)|0,J=J+Math.imul(_,F0)|0,O=O+Math.imul(_,A0)|0;var C1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(C1>>>26)|0,C1&=67108863,H=Math.imul(H0,q0),J=Math.imul(H0,z0),J=J+Math.imul(O0,q0)|0,O=Math.imul(O0,z0),H=H+Math.imul(r,T0)|0,J=J+Math.imul(r,j0)|0,J=J+Math.imul(J0,T0)|0,O=O+Math.imul(J0,j0)|0,H=H+Math.imul(p,v0)|0,J=J+Math.imul(p,R0)|0,J=J+Math.imul(m,v0)|0,O=O+Math.imul(m,R0)|0,H=H+Math.imul(t,_0)|0,J=J+Math.imul(t,E0)|0,J=J+Math.imul(U0,_0)|0,O=O+Math.imul(U0,E0)|0,H=H+Math.imul(y,B0)|0,J=J+Math.imul(y,x0)|0,J=J+Math.imul(h,B0)|0,O=O+Math.imul(h,x0)|0,H=H+Math.imul(n,S0)|0,J=J+Math.imul(n,g)|0,J=J+Math.imul(s,S0)|0,O=O+Math.imul(s,g)|0,H=H+Math.imul(a,e)|0,J=J+Math.imul(a,X0)|0,J=J+Math.imul(l,e)|0,O=O+Math.imul(l,X0)|0,H=H+Math.imul(c,F0)|0,J=J+Math.imul(c,A0)|0,J=J+Math.imul(o,F0)|0,O=O+Math.imul(o,A0)|0,H=H+Math.imul(R,P0)|0,J=J+Math.imul(R,N0)|0,J=J+Math.imul(_,P0)|0,O=O+Math.imul(_,N0)|0;var A1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(A1>>>26)|0,A1&=67108863,H=Math.imul(I0,q0),J=Math.imul(I0,z0),J=J+Math.imul(C0,q0)|0,O=Math.imul(C0,z0),H=H+Math.imul(H0,T0)|0,J=J+Math.imul(H0,j0)|0,J=J+Math.imul(O0,T0)|0,O=O+Math.imul(O0,j0)|0,H=H+Math.imul(r,v0)|0,J=J+Math.imul(r,R0)|0,J=J+Math.imul(J0,v0)|0,O=O+Math.imul(J0,R0)|0,H=H+Math.imul(p,_0)|0,J=J+Math.imul(p,E0)|0,J=J+Math.imul(m,_0)|0,O=O+Math.imul(m,E0)|0,H=H+Math.imul(t,B0)|0,J=J+Math.imul(t,x0)|0,J=J+Math.imul(U0,B0)|0,O=O+Math.imul(U0,x0)|0,H=H+Math.imul(y,S0)|0,J=J+Math.imul(y,g)|0,J=J+Math.imul(h,S0)|0,O=O+Math.imul(h,g)|0,H=H+Math.imul(n,e)|0,J=J+Math.imul(n,X0)|0,J=J+Math.imul(s,e)|0,O=O+Math.imul(s,X0)|0,H=H+Math.imul(a,F0)|0,J=J+Math.imul(a,A0)|0,J=J+Math.imul(l,F0)|0,O=O+Math.imul(l,A0)|0,H=H+Math.imul(c,P0)|0,J=J+Math.imul(c,N0)|0,J=J+Math.imul(o,P0)|0,O=O+Math.imul(o,N0)|0,H=H+Math.imul(R,k0)|0,J=J+Math.imul(R,M0)|0,J=J+Math.imul(_,k0)|0,O=O+Math.imul(_,M0)|0;var z1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(z1>>>26)|0,z1&=67108863,H=Math.imul(I0,T0),J=Math.imul(I0,j0),J=J+Math.imul(C0,T0)|0,O=Math.imul(C0,j0),H=H+Math.imul(H0,v0)|0,J=J+Math.imul(H0,R0)|0,J=J+Math.imul(O0,v0)|0,O=O+Math.imul(O0,R0)|0,H=H+Math.imul(r,_0)|0,J=J+Math.imul(r,E0)|0,J=J+Math.imul(J0,_0)|0,O=O+Math.imul(J0,E0)|0,H=H+Math.imul(p,B0)|0,J=J+Math.imul(p,x0)|0,J=J+Math.imul(m,B0)|0,O=O+Math.imul(m,x0)|0,H=H+Math.imul(t,S0)|0,J=J+Math.imul(t,g)|0,J=J+Math.imul(U0,S0)|0,O=O+Math.imul(U0,g)|0,H=H+Math.imul(y,e)|0,J=J+Math.imul(y,X0)|0,J=J+Math.imul(h,e)|0,O=O+Math.imul(h,X0)|0,H=H+Math.imul(n,F0)|0,J=J+Math.imul(n,A0)|0,J=J+Math.imul(s,F0)|0,O=O+Math.imul(s,A0)|0,H=H+Math.imul(a,P0)|0,J=J+Math.imul(a,N0)|0,J=J+Math.imul(l,P0)|0,O=O+Math.imul(l,N0)|0,H=H+Math.imul(c,k0)|0,J=J+Math.imul(c,M0)|0,J=J+Math.imul(o,k0)|0,O=O+Math.imul(o,M0)|0;var D1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(D1>>>26)|0,D1&=67108863,H=Math.imul(I0,v0),J=Math.imul(I0,R0),J=J+Math.imul(C0,v0)|0,O=Math.imul(C0,R0),H=H+Math.imul(H0,_0)|0,J=J+Math.imul(H0,E0)|0,J=J+Math.imul(O0,_0)|0,O=O+Math.imul(O0,E0)|0,H=H+Math.imul(r,B0)|0,J=J+Math.imul(r,x0)|0,J=J+Math.imul(J0,B0)|0,O=O+Math.imul(J0,x0)|0,H=H+Math.imul(p,S0)|0,J=J+Math.imul(p,g)|0,J=J+Math.imul(m,S0)|0,O=O+Math.imul(m,g)|0,H=H+Math.imul(t,e)|0,J=J+Math.imul(t,X0)|0,J=J+Math.imul(U0,e)|0,O=O+Math.imul(U0,X0)|0,H=H+Math.imul(y,F0)|0,J=J+Math.imul(y,A0)|0,J=J+Math.imul(h,F0)|0,O=O+Math.imul(h,A0)|0,H=H+Math.imul(n,P0)|0,J=J+Math.imul(n,N0)|0,J=J+Math.imul(s,P0)|0,O=O+Math.imul(s,N0)|0,H=H+Math.imul(a,k0)|0,J=J+Math.imul(a,M0)|0,J=J+Math.imul(l,k0)|0,O=O+Math.imul(l,M0)|0;var q1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(q1>>>26)|0,q1&=67108863,H=Math.imul(I0,_0),J=Math.imul(I0,E0),J=J+Math.imul(C0,_0)|0,O=Math.imul(C0,E0),H=H+Math.imul(H0,B0)|0,J=J+Math.imul(H0,x0)|0,J=J+Math.imul(O0,B0)|0,O=O+Math.imul(O0,x0)|0,H=H+Math.imul(r,S0)|0,J=J+Math.imul(r,g)|0,J=J+Math.imul(J0,S0)|0,O=O+Math.imul(J0,g)|0,H=H+Math.imul(p,e)|0,J=J+Math.imul(p,X0)|0,J=J+Math.imul(m,e)|0,O=O+Math.imul(m,X0)|0,H=H+Math.imul(t,F0)|0,J=J+Math.imul(t,A0)|0,J=J+Math.imul(U0,F0)|0,O=O+Math.imul(U0,A0)|0,H=H+Math.imul(y,P0)|0,J=J+Math.imul(y,N0)|0,J=J+Math.imul(h,P0)|0,O=O+Math.imul(h,N0)|0,H=H+Math.imul(n,k0)|0,J=J+Math.imul(n,M0)|0,J=J+Math.imul(s,k0)|0,O=O+Math.imul(s,M0)|0;var M1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(M1>>>26)|0,M1&=67108863,H=Math.imul(I0,B0),J=Math.imul(I0,x0),J=J+Math.imul(C0,B0)|0,O=Math.imul(C0,x0),H=H+Math.imul(H0,S0)|0,J=J+Math.imul(H0,g)|0,J=J+Math.imul(O0,S0)|0,O=O+Math.imul(O0,g)|0,H=H+Math.imul(r,e)|0,J=J+Math.imul(r,X0)|0,J=J+Math.imul(J0,e)|0,O=O+Math.imul(J0,X0)|0,H=H+Math.imul(p,F0)|0,J=J+Math.imul(p,A0)|0,J=J+Math.imul(m,F0)|0,O=O+Math.imul(m,A0)|0,H=H+Math.imul(t,P0)|0,J=J+Math.imul(t,N0)|0,J=J+Math.imul(U0,P0)|0,O=O+Math.imul(U0,N0)|0,H=H+Math.imul(y,k0)|0,J=J+Math.imul(y,M0)|0,J=J+Math.imul(h,k0)|0,O=O+Math.imul(h,M0)|0;var L1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(L1>>>26)|0,L1&=67108863,H=Math.imul(I0,S0),J=Math.imul(I0,g),J=J+Math.imul(C0,S0)|0,O=Math.imul(C0,g),H=H+Math.imul(H0,e)|0,J=J+Math.imul(H0,X0)|0,J=J+Math.imul(O0,e)|0,O=O+Math.imul(O0,X0)|0,H=H+Math.imul(r,F0)|0,J=J+Math.imul(r,A0)|0,J=J+Math.imul(J0,F0)|0,O=O+Math.imul(J0,A0)|0,H=H+Math.imul(p,P0)|0,J=J+Math.imul(p,N0)|0,J=J+Math.imul(m,P0)|0,O=O+Math.imul(m,N0)|0,H=H+Math.imul(t,k0)|0,J=J+Math.imul(t,M0)|0,J=J+Math.imul(U0,k0)|0,O=O+Math.imul(U0,M0)|0;var T1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(T1>>>26)|0,T1&=67108863,H=Math.imul(I0,e),J=Math.imul(I0,X0),J=J+Math.imul(C0,e)|0,O=Math.imul(C0,X0),H=H+Math.imul(H0,F0)|0,J=J+Math.imul(H0,A0)|0,J=J+Math.imul(O0,F0)|0,O=O+Math.imul(O0,A0)|0,H=H+Math.imul(r,P0)|0,J=J+Math.imul(r,N0)|0,J=J+Math.imul(J0,P0)|0,O=O+Math.imul(J0,N0)|0,H=H+Math.imul(p,k0)|0,J=J+Math.imul(p,M0)|0,J=J+Math.imul(m,k0)|0,O=O+Math.imul(m,M0)|0;var R1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(R1>>>26)|0,R1&=67108863,H=Math.imul(I0,F0),J=Math.imul(I0,A0),J=J+Math.imul(C0,F0)|0,O=Math.imul(C0,A0),H=H+Math.imul(H0,P0)|0,J=J+Math.imul(H0,N0)|0,J=J+Math.imul(O0,P0)|0,O=O+Math.imul(O0,N0)|0,H=H+Math.imul(r,k0)|0,J=J+Math.imul(r,M0)|0,J=J+Math.imul(J0,k0)|0,O=O+Math.imul(J0,M0)|0;var E1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(E1>>>26)|0,E1&=67108863,H=Math.imul(I0,P0),J=Math.imul(I0,N0),J=J+Math.imul(C0,P0)|0,O=Math.imul(C0,N0),H=H+Math.imul(H0,k0)|0,J=J+Math.imul(H0,M0)|0,J=J+Math.imul(O0,k0)|0,O=O+Math.imul(O0,M0)|0;var S1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(S1>>>26)|0,S1&=67108863,H=Math.imul(I0,k0),J=Math.imul(I0,M0),J=J+Math.imul(C0,k0)|0,O=Math.imul(C0,M0);var P1=(D+H|0)+((J&8191)<<13)|0;if(D=(O+(J>>>13)|0)+(P1>>>26)|0,P1&=67108863,C[0]=G1,C[1]=l0,C[2]=b0,C[3]=t0,C[4]=r0,C[5]=H1,C[6]=O1,C[7]=C1,C[8]=A1,C[9]=z1,C[10]=D1,C[11]=q1,C[12]=M1,C[13]=L1,C[14]=T1,C[15]=R1,C[16]=E1,C[17]=S1,C[18]=P1,D!==0)C[19]=D,I.length++;return I};if(!Math.imul)k=j;function B(Y,V,I){I.negative=V.negative^Y.negative,I.length=Y.length+V.length;var G=0,W=0;for(var C=0;C<I.length-1;C++){var D=W;W=0;var H=G&67108863,J=Math.min(C,V.length-1);for(var O=Math.max(0,C-Y.length+1);O<=J;O++){var P=C-O,R=Y.words[P]|0,_=V.words[O]|0,f=R*_,c=f&67108863;D=D+(f/67108864|0)|0,c=c+H|0,H=c&67108863,D=D+(c>>>26)|0,W+=D>>>26,D&=67108863}I.words[C]=H,G=D,D=W}if(G!==0)I.words[C]=G;else I.length--;return I.strip()}function v(Y,V,I){var G=new x;return G.mulp(Y,V,I)}$.prototype.mulTo=function(Y,V){var I,G=this.length+Y.length;if(this.length===10&&Y.length===10)I=k(this,Y,V);else if(G<63)I=j(this,Y,V);else if(G<1024)I=B(this,Y,V);else I=v(this,Y,V);return I};function x(Y,V){this.x=Y,this.y=V}x.prototype.makeRBT=function(Y){var V=Array(Y),I=$.prototype._countBits(Y)-1;for(var G=0;G<Y;G++)V[G]=this.revBin(G,I,Y);return V},x.prototype.revBin=function(Y,V,I){if(Y===0||Y===I-1)return Y;var G=0;for(var W=0;W<V;W++)G|=(Y&1)<<V-W-1,Y>>=1;return G},x.prototype.permute=function(Y,V,I,G,W,C){for(var D=0;D<C;D++)G[D]=V[Y[D]],W[D]=I[Y[D]]},x.prototype.transform=function(Y,V,I,G,W,C){this.permute(C,Y,V,I,G,W);for(var D=1;D<W;D<<=1){var H=D<<1,J=Math.cos(2*Math.PI/H),O=Math.sin(2*Math.PI/H);for(var P=0;P<W;P+=H){var R=J,_=O;for(var f=0;f<D;f++){var c=I[P+f],o=G[P+f],K0=I[P+f+D],a=G[P+f+D],l=R*K0-_*a;if(a=R*a+_*K0,K0=l,I[P+f]=c+K0,G[P+f]=o+a,I[P+f+D]=c-K0,G[P+f+D]=o-a,f!==H)l=J*R-O*_,_=J*_+O*R,R=l}}}},x.prototype.guessLen13b=function(Y,V){var I=Math.max(V,Y)|1,G=I&1,W=0;for(I=I/2|0;I;I=I>>>1)W++;return 1<<W+1+G},x.prototype.conjugate=function(Y,V,I){if(I<=1)return;for(var G=0;G<I/2;G++){var W=Y[G];Y[G]=Y[I-G-1],Y[I-G-1]=W,W=V[G],V[G]=-V[I-G-1],V[I-G-1]=-W}},x.prototype.normalize13b=function(Y,V){var I=0;for(var G=0;G<V/2;G++){var W=Math.round(Y[2*G+1]/V)*8192+Math.round(Y[2*G]/V)+I;if(Y[G]=W&67108863,W<67108864)I=0;else I=W/67108864|0}return Y},x.prototype.convert13b=function(Y,V,I,G){var W=0;for(var C=0;C<V;C++)W=W+(Y[C]|0),I[2*C]=W&8191,W=W>>>13,I[2*C+1]=W&8191,W=W>>>13;for(C=2*V;C<G;++C)I[C]=0;K(W===0),K((W&-8192)===0)},x.prototype.stub=function(Y){var V=Array(Y);for(var I=0;I<Y;I++)V[I]=0;return V},x.prototype.mulp=function(Y,V,I){var G=2*this.guessLen13b(Y.length,V.length),W=this.makeRBT(G),C=this.stub(G),D=Array(G),H=Array(G),J=Array(G),O=Array(G),P=Array(G),R=Array(G),_=I.words;_.length=G,this.convert13b(Y.words,Y.length,D,G),this.convert13b(V.words,V.length,O,G),this.transform(D,C,H,J,G,W),this.transform(O,C,P,R,G,W);for(var f=0;f<G;f++){var c=H[f]*P[f]-J[f]*R[f];J[f]=H[f]*R[f]+J[f]*P[f],H[f]=c}return this.conjugate(H,J,G),this.transform(H,J,_,C,G,W),this.conjugate(_,C,G),this.normalize13b(_,G),I.negative=Y.negative^V.negative,I.length=Y.length+V.length,I.strip()},$.prototype.mul=function(Y){var V=new $(null);return V.words=Array(this.length+Y.length),this.mulTo(Y,V)},$.prototype.mulf=function(Y){var V=new $(null);return V.words=Array(this.length+Y.length),v(this,Y,V)},$.prototype.imul=function(Y){return this.clone().mulTo(Y,this)},$.prototype.imuln=function(Y){K(typeof Y==="number"),K(Y<67108864);var V=0;for(var I=0;I<this.length;I++){var G=(this.words[I]|0)*Y,W=(G&67108863)+(V&67108863);V>>=26,V+=G/67108864|0,V+=W>>>26,this.words[I]=W&67108863}if(V!==0)this.words[I]=V,this.length++;return this.length=Y===0?1:this.length,this},$.prototype.muln=function(Y){return this.clone().imuln(Y)},$.prototype.sqr=function(){return this.mul(this)},$.prototype.isqr=function(){return this.imul(this.clone())},$.prototype.pow=function(Y){var V=S(Y);if(V.length===0)return new $(1);var I=this;for(var G=0;G<V.length;G++,I=I.sqr())if(V[G]!==0)break;if(++G<V.length)for(var W=I.sqr();G<V.length;G++,W=W.sqr()){if(V[G]===0)continue;I=I.mul(W)}return I},$.prototype.iushln=function(Y){K(typeof Y==="number"&&Y>=0);var V=Y%26,I=(Y-V)/26,G=67108863>>>26-V<<26-V,W;if(V!==0){var C=0;for(W=0;W<this.length;W++){var D=this.words[W]&G,H=(this.words[W]|0)-D<<V;this.words[W]=H|C,C=D>>>26-V}if(C)this.words[W]=C,this.length++}if(I!==0){for(W=this.length-1;W>=0;W--)this.words[W+I]=this.words[W];for(W=0;W<I;W++)this.words[W]=0;this.length+=I}return this.strip()},$.prototype.ishln=function(Y){return K(this.negative===0),this.iushln(Y)},$.prototype.iushrn=function(Y,V,I){K(typeof Y==="number"&&Y>=0);var G;if(V)G=(V-V%26)/26;else G=0;var W=Y%26,C=Math.min((Y-W)/26,this.length),D=67108863^67108863>>>W<<W,H=I;if(G-=C,G=Math.max(0,G),H){for(var J=0;J<C;J++)H.words[J]=this.words[J];H.length=C}if(C===0);else if(this.length>C){this.length-=C;for(J=0;J<this.length;J++)this.words[J]=this.words[J+C]}else this.words[0]=0,this.length=1;var O=0;for(J=this.length-1;J>=0&&(O!==0||J>=G);J--){var P=this.words[J]|0;this.words[J]=O<<26-W|P>>>W,O=P&D}if(H&&O!==0)H.words[H.length++]=O;if(this.length===0)this.words[0]=0,this.length=1;return this.strip()},$.prototype.ishrn=function(Y,V,I){return K(this.negative===0),this.iushrn(Y,V,I)},$.prototype.shln=function(Y){return this.clone().ishln(Y)},$.prototype.ushln=function(Y){return this.clone().iushln(Y)},$.prototype.shrn=function(Y){return this.clone().ishrn(Y)},$.prototype.ushrn=function(Y){return this.clone().iushrn(Y)},$.prototype.testn=function(Y){K(typeof Y==="number"&&Y>=0);var V=Y%26,I=(Y-V)/26,G=1<<V;if(this.length<=I)return!1;var W=this.words[I];return!!(W&G)},$.prototype.imaskn=function(Y){K(typeof Y==="number"&&Y>=0);var V=Y%26,I=(Y-V)/26;if(K(this.negative===0,"imaskn works only with positive numbers"),this.length<=I)return this;if(V!==0)I++;if(this.length=Math.min(I,this.length),V!==0){var G=67108863^67108863>>>V<<V;this.words[this.length-1]&=G}return this.strip()},$.prototype.maskn=function(Y){return this.clone().imaskn(Y)},$.prototype.iaddn=function(Y){if(K(typeof Y==="number"),K(Y<67108864),Y<0)return this.isubn(-Y);if(this.negative!==0){if(this.length===1&&(this.words[0]|0)<Y)return this.words[0]=Y-(this.words[0]|0),this.negative=0,this;return this.negative=0,this.isubn(Y),this.negative=1,this}return this._iaddn(Y)},$.prototype._iaddn=function(Y){this.words[0]+=Y;for(var V=0;V<this.length&&this.words[V]>=67108864;V++)if(this.words[V]-=67108864,V===this.length-1)this.words[V+1]=1;else this.words[V+1]++;return this.length=Math.max(this.length,V+1),this},$.prototype.isubn=function(Y){if(K(typeof Y==="number"),K(Y<67108864),Y<0)return this.iaddn(-Y);if(this.negative!==0)return this.negative=0,this.iaddn(Y),this.negative=1,this;if(this.words[0]-=Y,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var V=0;V<this.length&&this.words[V]<0;V++)this.words[V]+=67108864,this.words[V+1]-=1;return this.strip()},$.prototype.addn=function(Y){return this.clone().iaddn(Y)},$.prototype.subn=function(Y){return this.clone().isubn(Y)},$.prototype.iabs=function(){return this.negative=0,this},$.prototype.abs=function(){return this.clone().iabs()},$.prototype._ishlnsubmul=function(Y,V,I){var G=Y.length+I,W;this._expand(G);var C,D=0;for(W=0;W<Y.length;W++){C=(this.words[W+I]|0)+D;var H=(Y.words[W]|0)*V;C-=H&67108863,D=(C>>26)-(H/67108864|0),this.words[W+I]=C&67108863}for(;W<this.length-I;W++)C=(this.words[W+I]|0)+D,D=C>>26,this.words[W+I]=C&67108863;if(D===0)return this.strip();K(D===-1),D=0;for(W=0;W<this.length;W++)C=-(this.words[W]|0)+D,D=C>>26,this.words[W]=C&67108863;return this.negative=1,this.strip()},$.prototype._wordDiv=function(Y,V){var I=this.length-Y.length,G=this.clone(),W=Y,C=W.words[W.length-1]|0,D=this._countBits(C);if(I=26-D,I!==0)W=W.ushln(I),G.iushln(I),C=W.words[W.length-1]|0;var H=G.length-W.length,J;if(V!=="mod"){J=new $(null),J.length=H+1,J.words=Array(J.length);for(var O=0;O<J.length;O++)J.words[O]=0}var P=G.clone()._ishlnsubmul(W,1,H);if(P.negative===0){if(G=P,J)J.words[H]=1}for(var R=H-1;R>=0;R--){var _=(G.words[W.length+R]|0)*67108864+(G.words[W.length+R-1]|0);_=Math.min(_/C|0,67108863),G._ishlnsubmul(W,_,R);while(G.negative!==0)if(_--,G.negative=0,G._ishlnsubmul(W,1,R),!G.isZero())G.negative^=1;if(J)J.words[R]=_}if(J)J.strip();if(G.strip(),V!=="div"&&I!==0)G.iushrn(I);return{div:J||null,mod:G}},$.prototype.divmod=function(Y,V,I){if(K(!Y.isZero()),this.isZero())return{div:new $(0),mod:new $(0)};var G,W,C;if(this.negative!==0&&Y.negative===0){if(C=this.neg().divmod(Y,V),V!=="mod")G=C.div.neg();if(V!=="div"){if(W=C.mod.neg(),I&&W.negative!==0)W.iadd(Y)}return{div:G,mod:W}}if(this.negative===0&&Y.negative!==0){if(C=this.divmod(Y.neg(),V),V!=="mod")G=C.div.neg();return{div:G,mod:C.mod}}if((this.negative&Y.negative)!==0){if(C=this.neg().divmod(Y.neg(),V),V!=="div"){if(W=C.mod.neg(),I&&W.negative!==0)W.isub(Y)}return{div:C.div,mod:W}}if(Y.length>this.length||this.cmp(Y)<0)return{div:new $(0),mod:this};if(Y.length===1){if(V==="div")return{div:this.divn(Y.words[0]),mod:null};if(V==="mod")return{div:null,mod:new $(this.modn(Y.words[0]))};return{div:this.divn(Y.words[0]),mod:new $(this.modn(Y.words[0]))}}return this._wordDiv(Y,V)},$.prototype.div=function(Y){return this.divmod(Y,"div",!1).div},$.prototype.mod=function(Y){return this.divmod(Y,"mod",!1).mod},$.prototype.umod=function(Y){return this.divmod(Y,"mod",!0).mod},$.prototype.divRound=function(Y){var V=this.divmod(Y);if(V.mod.isZero())return V.div;var I=V.div.negative!==0?V.mod.isub(Y):V.mod,G=Y.ushrn(1),W=Y.andln(1),C=I.cmp(G);if(C<0||W===1&&C===0)return V.div;return V.div.negative!==0?V.div.isubn(1):V.div.iaddn(1)},$.prototype.modn=function(Y){K(Y<=67108863);var V=67108864%Y,I=0;for(var G=this.length-1;G>=0;G--)I=(V*I+(this.words[G]|0))%Y;return I},$.prototype.idivn=function(Y){K(Y<=67108863);var V=0;for(var I=this.length-1;I>=0;I--){var G=(this.words[I]|0)+V*67108864;this.words[I]=G/Y|0,V=G%Y}return this.strip()},$.prototype.divn=function(Y){return this.clone().idivn(Y)},$.prototype.egcd=function(Y){K(Y.negative===0),K(!Y.isZero());var V=this,I=Y.clone();if(V.negative!==0)V=V.umod(Y);else V=V.clone();var G=new $(1),W=new $(0),C=new $(0),D=new $(1),H=0;while(V.isEven()&&I.isEven())V.iushrn(1),I.iushrn(1),++H;var J=I.clone(),O=V.clone();while(!V.isZero()){for(var P=0,R=1;(V.words[0]&R)===0&&P<26;++P,R<<=1);if(P>0){V.iushrn(P);while(P-- >0){if(G.isOdd()||W.isOdd())G.iadd(J),W.isub(O);G.iushrn(1),W.iushrn(1)}}for(var _=0,f=1;(I.words[0]&f)===0&&_<26;++_,f<<=1);if(_>0){I.iushrn(_);while(_-- >0){if(C.isOdd()||D.isOdd())C.iadd(J),D.isub(O);C.iushrn(1),D.iushrn(1)}}if(V.cmp(I)>=0)V.isub(I),G.isub(C),W.isub(D);else I.isub(V),C.isub(G),D.isub(W)}return{a:C,b:D,gcd:I.iushln(H)}},$.prototype._invmp=function(Y){K(Y.negative===0),K(!Y.isZero());var V=this,I=Y.clone();if(V.negative!==0)V=V.umod(Y);else V=V.clone();var G=new $(1),W=new $(0),C=I.clone();while(V.cmpn(1)>0&&I.cmpn(1)>0){for(var D=0,H=1;(V.words[0]&H)===0&&D<26;++D,H<<=1);if(D>0){V.iushrn(D);while(D-- >0){if(G.isOdd())G.iadd(C);G.iushrn(1)}}for(var J=0,O=1;(I.words[0]&O)===0&&J<26;++J,O<<=1);if(J>0){I.iushrn(J);while(J-- >0){if(W.isOdd())W.iadd(C);W.iushrn(1)}}if(V.cmp(I)>=0)V.isub(I),G.isub(W);else I.isub(V),W.isub(G)}var P;if(V.cmpn(1)===0)P=G;else P=W;if(P.cmpn(0)<0)P.iadd(Y);return P},$.prototype.gcd=function(Y){if(this.isZero())return Y.abs();if(Y.isZero())return this.abs();var V=this.clone(),I=Y.clone();V.negative=0,I.negative=0;for(var G=0;V.isEven()&&I.isEven();G++)V.iushrn(1),I.iushrn(1);do{while(V.isEven())V.iushrn(1);while(I.isEven())I.iushrn(1);var W=V.cmp(I);if(W<0){var C=V;V=I,I=C}else if(W===0||I.cmpn(1)===0)break;V.isub(I)}while(!0);return I.iushln(G)},$.prototype.invm=function(Y){return this.egcd(Y).a.umod(Y)},$.prototype.isEven=function(){return(this.words[0]&1)===0},$.prototype.isOdd=function(){return(this.words[0]&1)===1},$.prototype.andln=function(Y){return this.words[0]&Y},$.prototype.bincn=function(Y){K(typeof Y==="number");var V=Y%26,I=(Y-V)/26,G=1<<V;if(this.length<=I)return this._expand(I+1),this.words[I]|=G,this;var W=G;for(var C=I;W!==0&&C<this.length;C++){var D=this.words[C]|0;D+=W,W=D>>>26,D&=67108863,this.words[C]=D}if(W!==0)this.words[C]=W,this.length++;return this},$.prototype.isZero=function(){return this.length===1&&this.words[0]===0},$.prototype.cmpn=function(Y){var V=Y<0;if(this.negative!==0&&!V)return-1;if(this.negative===0&&V)return 1;this.strip();var I;if(this.length>1)I=1;else{if(V)Y=-Y;K(Y<=67108863,"Number is too big");var G=this.words[0]|0;I=G===Y?0:G<Y?-1:1}if(this.negative!==0)return-I|0;return I},$.prototype.cmp=function(Y){if(this.negative!==0&&Y.negative===0)return-1;if(this.negative===0&&Y.negative!==0)return 1;var V=this.ucmp(Y);if(this.negative!==0)return-V|0;return V},$.prototype.ucmp=function(Y){if(this.length>Y.length)return 1;if(this.length<Y.length)return-1;var V=0;for(var I=this.length-1;I>=0;I--){var G=this.words[I]|0,W=Y.words[I]|0;if(G===W)continue;if(G<W)V=-1;else if(G>W)V=1;break}return V},$.prototype.gtn=function(Y){return this.cmpn(Y)===1},$.prototype.gt=function(Y){return this.cmp(Y)===1},$.prototype.gten=function(Y){return this.cmpn(Y)>=0},$.prototype.gte=function(Y){return this.cmp(Y)>=0},$.prototype.ltn=function(Y){return this.cmpn(Y)===-1},$.prototype.lt=function(Y){return this.cmp(Y)===-1},$.prototype.lten=function(Y){return this.cmpn(Y)<=0},$.prototype.lte=function(Y){return this.cmp(Y)<=0},$.prototype.eqn=function(Y){return this.cmpn(Y)===0},$.prototype.eq=function(Y){return this.cmp(Y)===0},$.red=function(Y){return new b(Y)},$.prototype.toRed=function(Y){return K(!this.red,"Already a number in reduction context"),K(this.negative===0,"red works only with positives"),Y.convertTo(this)._forceRed(Y)},$.prototype.fromRed=function(){return K(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},$.prototype._forceRed=function(Y){return this.red=Y,this},$.prototype.forceRed=function(Y){return K(!this.red,"Already a number in reduction context"),this._forceRed(Y)},$.prototype.redAdd=function(Y){return K(this.red,"redAdd works only with red numbers"),this.red.add(this,Y)},$.prototype.redIAdd=function(Y){return K(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,Y)},$.prototype.redSub=function(Y){return K(this.red,"redSub works only with red numbers"),this.red.sub(this,Y)},$.prototype.redISub=function(Y){return K(this.red,"redISub works only with red numbers"),this.red.isub(this,Y)},$.prototype.redShl=function(Y){return K(this.red,"redShl works only with red numbers"),this.red.shl(this,Y)},$.prototype.redMul=function(Y){return K(this.red,"redMul works only with red numbers"),this.red._verify2(this,Y),this.red.mul(this,Y)},$.prototype.redIMul=function(Y){return K(this.red,"redMul works only with red numbers"),this.red._verify2(this,Y),this.red.imul(this,Y)},$.prototype.redSqr=function(){return K(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},$.prototype.redISqr=function(){return K(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},$.prototype.redSqrt=function(){return K(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},$.prototype.redInvm=function(){return K(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},$.prototype.redNeg=function(){return K(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},$.prototype.redPow=function(Y){return K(this.red&&!Y.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,Y)};var N={k256:null,p224:null,p192:null,p25519:null};function w(Y,V){this.name=Y,this.p=new $(V,16),this.n=this.p.bitLength(),this.k=new $(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}w.prototype._tmp=function(){var Y=new $(null);return Y.words=Array(Math.ceil(this.n/13)),Y},w.prototype.ireduce=function(Y){var V=Y,I;do this.split(V,this.tmp),V=this.imulK(V),V=V.iadd(this.tmp),I=V.bitLength();while(I>this.n);var G=I<this.n?-1:V.ucmp(this.p);if(G===0)V.words[0]=0,V.length=1;else if(G>0)V.isub(this.p);else if(V.strip!==void 0)V.strip();else V._strip();return V},w.prototype.split=function(Y,V){Y.iushrn(this.n,0,V)},w.prototype.imulK=function(Y){return Y.imul(this.k)};function u(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}F(u,w),u.prototype.split=function(Y,V){var I=4194303,G=Math.min(Y.length,9);for(var W=0;W<G;W++)V.words[W]=Y.words[W];if(V.length=G,Y.length<=9){Y.words[0]=0,Y.length=1;return}var C=Y.words[9];V.words[V.length++]=C&I;for(W=10;W<Y.length;W++){var D=Y.words[W]|0;Y.words[W-10]=(D&I)<<4|C>>>22,C=D}if(C>>>=22,Y.words[W-10]=C,C===0&&Y.length>10)Y.length-=10;else Y.length-=9},u.prototype.imulK=function(Y){Y.words[Y.length]=0,Y.words[Y.length+1]=0,Y.length+=2;var V=0;for(var I=0;I<Y.length;I++){var G=Y.words[I]|0;V+=G*977,Y.words[I]=V&67108863,V=G*64+(V/67108864|0)}if(Y.words[Y.length-1]===0){if(Y.length--,Y.words[Y.length-1]===0)Y.length--}return Y};function Z0(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}F(Z0,w);function V0(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}F(V0,w);function Y0(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}F(Y0,w),Y0.prototype.imulK=function(Y){var V=0;for(var I=0;I<Y.length;I++){var G=(Y.words[I]|0)*19+V,W=G&67108863;G>>>=26,Y.words[I]=W,V=G}if(V!==0)Y.words[Y.length++]=V;return Y},$._prime=function(Y){if(N[Y])return N[Y];var V;if(Y==="k256")V=new u;else if(Y==="p224")V=new Z0;else if(Y==="p192")V=new V0;else if(Y==="p25519")V=new Y0;else throw Error("Unknown prime "+Y);return N[Y]=V,V};function b(Y){if(typeof Y==="string"){var V=$._prime(Y);this.m=V.p,this.prime=V}else K(Y.gtn(1),"modulus must be greater than 1"),this.m=Y,this.prime=null}b.prototype._verify1=function(Y){K(Y.negative===0,"red works only with positives"),K(Y.red,"red works only with red numbers")},b.prototype._verify2=function(Y,V){K((Y.negative|V.negative)===0,"red works only with positives"),K(Y.red&&Y.red===V.red,"red works only with red numbers")},b.prototype.imod=function(Y){if(this.prime)return this.prime.ireduce(Y)._forceRed(this);return Y.umod(this.m)._forceRed(this)},b.prototype.neg=function(Y){if(Y.isZero())return Y.clone();return this.m.sub(Y)._forceRed(this)},b.prototype.add=function(Y,V){this._verify2(Y,V);var I=Y.add(V);if(I.cmp(this.m)>=0)I.isub(this.m);return I._forceRed(this)},b.prototype.iadd=function(Y,V){this._verify2(Y,V);var I=Y.iadd(V);if(I.cmp(this.m)>=0)I.isub(this.m);return I},b.prototype.sub=function(Y,V){this._verify2(Y,V);var I=Y.sub(V);if(I.cmpn(0)<0)I.iadd(this.m);return I._forceRed(this)},b.prototype.isub=function(Y,V){this._verify2(Y,V);var I=Y.isub(V);if(I.cmpn(0)<0)I.iadd(this.m);return I},b.prototype.shl=function(Y,V){return this._verify1(Y),this.imod(Y.ushln(V))},b.prototype.imul=function(Y,V){return this._verify2(Y,V),this.imod(Y.imul(V))},b.prototype.mul=function(Y,V){return this._verify2(Y,V),this.imod(Y.mul(V))},b.prototype.isqr=function(Y){return this.imul(Y,Y.clone())},b.prototype.sqr=function(Y){return this.mul(Y,Y)},b.prototype.sqrt=function(Y){if(Y.isZero())return Y.clone();var V=this.m.andln(3);if(K(V%2===1),V===3){var I=this.m.add(new $(1)).iushrn(2);return this.pow(Y,I)}var G=this.m.subn(1),W=0;while(!G.isZero()&&G.andln(1)===0)W++,G.iushrn(1);K(!G.isZero());var C=new $(1).toRed(this),D=C.redNeg(),H=this.m.subn(1).iushrn(1),J=this.m.bitLength();J=new $(2*J*J).toRed(this);while(this.pow(J,H).cmp(D)!==0)J.redIAdd(D);var O=this.pow(J,G),P=this.pow(Y,G.addn(1).iushrn(1)),R=this.pow(Y,G),_=W;while(R.cmp(C)!==0){var f=R;for(var c=0;f.cmp(C)!==0;c++)f=f.redSqr();K(c<_);var o=this.pow(O,new $(1).iushln(_-c-1));P=P.redMul(o),O=o.redSqr(),R=R.redMul(O),_=c}return P},b.prototype.invm=function(Y){var V=Y._invmp(this.m);if(V.negative!==0)return V.negative=0,this.imod(V).redNeg();else return this.imod(V)},b.prototype.pow=function(Y,V){if(V.isZero())return new $(1).toRed(this);if(V.cmpn(1)===0)return Y.clone();var I=4,G=Array(1<<I);G[0]=new $(1).toRed(this),G[1]=Y;for(var W=2;W<G.length;W++)G[W]=this.mul(G[W-1],Y);var C=G[0],D=0,H=0,J=V.bitLength()%26;if(J===0)J=26;for(W=V.length-1;W>=0;W--){var O=V.words[W];for(var P=J-1;P>=0;P--){var R=O>>P&1;if(C!==G[0])C=this.sqr(C);if(R===0&&D===0){H=0;continue}if(D<<=1,D|=R,H++,H!==I&&(W!==0||P!==0))continue;C=this.mul(C,G[D]),H=0,D=0}J=26}return C},b.prototype.convertTo=function(Y){var V=Y.umod(this.m);return V===Y?V.clone():V},b.prototype.convertFrom=function(Y){var V=Y.clone();return V.red=null,V},$.mont=function(Y){return new i(Y)};function i(Y){if(b.call(this,Y),this.shift=this.m.bitLength(),this.shift%26!==0)this.shift+=26-this.shift%26;this.r=new $(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}F(i,b),i.prototype.convertTo=function(Y){return this.imod(Y.ushln(this.shift))},i.prototype.convertFrom=function(Y){var V=this.imod(Y.mul(this.rinv));return V.red=null,V},i.prototype.imul=function(Y,V){if(Y.isZero()||V.isZero())return Y.words[0]=0,Y.length=1,Y;var I=Y.imul(V),G=I.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),W=I.isub(G).iushrn(this.shift),C=W;if(W.cmp(this.m)>=0)C=W.isub(this.m);else if(W.cmpn(0)<0)C=W.iadd(this.m);return C._forceRed(this)},i.prototype.mul=function(Y,V){if(Y.isZero()||V.isZero())return new $(0)._forceRed(this);var I=Y.mul(V),G=I.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),W=I.isub(G).iushrn(this.shift),C=W;if(W.cmp(this.m)>=0)C=W.isub(this.m);else if(W.cmpn(0)<0)C=W.iadd(this.m);return C._forceRed(this)},i.prototype.invm=function(Y){var V=this.imod(Y._invmp(this.m).mul(this.r2));return V._forceRed(this)}})(typeof Z>"u"||Z,U)}),wF=$0((U,Z)=>{var X=gF(),Q=fF();Z.exports=function(q){return new F(q)};var K={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};K.p224=K.secp224r1,K.p256=K.secp256r1=K.prime256v1,K.p192=K.secp192r1=K.prime192v1,K.p384=K.secp384r1,K.p521=K.secp521r1;function F(q){if(this.curveType=K[q],!this.curveType)this.curveType={name:q};this.curve=new X.ec(this.curveType.name),this.keys=void 0}F.prototype.generateKeys=function(q,M){return this.keys=this.curve.genKeyPair(),this.getPublicKey(q,M)},F.prototype.computeSecret=function(q,M,z){if(M=M||"utf8",!Buffer.isBuffer(q))q=new Buffer(q,M);var T=this.curve.keyFromPublic(q).getPublic(),A=T.mul(this.keys.getPrivate()).getX();return $(A,z,this.curveType.byteLength)},F.prototype.getPublicKey=function(q,M){var z=this.keys.getPublic(M==="compressed",!0);if(M==="hybrid")if(z[z.length-1]%2)z[0]=7;else z[0]=6;return $(z,q)},F.prototype.getPrivateKey=function(q){return $(this.keys.getPrivate(),q)},F.prototype.setPublicKey=function(q,M){if(M=M||"utf8",!Buffer.isBuffer(q))q=new Buffer(q,M);return this.keys._importPublic(q),this},F.prototype.setPrivateKey=function(q,M){if(M=M||"utf8",!Buffer.isBuffer(q))q=new Buffer(q,M);var z=new Q(q);return z=z.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(z),this};function $(q,M,z){if(!Array.isArray(q))q=q.toArray();var T=new Buffer(q);if(z&&T.length<z){var A=new Buffer(z-T.length);A.fill(0),T=Buffer.concat([A,T])}if(!M)return T;else return T.toString(M)}}),yF=$0((U,Z)=>{var X=(UU(),m0(e1)).createECDH;Z.exports=X||wF()}),cF=$0((U,Z)=>{(function(X,Q){function K(Y,V){if(!Y)throw Error(V||"Assertion failed")}function F(Y,V){Y.super_=V;var I=function(){};I.prototype=V.prototype,Y.prototype=new I,Y.prototype.constructor=Y}function $(Y,V,I){if($.isBN(Y))return Y;if(this.negative=0,this.words=null,this.length=0,this.red=null,Y!==null){if(V==="le"||V==="be")I=V,V=10;this._init(Y||0,V||10,I||"be")}}if(typeof X==="object")X.exports=$;else Q.BN=$;$.BN=$,$.wordSize=26;var q;try{if(typeof window<"u"&&typeof window.Buffer<"u")q=window.Buffer;else q=(g1(),m0(N1)).Buffer}catch(Y){}$.isBN=function(Y){if(Y instanceof $)return!0;return Y!==null&&typeof Y==="object"&&Y.constructor.wordSize===$.wordSize&&Array.isArray(Y.words)},$.max=function(Y,V){if(Y.cmp(V)>0)return Y;return V},$.min=function(Y,V){if(Y.cmp(V)<0)return Y;return V},$.prototype._init=function(Y,V,I){if(typeof Y==="number")return this._initNumber(Y,V,I);if(typeof Y==="object")return this._initArray(Y,V,I);if(V==="hex")V=16;K(V===(V|0)&&V>=2&&V<=36),Y=Y.toString().replace(/\s+/g,"");var G=0;if(Y[0]==="-")G++,this.negative=1;if(G<Y.length){if(V===16)this._parseHex(Y,G,I);else if(this._parseBase(Y,V,G),I==="le")this._initArray(this.toArray(),V,I)}},$.prototype._initNumber=function(Y,V,I){if(Y<0)this.negative=1,Y=-Y;if(Y<67108864)this.words=[Y&67108863],this.length=1;else if(Y<4503599627370496)this.words=[Y&67108863,Y/67108864&67108863],this.length=2;else K(Y<9007199254740992),this.words=[Y&67108863,Y/67108864&67108863,1],this.length=3;if(I!=="le")return;this._initArray(this.toArray(),V,I)},$.prototype._initArray=function(Y,V,I){if(K(typeof Y.length==="number"),Y.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(Y.length/3),this.words=Array(this.length);for(var G=0;G<this.length;G++)this.words[G]=0;var W,C,D=0;if(I==="be"){for(G=Y.length-1,W=0;G>=0;G-=3)if(C=Y[G]|Y[G-1]<<8|Y[G-2]<<16,this.words[W]|=C<<D&67108863,this.words[W+1]=C>>>26-D&67108863,D+=24,D>=26)D-=26,W++}else if(I==="le"){for(G=0,W=0;G<Y.length;G+=3)if(C=Y[G]|Y[G+1]<<8|Y[G+2]<<16,this.words[W]|=C<<D&67108863,this.words[W+1]=C>>>26-D&67108863,D+=24,D>=26)D-=26,W++}return this.strip()};function M(Y,V){var I=Y.charCodeAt(V);if(I>=65&&I<=70)return I-55;else if(I>=97&&I<=102)return I-87;else return I-48&15}function z(Y,V,I){var G=M(Y,I);if(I-1>=V)G|=M(Y,I-1)<<4;return G}$.prototype._parseHex=function(Y,V,I){this.length=Math.ceil((Y.length-V)/6),this.words=Array(this.length);for(var G=0;G<this.length;G++)this.words[G]=0;var W=0,C=0,D;if(I==="be")for(G=Y.length-1;G>=V;G-=2)if(D=z(Y,V,G)<<W,this.words[C]|=D&67108863,W>=18)W-=18,C+=1,this.words[C]|=D>>>26;else W+=8;else{var H=Y.length-V;for(G=H%2===0?V+1:V;G<Y.length;G+=2)if(D=z(Y,V,G)<<W,this.words[C]|=D&67108863,W>=18)W-=18,C+=1,this.words[C]|=D>>>26;else W+=8}this.strip()};function T(Y,V,I,G){var W=0,C=Math.min(Y.length,I);for(var D=V;D<C;D++){var H=Y.charCodeAt(D)-48;if(W*=G,H>=49)W+=H-49+10;else if(H>=17)W+=H-17+10;else W+=H}return W}$.prototype._parseBase=function(Y,V,I){this.words=[0],this.length=1;for(var G=0,W=1;W<=67108863;W*=V)G++;G--,W=W/V|0;var C=Y.length-I,D=C%G,H=Math.min(C,C-D)+I,J=0;for(var O=I;O<H;O+=G)if(J=T(Y,O,O+G,V),this.imuln(W),this.words[0]+J<67108864)this.words[0]+=J;else this._iaddn(J);if(D!==0){var P=1;J=T(Y,O,Y.length,V);for(O=0;O<D;O++)P*=V;if(this.imuln(P),this.words[0]+J<67108864)this.words[0]+=J;else this._iaddn(J)}this.strip()},$.prototype.copy=function(Y){Y.words=Array(this.length);for(var V=0;V<this.length;V++)Y.words[V]=this.words[V];Y.length=this.length,Y.negative=this.negative,Y.red=this.red},$.prototype.clone=function(){var Y=new $(null);return this.copy(Y),Y},$.prototype._expand=function(Y){while(this.length<Y)this.words[this.length++]=0;return this},$.prototype.strip=function(){while(this.length>1&&this.words[this.length-1]===0)this.length--;return this._normSign()},$.prototype._normSign=function(){if(this.length===1&&this.words[0]===0)this.negative=0;return this},$.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var A=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],L=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],E=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64000000,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,24300000,28629151,33554432,39135393,45435424,52521875,60466176];if($.prototype.toString=function(Y,V){Y=Y||10,V=V|0||1;var I;if(Y===16||Y==="hex"){I="";var G=0,W=0;for(var C=0;C<this.length;C++){var D=this.words[C],H=((D<<G|W)&16777215).toString(16);if(W=D>>>24-G&16777215,G+=2,G>=26)G-=26,C--;if(W!==0||C!==this.length-1)I=A[6-H.length]+H+I;else I=H+I}if(W!==0)I=W.toString(16)+I;while(I.length%V!==0)I="0"+I;if(this.negative!==0)I="-"+I;return I}if(Y===(Y|0)&&Y>=2&&Y<=36){var J=L[Y],O=E[Y];I="";var P=this.clone();P.negative=0;while(!P.isZero()){var R=P.modn(O).toString(Y);if(P=P.idivn(O),!P.isZero())I=A[J-R.length]+R+I;else I=R+I}if(this.isZero())I="0"+I;while(I.length%V!==0)I="0"+I;if(this.negative!==0)I="-"+I;return I}K(!1,"Base should be between 2 and 36")},$.prototype.toNumber=function(){var Y=this.words[0];if(this.length===2)Y+=this.words[1]*67108864;else if(this.length===3&&this.words[2]===1)Y+=4503599627370496+this.words[1]*67108864;else if(this.length>2)K(!1,"Number can only safely store up to 53 bits");return this.negative!==0?-Y:Y},$.prototype.toJSON=function(){return this.toString(16)},$.prototype.toBuffer=function(Y,V){return K(typeof q<"u"),this.toArrayLike(q,Y,V)},$.prototype.toArray=function(Y,V){return this.toArrayLike(Array,Y,V)},$.prototype.toArrayLike=function(Y,V,I){var G=this.byteLength(),W=I||Math.max(1,G);K(G<=W,"byte array longer than desired length"),K(W>0,"Requested array length <= 0"),this.strip();var C=V==="le",D=new Y(W),H,J,O=this.clone();if(!C){for(J=0;J<W-G;J++)D[J]=0;for(J=0;!O.isZero();J++)H=O.andln(255),O.iushrn(8),D[W-J-1]=H}else{for(J=0;!O.isZero();J++)H=O.andln(255),O.iushrn(8),D[J]=H;for(;J<W;J++)D[J]=0}return D},Math.clz32)$.prototype._countBits=function(Y){return 32-Math.clz32(Y)};else $.prototype._countBits=function(Y){var V=Y,I=0;if(V>=4096)I+=13,V>>>=13;if(V>=64)I+=7,V>>>=7;if(V>=8)I+=4,V>>>=4;if(V>=2)I+=2,V>>>=2;return I+V};$.prototype._zeroBits=function(Y){if(Y===0)return 26;var V=Y,I=0;if((V&8191)===0)I+=13,V>>>=13;if((V&127)===0)I+=7,V>>>=7;if((V&15)===0)I+=4,V>>>=4;if((V&3)===0)I+=2,V>>>=2;if((V&1)===0)I++;return I},$.prototype.bitLength=function(){var Y=this.words[this.length-1],V=this._countBits(Y);return(this.length-1)*26+V};function S(Y){var V=Array(Y.bitLength());for(var I=0;I<V.length;I++){var G=I/26|0,W=I%26;V[I]=(Y.words[G]&1<<W)>>>W}return V}$.prototype.zeroBits=function(){if(this.isZero())return 0;var Y=0;for(var V=0;V<this.length;V++){var I=this._zeroBits(this.words[V]);if(Y+=I,I!==26)break}return Y},$.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},$.prototype.toTwos=function(Y){if(this.negative!==0)return this.abs().inotn(Y).iaddn(1);return this.clone()},$.prototype.fromTwos=function(Y){if(this.testn(Y-1))return this.notn(Y).iaddn(1).ineg();return this.clone()},$.prototype.isNeg=function(){return this.negative!==0},$.prototype.neg=function(){return this.clone().ineg()},$.prototype.ineg=function(){if(!this.isZero())this.negative^=1;return this},$.prototype.iuor=function(Y){while(this.length<Y.length)this.words[this.length++]=0;for(var V=0;V<Y.length;V++)this.words[V]=this.words[V]|Y.words[V];return this.strip()},$.prototype.ior=function(Y){return K((this.negative|Y.negative)===0),this.iuor(Y)},$.prototype.or=function(Y){if(this.length>Y.length)return this.clone().ior(Y);return Y.clone().ior(this)},$.prototype.uor=function(Y){if(this.length>Y.length)return this.clone().iuor(Y);return Y.clone().iuor(this)},$.prototype.iuand=function(Y){var V;if(this.length>Y.length)V=Y;else V=this;for(var I=0;I<V.length;I++)this.words[I]=this.words[I]&Y.words[I];return this.length=V.length,this.strip()},$.prototype.iand=function(Y){return K((this.negative|Y.negative)===0),this.iuand(Y)},$.prototype.and=function(Y){if(this.length>Y.length)return this.clone().iand(Y);return Y.clone().iand(this)},$.prototype.uand=function(Y){if(this.length>Y.length)return this.clone().iuand(Y);return Y.clone().iuand(this)},$.prototype.iuxor=function(Y){var V,I;if(this.length>Y.length)V=this,I=Y;else V=Y,I=this;for(var G=0;G<I.length;G++)this.words[G]=V.words[G]^I.words[G];if(this!==V)for(;G<V.length;G++)this.words[G]=V.words[G];return this.length=V.length,this.strip()},$.prototype.ixor=function(Y){return K((this.negative|Y.negative)===0),this.iuxor(Y)},$.prototype.xor=function(Y){if(this.length>Y.length)return this.clone().ixor(Y);return Y.clone().ixor(this)},$.prototype.uxor=function(Y){if(this.length>Y.length)return this.clone().iuxor(Y);return Y.clone().iuxor(this)},$.prototype.inotn=function(Y){K(typeof Y==="number"&&Y>=0);var V=Math.ceil(Y/26)|0,I=Y%26;if(this._expand(V),I>0)V--;for(var G=0;G<V;G++)this.words[G]=~this.words[G]&67108863;if(I>0)this.words[G]=~this.words[G]&67108863>>26-I;return this.strip()},$.prototype.notn=function(Y){return this.clone().inotn(Y)},$.prototype.setn=function(Y,V){K(typeof Y==="number"&&Y>=0);var I=Y/26|0,G=Y%26;if(this._expand(I+1),V)this.words[I]=this.words[I]|1<<G;else this.words[I]=this.words[I]&~(1<<G);return this.strip()},$.prototype.iadd=function(Y){var V;if(this.negative!==0&&Y.negative===0)return this.negative=0,V=this.isub(Y),this.negative^=1,this._normSign();else if(this.negative===0&&Y.negative!==0)return Y.negative=0,V=this.isub(Y),Y.negative=1,V._normSign();var I,G;if(this.length>Y.length)I=this,G=Y;else I=Y,G=this;var W=0;for(var C=0;C<G.length;C++)V=(I.words[C]|0)+(G.words[C]|0)+W,this.words[C]=V&67108863,W=V>>>26;for(;W!==0&&C<I.length;C++)V=(I.words[C]|0)+W,this.words[C]=V&67108863,W=V>>>26;if(this.length=I.length,W!==0)this.words[this.length]=W,this.length++;else if(I!==this)for(;C<I.length;C++)this.words[C]=I.words[C];return this},$.prototype.add=function(Y){var V;if(Y.negative!==0&&this.negative===0)return Y.negative=0,V=this.sub(Y),Y.negative^=1,V;else if(Y.negative===0&&this.negative!==0)return this.negative=0,V=Y.sub(this),this.negative=1,V;if(this.length>Y.length)return this.clone().iadd(Y);return Y.clone().iadd(this)},$.prototype.isub=function(Y){if(Y.negative!==0){Y.negative=0;var V=this.iadd(Y);return Y.negative=1,V._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(Y),this.negative=1,this._normSign();var I=this.cmp(Y);if(I===0)return this.negative=0,this.length=1,this.words[0]=0,this;var G,W;if(I>0)G=this,W=Y;else G=Y,W=this;var C=0;for(var D=0;D<W.length;D++)V=(G.words[D]|0)-(W.words[D]|0)+C,C=V>>26,this.words[D]=V&67108863;for(;C!==0&&D<G.length;D++)V=(G.words[D]|0)+C,C=V>>26,this.words[D]=V&67108863;if(C===0&&D<G.length&&G!==this)for(;D<G.length;D++)this.words[D]=G.words[D];if(this.length=Math.max(this.length,D),G!==this)this.negative=1;return this.strip()},$.prototype.sub=function(Y){return this.clone().isub(Y)};function j(Y,V,I){I.negative=V.negative^Y.negative;var G=Y.length+V.length|0;I.length=G,G=G-1|0;var W=Y.words[0]|0,C=V.words[0]|0,D=W*C,H=D&67108863,J=D/67108864|0;I.words[0]=H;for(var O=1;O<G;O++){var P=J>>>26,R=J&67108863,_=Math.min(O,V.length-1);for(var f=Math.max(0,O-Y.length+1);f<=_;f++){var c=O-f|0;W=Y.words[c]|0,C=V.words[f]|0,D=W*C+R,P+=D/67108864|0,R=D&67108863}I.words[O]=R|0,J=P|0}if(J!==0)I.words[O]=J|0;else I.length--;return I.strip()}var k=function(Y,V,I){var G=Y.words,W=V.words,C=I.words,D=0,H,J,O,P=G[0]|0,R=P&8191,_=P>>>13,f=G[1]|0,c=f&8191,o=f>>>13,K0=G[2]|0,a=K0&8191,l=K0>>>13,Q0=G[3]|0,n=Q0&8191,s=Q0>>>13,f0=G[4]|0,y=f0&8191,h=f0>>>13,G0=G[5]|0,t=G0&8191,U0=G0>>>13,L0=G[6]|0,p=L0&8191,m=L0>>>13,g0=G[7]|0,r=g0&8191,J0=g0>>>13,h0=G[8]|0,H0=h0&8191,O0=h0>>>13,J1=G[9]|0,I0=J1&8191,C0=J1>>>13,K1=W[0]|0,q0=K1&8191,z0=K1>>>13,d1=W[1]|0,T0=d1&8191,j0=d1>>>13,l1=W[2]|0,v0=l1&8191,R0=l1>>>13,h1=W[3]|0,_0=h1&8191,E0=h1>>>13,_1=W[4]|0,B0=_1&8191,x0=_1>>>13,B1=W[5]|0,S0=B1&8191,g=B1>>>13,d=W[6]|0,e=d&8191,X0=d>>>13,y0=W[7]|0,F0=y0&8191,A0=y0>>>13,Q1=W[8]|0,P0=Q1&8191,N0=Q1>>>13,u1=W[9]|0,k0=u1&8191,M0=u1>>>13;I.negative=Y.negative^V.negative,I.length=19,H=Math.imul(R,q0),J=Math.imul(R,z0),J=J+Math.imul(_,q0)|0,O=Math.imul(_,z0);var G1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(G1>>>26)|0,G1&=67108863,H=Math.imul(c,q0),J=Math.imul(c,z0),J=J+Math.imul(o,q0)|0,O=Math.imul(o,z0),H=H+Math.imul(R,T0)|0,J=J+Math.imul(R,j0)|0,J=J+Math.imul(_,T0)|0,O=O+Math.imul(_,j0)|0;var l0=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(l0>>>26)|0,l0&=67108863,H=Math.imul(a,q0),J=Math.imul(a,z0),J=J+Math.imul(l,q0)|0,O=Math.imul(l,z0),H=H+Math.imul(c,T0)|0,J=J+Math.imul(c,j0)|0,J=J+Math.imul(o,T0)|0,O=O+Math.imul(o,j0)|0,H=H+Math.imul(R,v0)|0,J=J+Math.imul(R,R0)|0,J=J+Math.imul(_,v0)|0,O=O+Math.imul(_,R0)|0;var b0=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(b0>>>26)|0,b0&=67108863,H=Math.imul(n,q0),J=Math.imul(n,z0),J=J+Math.imul(s,q0)|0,O=Math.imul(s,z0),H=H+Math.imul(a,T0)|0,J=J+Math.imul(a,j0)|0,J=J+Math.imul(l,T0)|0,O=O+Math.imul(l,j0)|0,H=H+Math.imul(c,v0)|0,J=J+Math.imul(c,R0)|0,J=J+Math.imul(o,v0)|0,O=O+Math.imul(o,R0)|0,H=H+Math.imul(R,_0)|0,J=J+Math.imul(R,E0)|0,J=J+Math.imul(_,_0)|0,O=O+Math.imul(_,E0)|0;var t0=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(t0>>>26)|0,t0&=67108863,H=Math.imul(y,q0),J=Math.imul(y,z0),J=J+Math.imul(h,q0)|0,O=Math.imul(h,z0),H=H+Math.imul(n,T0)|0,J=J+Math.imul(n,j0)|0,J=J+Math.imul(s,T0)|0,O=O+Math.imul(s,j0)|0,H=H+Math.imul(a,v0)|0,J=J+Math.imul(a,R0)|0,J=J+Math.imul(l,v0)|0,O=O+Math.imul(l,R0)|0,H=H+Math.imul(c,_0)|0,J=J+Math.imul(c,E0)|0,J=J+Math.imul(o,_0)|0,O=O+Math.imul(o,E0)|0,H=H+Math.imul(R,B0)|0,J=J+Math.imul(R,x0)|0,J=J+Math.imul(_,B0)|0,O=O+Math.imul(_,x0)|0;var r0=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(r0>>>26)|0,r0&=67108863,H=Math.imul(t,q0),J=Math.imul(t,z0),J=J+Math.imul(U0,q0)|0,O=Math.imul(U0,z0),H=H+Math.imul(y,T0)|0,J=J+Math.imul(y,j0)|0,J=J+Math.imul(h,T0)|0,O=O+Math.imul(h,j0)|0,H=H+Math.imul(n,v0)|0,J=J+Math.imul(n,R0)|0,J=J+Math.imul(s,v0)|0,O=O+Math.imul(s,R0)|0,H=H+Math.imul(a,_0)|0,J=J+Math.imul(a,E0)|0,J=J+Math.imul(l,_0)|0,O=O+Math.imul(l,E0)|0,H=H+Math.imul(c,B0)|0,J=J+Math.imul(c,x0)|0,J=J+Math.imul(o,B0)|0,O=O+Math.imul(o,x0)|0,H=H+Math.imul(R,S0)|0,J=J+Math.imul(R,g)|0,J=J+Math.imul(_,S0)|0,O=O+Math.imul(_,g)|0;var H1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(H1>>>26)|0,H1&=67108863,H=Math.imul(p,q0),J=Math.imul(p,z0),J=J+Math.imul(m,q0)|0,O=Math.imul(m,z0),H=H+Math.imul(t,T0)|0,J=J+Math.imul(t,j0)|0,J=J+Math.imul(U0,T0)|0,O=O+Math.imul(U0,j0)|0,H=H+Math.imul(y,v0)|0,J=J+Math.imul(y,R0)|0,J=J+Math.imul(h,v0)|0,O=O+Math.imul(h,R0)|0,H=H+Math.imul(n,_0)|0,J=J+Math.imul(n,E0)|0,J=J+Math.imul(s,_0)|0,O=O+Math.imul(s,E0)|0,H=H+Math.imul(a,B0)|0,J=J+Math.imul(a,x0)|0,J=J+Math.imul(l,B0)|0,O=O+Math.imul(l,x0)|0,H=H+Math.imul(c,S0)|0,J=J+Math.imul(c,g)|0,J=J+Math.imul(o,S0)|0,O=O+Math.imul(o,g)|0,H=H+Math.imul(R,e)|0,J=J+Math.imul(R,X0)|0,J=J+Math.imul(_,e)|0,O=O+Math.imul(_,X0)|0;var O1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(O1>>>26)|0,O1&=67108863,H=Math.imul(r,q0),J=Math.imul(r,z0),J=J+Math.imul(J0,q0)|0,O=Math.imul(J0,z0),H=H+Math.imul(p,T0)|0,J=J+Math.imul(p,j0)|0,J=J+Math.imul(m,T0)|0,O=O+Math.imul(m,j0)|0,H=H+Math.imul(t,v0)|0,J=J+Math.imul(t,R0)|0,J=J+Math.imul(U0,v0)|0,O=O+Math.imul(U0,R0)|0,H=H+Math.imul(y,_0)|0,J=J+Math.imul(y,E0)|0,J=J+Math.imul(h,_0)|0,O=O+Math.imul(h,E0)|0,H=H+Math.imul(n,B0)|0,J=J+Math.imul(n,x0)|0,J=J+Math.imul(s,B0)|0,O=O+Math.imul(s,x0)|0,H=H+Math.imul(a,S0)|0,J=J+Math.imul(a,g)|0,J=J+Math.imul(l,S0)|0,O=O+Math.imul(l,g)|0,H=H+Math.imul(c,e)|0,J=J+Math.imul(c,X0)|0,J=J+Math.imul(o,e)|0,O=O+Math.imul(o,X0)|0,H=H+Math.imul(R,F0)|0,J=J+Math.imul(R,A0)|0,J=J+Math.imul(_,F0)|0,O=O+Math.imul(_,A0)|0;var C1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(C1>>>26)|0,C1&=67108863,H=Math.imul(H0,q0),J=Math.imul(H0,z0),J=J+Math.imul(O0,q0)|0,O=Math.imul(O0,z0),H=H+Math.imul(r,T0)|0,J=J+Math.imul(r,j0)|0,J=J+Math.imul(J0,T0)|0,O=O+Math.imul(J0,j0)|0,H=H+Math.imul(p,v0)|0,J=J+Math.imul(p,R0)|0,J=J+Math.imul(m,v0)|0,O=O+Math.imul(m,R0)|0,H=H+Math.imul(t,_0)|0,J=J+Math.imul(t,E0)|0,J=J+Math.imul(U0,_0)|0,O=O+Math.imul(U0,E0)|0,H=H+Math.imul(y,B0)|0,J=J+Math.imul(y,x0)|0,J=J+Math.imul(h,B0)|0,O=O+Math.imul(h,x0)|0,H=H+Math.imul(n,S0)|0,J=J+Math.imul(n,g)|0,J=J+Math.imul(s,S0)|0,O=O+Math.imul(s,g)|0,H=H+Math.imul(a,e)|0,J=J+Math.imul(a,X0)|0,J=J+Math.imul(l,e)|0,O=O+Math.imul(l,X0)|0,H=H+Math.imul(c,F0)|0,J=J+Math.imul(c,A0)|0,J=J+Math.imul(o,F0)|0,O=O+Math.imul(o,A0)|0,H=H+Math.imul(R,P0)|0,J=J+Math.imul(R,N0)|0,J=J+Math.imul(_,P0)|0,O=O+Math.imul(_,N0)|0;var A1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(A1>>>26)|0,A1&=67108863,H=Math.imul(I0,q0),J=Math.imul(I0,z0),J=J+Math.imul(C0,q0)|0,O=Math.imul(C0,z0),H=H+Math.imul(H0,T0)|0,J=J+Math.imul(H0,j0)|0,J=J+Math.imul(O0,T0)|0,O=O+Math.imul(O0,j0)|0,H=H+Math.imul(r,v0)|0,J=J+Math.imul(r,R0)|0,J=J+Math.imul(J0,v0)|0,O=O+Math.imul(J0,R0)|0,H=H+Math.imul(p,_0)|0,J=J+Math.imul(p,E0)|0,J=J+Math.imul(m,_0)|0,O=O+Math.imul(m,E0)|0,H=H+Math.imul(t,B0)|0,J=J+Math.imul(t,x0)|0,J=J+Math.imul(U0,B0)|0,O=O+Math.imul(U0,x0)|0,H=H+Math.imul(y,S0)|0,J=J+Math.imul(y,g)|0,J=J+Math.imul(h,S0)|0,O=O+Math.imul(h,g)|0,H=H+Math.imul(n,e)|0,J=J+Math.imul(n,X0)|0,J=J+Math.imul(s,e)|0,O=O+Math.imul(s,X0)|0,H=H+Math.imul(a,F0)|0,J=J+Math.imul(a,A0)|0,J=J+Math.imul(l,F0)|0,O=O+Math.imul(l,A0)|0,H=H+Math.imul(c,P0)|0,J=J+Math.imul(c,N0)|0,J=J+Math.imul(o,P0)|0,O=O+Math.imul(o,N0)|0,H=H+Math.imul(R,k0)|0,J=J+Math.imul(R,M0)|0,J=J+Math.imul(_,k0)|0,O=O+Math.imul(_,M0)|0;var z1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(z1>>>26)|0,z1&=67108863,H=Math.imul(I0,T0),J=Math.imul(I0,j0),J=J+Math.imul(C0,T0)|0,O=Math.imul(C0,j0),H=H+Math.imul(H0,v0)|0,J=J+Math.imul(H0,R0)|0,J=J+Math.imul(O0,v0)|0,O=O+Math.imul(O0,R0)|0,H=H+Math.imul(r,_0)|0,J=J+Math.imul(r,E0)|0,J=J+Math.imul(J0,_0)|0,O=O+Math.imul(J0,E0)|0,H=H+Math.imul(p,B0)|0,J=J+Math.imul(p,x0)|0,J=J+Math.imul(m,B0)|0,O=O+Math.imul(m,x0)|0,H=H+Math.imul(t,S0)|0,J=J+Math.imul(t,g)|0,J=J+Math.imul(U0,S0)|0,O=O+Math.imul(U0,g)|0,H=H+Math.imul(y,e)|0,J=J+Math.imul(y,X0)|0,J=J+Math.imul(h,e)|0,O=O+Math.imul(h,X0)|0,H=H+Math.imul(n,F0)|0,J=J+Math.imul(n,A0)|0,J=J+Math.imul(s,F0)|0,O=O+Math.imul(s,A0)|0,H=H+Math.imul(a,P0)|0,J=J+Math.imul(a,N0)|0,J=J+Math.imul(l,P0)|0,O=O+Math.imul(l,N0)|0,H=H+Math.imul(c,k0)|0,J=J+Math.imul(c,M0)|0,J=J+Math.imul(o,k0)|0,O=O+Math.imul(o,M0)|0;var D1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(D1>>>26)|0,D1&=67108863,H=Math.imul(I0,v0),J=Math.imul(I0,R0),J=J+Math.imul(C0,v0)|0,O=Math.imul(C0,R0),H=H+Math.imul(H0,_0)|0,J=J+Math.imul(H0,E0)|0,J=J+Math.imul(O0,_0)|0,O=O+Math.imul(O0,E0)|0,H=H+Math.imul(r,B0)|0,J=J+Math.imul(r,x0)|0,J=J+Math.imul(J0,B0)|0,O=O+Math.imul(J0,x0)|0,H=H+Math.imul(p,S0)|0,J=J+Math.imul(p,g)|0,J=J+Math.imul(m,S0)|0,O=O+Math.imul(m,g)|0,H=H+Math.imul(t,e)|0,J=J+Math.imul(t,X0)|0,J=J+Math.imul(U0,e)|0,O=O+Math.imul(U0,X0)|0,H=H+Math.imul(y,F0)|0,J=J+Math.imul(y,A0)|0,J=J+Math.imul(h,F0)|0,O=O+Math.imul(h,A0)|0,H=H+Math.imul(n,P0)|0,J=J+Math.imul(n,N0)|0,J=J+Math.imul(s,P0)|0,O=O+Math.imul(s,N0)|0,H=H+Math.imul(a,k0)|0,J=J+Math.imul(a,M0)|0,J=J+Math.imul(l,k0)|0,O=O+Math.imul(l,M0)|0;var q1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(q1>>>26)|0,q1&=67108863,H=Math.imul(I0,_0),J=Math.imul(I0,E0),J=J+Math.imul(C0,_0)|0,O=Math.imul(C0,E0),H=H+Math.imul(H0,B0)|0,J=J+Math.imul(H0,x0)|0,J=J+Math.imul(O0,B0)|0,O=O+Math.imul(O0,x0)|0,H=H+Math.imul(r,S0)|0,J=J+Math.imul(r,g)|0,J=J+Math.imul(J0,S0)|0,O=O+Math.imul(J0,g)|0,H=H+Math.imul(p,e)|0,J=J+Math.imul(p,X0)|0,J=J+Math.imul(m,e)|0,O=O+Math.imul(m,X0)|0,H=H+Math.imul(t,F0)|0,J=J+Math.imul(t,A0)|0,J=J+Math.imul(U0,F0)|0,O=O+Math.imul(U0,A0)|0,H=H+Math.imul(y,P0)|0,J=J+Math.imul(y,N0)|0,J=J+Math.imul(h,P0)|0,O=O+Math.imul(h,N0)|0,H=H+Math.imul(n,k0)|0,J=J+Math.imul(n,M0)|0,J=J+Math.imul(s,k0)|0,O=O+Math.imul(s,M0)|0;var M1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(M1>>>26)|0,M1&=67108863,H=Math.imul(I0,B0),J=Math.imul(I0,x0),J=J+Math.imul(C0,B0)|0,O=Math.imul(C0,x0),H=H+Math.imul(H0,S0)|0,J=J+Math.imul(H0,g)|0,J=J+Math.imul(O0,S0)|0,O=O+Math.imul(O0,g)|0,H=H+Math.imul(r,e)|0,J=J+Math.imul(r,X0)|0,J=J+Math.imul(J0,e)|0,O=O+Math.imul(J0,X0)|0,H=H+Math.imul(p,F0)|0,J=J+Math.imul(p,A0)|0,J=J+Math.imul(m,F0)|0,O=O+Math.imul(m,A0)|0,H=H+Math.imul(t,P0)|0,J=J+Math.imul(t,N0)|0,J=J+Math.imul(U0,P0)|0,O=O+Math.imul(U0,N0)|0,H=H+Math.imul(y,k0)|0,J=J+Math.imul(y,M0)|0,J=J+Math.imul(h,k0)|0,O=O+Math.imul(h,M0)|0;var L1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(L1>>>26)|0,L1&=67108863,H=Math.imul(I0,S0),J=Math.imul(I0,g),J=J+Math.imul(C0,S0)|0,O=Math.imul(C0,g),H=H+Math.imul(H0,e)|0,J=J+Math.imul(H0,X0)|0,J=J+Math.imul(O0,e)|0,O=O+Math.imul(O0,X0)|0,H=H+Math.imul(r,F0)|0,J=J+Math.imul(r,A0)|0,J=J+Math.imul(J0,F0)|0,O=O+Math.imul(J0,A0)|0,H=H+Math.imul(p,P0)|0,J=J+Math.imul(p,N0)|0,J=J+Math.imul(m,P0)|0,O=O+Math.imul(m,N0)|0,H=H+Math.imul(t,k0)|0,J=J+Math.imul(t,M0)|0,J=J+Math.imul(U0,k0)|0,O=O+Math.imul(U0,M0)|0;var T1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(T1>>>26)|0,T1&=67108863,H=Math.imul(I0,e),J=Math.imul(I0,X0),J=J+Math.imul(C0,e)|0,O=Math.imul(C0,X0),H=H+Math.imul(H0,F0)|0,J=J+Math.imul(H0,A0)|0,J=J+Math.imul(O0,F0)|0,O=O+Math.imul(O0,A0)|0,H=H+Math.imul(r,P0)|0,J=J+Math.imul(r,N0)|0,J=J+Math.imul(J0,P0)|0,O=O+Math.imul(J0,N0)|0,H=H+Math.imul(p,k0)|0,J=J+Math.imul(p,M0)|0,J=J+Math.imul(m,k0)|0,O=O+Math.imul(m,M0)|0;var R1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(R1>>>26)|0,R1&=67108863,H=Math.imul(I0,F0),J=Math.imul(I0,A0),J=J+Math.imul(C0,F0)|0,O=Math.imul(C0,A0),H=H+Math.imul(H0,P0)|0,J=J+Math.imul(H0,N0)|0,J=J+Math.imul(O0,P0)|0,O=O+Math.imul(O0,N0)|0,H=H+Math.imul(r,k0)|0,J=J+Math.imul(r,M0)|0,J=J+Math.imul(J0,k0)|0,O=O+Math.imul(J0,M0)|0;var E1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(E1>>>26)|0,E1&=67108863,H=Math.imul(I0,P0),J=Math.imul(I0,N0),J=J+Math.imul(C0,P0)|0,O=Math.imul(C0,N0),H=H+Math.imul(H0,k0)|0,J=J+Math.imul(H0,M0)|0,J=J+Math.imul(O0,k0)|0,O=O+Math.imul(O0,M0)|0;var S1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(S1>>>26)|0,S1&=67108863,H=Math.imul(I0,k0),J=Math.imul(I0,M0),J=J+Math.imul(C0,k0)|0,O=Math.imul(C0,M0);var P1=(D+H|0)+((J&8191)<<13)|0;if(D=(O+(J>>>13)|0)+(P1>>>26)|0,P1&=67108863,C[0]=G1,C[1]=l0,C[2]=b0,C[3]=t0,C[4]=r0,C[5]=H1,C[6]=O1,C[7]=C1,C[8]=A1,C[9]=z1,C[10]=D1,C[11]=q1,C[12]=M1,C[13]=L1,C[14]=T1,C[15]=R1,C[16]=E1,C[17]=S1,C[18]=P1,D!==0)C[19]=D,I.length++;return I};if(!Math.imul)k=j;function B(Y,V,I){I.negative=V.negative^Y.negative,I.length=Y.length+V.length;var G=0,W=0;for(var C=0;C<I.length-1;C++){var D=W;W=0;var H=G&67108863,J=Math.min(C,V.length-1);for(var O=Math.max(0,C-Y.length+1);O<=J;O++){var P=C-O,R=Y.words[P]|0,_=V.words[O]|0,f=R*_,c=f&67108863;D=D+(f/67108864|0)|0,c=c+H|0,H=c&67108863,D=D+(c>>>26)|0,W+=D>>>26,D&=67108863}I.words[C]=H,G=D,D=W}if(G!==0)I.words[C]=G;else I.length--;return I.strip()}function v(Y,V,I){var G=new x;return G.mulp(Y,V,I)}$.prototype.mulTo=function(Y,V){var I,G=this.length+Y.length;if(this.length===10&&Y.length===10)I=k(this,Y,V);else if(G<63)I=j(this,Y,V);else if(G<1024)I=B(this,Y,V);else I=v(this,Y,V);return I};function x(Y,V){this.x=Y,this.y=V}x.prototype.makeRBT=function(Y){var V=Array(Y),I=$.prototype._countBits(Y)-1;for(var G=0;G<Y;G++)V[G]=this.revBin(G,I,Y);return V},x.prototype.revBin=function(Y,V,I){if(Y===0||Y===I-1)return Y;var G=0;for(var W=0;W<V;W++)G|=(Y&1)<<V-W-1,Y>>=1;return G},x.prototype.permute=function(Y,V,I,G,W,C){for(var D=0;D<C;D++)G[D]=V[Y[D]],W[D]=I[Y[D]]},x.prototype.transform=function(Y,V,I,G,W,C){this.permute(C,Y,V,I,G,W);for(var D=1;D<W;D<<=1){var H=D<<1,J=Math.cos(2*Math.PI/H),O=Math.sin(2*Math.PI/H);for(var P=0;P<W;P+=H){var R=J,_=O;for(var f=0;f<D;f++){var c=I[P+f],o=G[P+f],K0=I[P+f+D],a=G[P+f+D],l=R*K0-_*a;if(a=R*a+_*K0,K0=l,I[P+f]=c+K0,G[P+f]=o+a,I[P+f+D]=c-K0,G[P+f+D]=o-a,f!==H)l=J*R-O*_,_=J*_+O*R,R=l}}}},x.prototype.guessLen13b=function(Y,V){var I=Math.max(V,Y)|1,G=I&1,W=0;for(I=I/2|0;I;I=I>>>1)W++;return 1<<W+1+G},x.prototype.conjugate=function(Y,V,I){if(I<=1)return;for(var G=0;G<I/2;G++){var W=Y[G];Y[G]=Y[I-G-1],Y[I-G-1]=W,W=V[G],V[G]=-V[I-G-1],V[I-G-1]=-W}},x.prototype.normalize13b=function(Y,V){var I=0;for(var G=0;G<V/2;G++){var W=Math.round(Y[2*G+1]/V)*8192+Math.round(Y[2*G]/V)+I;if(Y[G]=W&67108863,W<67108864)I=0;else I=W/67108864|0}return Y},x.prototype.convert13b=function(Y,V,I,G){var W=0;for(var C=0;C<V;C++)W=W+(Y[C]|0),I[2*C]=W&8191,W=W>>>13,I[2*C+1]=W&8191,W=W>>>13;for(C=2*V;C<G;++C)I[C]=0;K(W===0),K((W&-8192)===0)},x.prototype.stub=function(Y){var V=Array(Y);for(var I=0;I<Y;I++)V[I]=0;return V},x.prototype.mulp=function(Y,V,I){var G=2*this.guessLen13b(Y.length,V.length),W=this.makeRBT(G),C=this.stub(G),D=Array(G),H=Array(G),J=Array(G),O=Array(G),P=Array(G),R=Array(G),_=I.words;_.length=G,this.convert13b(Y.words,Y.length,D,G),this.convert13b(V.words,V.length,O,G),this.transform(D,C,H,J,G,W),this.transform(O,C,P,R,G,W);for(var f=0;f<G;f++){var c=H[f]*P[f]-J[f]*R[f];J[f]=H[f]*R[f]+J[f]*P[f],H[f]=c}return this.conjugate(H,J,G),this.transform(H,J,_,C,G,W),this.conjugate(_,C,G),this.normalize13b(_,G),I.negative=Y.negative^V.negative,I.length=Y.length+V.length,I.strip()},$.prototype.mul=function(Y){var V=new $(null);return V.words=Array(this.length+Y.length),this.mulTo(Y,V)},$.prototype.mulf=function(Y){var V=new $(null);return V.words=Array(this.length+Y.length),v(this,Y,V)},$.prototype.imul=function(Y){return this.clone().mulTo(Y,this)},$.prototype.imuln=function(Y){K(typeof Y==="number"),K(Y<67108864);var V=0;for(var I=0;I<this.length;I++){var G=(this.words[I]|0)*Y,W=(G&67108863)+(V&67108863);V>>=26,V+=G/67108864|0,V+=W>>>26,this.words[I]=W&67108863}if(V!==0)this.words[I]=V,this.length++;return this.length=Y===0?1:this.length,this},$.prototype.muln=function(Y){return this.clone().imuln(Y)},$.prototype.sqr=function(){return this.mul(this)},$.prototype.isqr=function(){return this.imul(this.clone())},$.prototype.pow=function(Y){var V=S(Y);if(V.length===0)return new $(1);var I=this;for(var G=0;G<V.length;G++,I=I.sqr())if(V[G]!==0)break;if(++G<V.length)for(var W=I.sqr();G<V.length;G++,W=W.sqr()){if(V[G]===0)continue;I=I.mul(W)}return I},$.prototype.iushln=function(Y){K(typeof Y==="number"&&Y>=0);var V=Y%26,I=(Y-V)/26,G=67108863>>>26-V<<26-V,W;if(V!==0){var C=0;for(W=0;W<this.length;W++){var D=this.words[W]&G,H=(this.words[W]|0)-D<<V;this.words[W]=H|C,C=D>>>26-V}if(C)this.words[W]=C,this.length++}if(I!==0){for(W=this.length-1;W>=0;W--)this.words[W+I]=this.words[W];for(W=0;W<I;W++)this.words[W]=0;this.length+=I}return this.strip()},$.prototype.ishln=function(Y){return K(this.negative===0),this.iushln(Y)},$.prototype.iushrn=function(Y,V,I){K(typeof Y==="number"&&Y>=0);var G;if(V)G=(V-V%26)/26;else G=0;var W=Y%26,C=Math.min((Y-W)/26,this.length),D=67108863^67108863>>>W<<W,H=I;if(G-=C,G=Math.max(0,G),H){for(var J=0;J<C;J++)H.words[J]=this.words[J];H.length=C}if(C===0);else if(this.length>C){this.length-=C;for(J=0;J<this.length;J++)this.words[J]=this.words[J+C]}else this.words[0]=0,this.length=1;var O=0;for(J=this.length-1;J>=0&&(O!==0||J>=G);J--){var P=this.words[J]|0;this.words[J]=O<<26-W|P>>>W,O=P&D}if(H&&O!==0)H.words[H.length++]=O;if(this.length===0)this.words[0]=0,this.length=1;return this.strip()},$.prototype.ishrn=function(Y,V,I){return K(this.negative===0),this.iushrn(Y,V,I)},$.prototype.shln=function(Y){return this.clone().ishln(Y)},$.prototype.ushln=function(Y){return this.clone().iushln(Y)},$.prototype.shrn=function(Y){return this.clone().ishrn(Y)},$.prototype.ushrn=function(Y){return this.clone().iushrn(Y)},$.prototype.testn=function(Y){K(typeof Y==="number"&&Y>=0);var V=Y%26,I=(Y-V)/26,G=1<<V;if(this.length<=I)return!1;var W=this.words[I];return!!(W&G)},$.prototype.imaskn=function(Y){K(typeof Y==="number"&&Y>=0);var V=Y%26,I=(Y-V)/26;if(K(this.negative===0,"imaskn works only with positive numbers"),this.length<=I)return this;if(V!==0)I++;if(this.length=Math.min(I,this.length),V!==0){var G=67108863^67108863>>>V<<V;this.words[this.length-1]&=G}return this.strip()},$.prototype.maskn=function(Y){return this.clone().imaskn(Y)},$.prototype.iaddn=function(Y){if(K(typeof Y==="number"),K(Y<67108864),Y<0)return this.isubn(-Y);if(this.negative!==0){if(this.length===1&&(this.words[0]|0)<Y)return this.words[0]=Y-(this.words[0]|0),this.negative=0,this;return this.negative=0,this.isubn(Y),this.negative=1,this}return this._iaddn(Y)},$.prototype._iaddn=function(Y){this.words[0]+=Y;for(var V=0;V<this.length&&this.words[V]>=67108864;V++)if(this.words[V]-=67108864,V===this.length-1)this.words[V+1]=1;else this.words[V+1]++;return this.length=Math.max(this.length,V+1),this},$.prototype.isubn=function(Y){if(K(typeof Y==="number"),K(Y<67108864),Y<0)return this.iaddn(-Y);if(this.negative!==0)return this.negative=0,this.iaddn(Y),this.negative=1,this;if(this.words[0]-=Y,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var V=0;V<this.length&&this.words[V]<0;V++)this.words[V]+=67108864,this.words[V+1]-=1;return this.strip()},$.prototype.addn=function(Y){return this.clone().iaddn(Y)},$.prototype.subn=function(Y){return this.clone().isubn(Y)},$.prototype.iabs=function(){return this.negative=0,this},$.prototype.abs=function(){return this.clone().iabs()},$.prototype._ishlnsubmul=function(Y,V,I){var G=Y.length+I,W;this._expand(G);var C,D=0;for(W=0;W<Y.length;W++){C=(this.words[W+I]|0)+D;var H=(Y.words[W]|0)*V;C-=H&67108863,D=(C>>26)-(H/67108864|0),this.words[W+I]=C&67108863}for(;W<this.length-I;W++)C=(this.words[W+I]|0)+D,D=C>>26,this.words[W+I]=C&67108863;if(D===0)return this.strip();K(D===-1),D=0;for(W=0;W<this.length;W++)C=-(this.words[W]|0)+D,D=C>>26,this.words[W]=C&67108863;return this.negative=1,this.strip()},$.prototype._wordDiv=function(Y,V){var I=this.length-Y.length,G=this.clone(),W=Y,C=W.words[W.length-1]|0,D=this._countBits(C);if(I=26-D,I!==0)W=W.ushln(I),G.iushln(I),C=W.words[W.length-1]|0;var H=G.length-W.length,J;if(V!=="mod"){J=new $(null),J.length=H+1,J.words=Array(J.length);for(var O=0;O<J.length;O++)J.words[O]=0}var P=G.clone()._ishlnsubmul(W,1,H);if(P.negative===0){if(G=P,J)J.words[H]=1}for(var R=H-1;R>=0;R--){var _=(G.words[W.length+R]|0)*67108864+(G.words[W.length+R-1]|0);_=Math.min(_/C|0,67108863),G._ishlnsubmul(W,_,R);while(G.negative!==0)if(_--,G.negative=0,G._ishlnsubmul(W,1,R),!G.isZero())G.negative^=1;if(J)J.words[R]=_}if(J)J.strip();if(G.strip(),V!=="div"&&I!==0)G.iushrn(I);return{div:J||null,mod:G}},$.prototype.divmod=function(Y,V,I){if(K(!Y.isZero()),this.isZero())return{div:new $(0),mod:new $(0)};var G,W,C;if(this.negative!==0&&Y.negative===0){if(C=this.neg().divmod(Y,V),V!=="mod")G=C.div.neg();if(V!=="div"){if(W=C.mod.neg(),I&&W.negative!==0)W.iadd(Y)}return{div:G,mod:W}}if(this.negative===0&&Y.negative!==0){if(C=this.divmod(Y.neg(),V),V!=="mod")G=C.div.neg();return{div:G,mod:C.mod}}if((this.negative&Y.negative)!==0){if(C=this.neg().divmod(Y.neg(),V),V!=="div"){if(W=C.mod.neg(),I&&W.negative!==0)W.isub(Y)}return{div:C.div,mod:W}}if(Y.length>this.length||this.cmp(Y)<0)return{div:new $(0),mod:this};if(Y.length===1){if(V==="div")return{div:this.divn(Y.words[0]),mod:null};if(V==="mod")return{div:null,mod:new $(this.modn(Y.words[0]))};return{div:this.divn(Y.words[0]),mod:new $(this.modn(Y.words[0]))}}return this._wordDiv(Y,V)},$.prototype.div=function(Y){return this.divmod(Y,"div",!1).div},$.prototype.mod=function(Y){return this.divmod(Y,"mod",!1).mod},$.prototype.umod=function(Y){return this.divmod(Y,"mod",!0).mod},$.prototype.divRound=function(Y){var V=this.divmod(Y);if(V.mod.isZero())return V.div;var I=V.div.negative!==0?V.mod.isub(Y):V.mod,G=Y.ushrn(1),W=Y.andln(1),C=I.cmp(G);if(C<0||W===1&&C===0)return V.div;return V.div.negative!==0?V.div.isubn(1):V.div.iaddn(1)},$.prototype.modn=function(Y){K(Y<=67108863);var V=67108864%Y,I=0;for(var G=this.length-1;G>=0;G--)I=(V*I+(this.words[G]|0))%Y;return I},$.prototype.idivn=function(Y){K(Y<=67108863);var V=0;for(var I=this.length-1;I>=0;I--){var G=(this.words[I]|0)+V*67108864;this.words[I]=G/Y|0,V=G%Y}return this.strip()},$.prototype.divn=function(Y){return this.clone().idivn(Y)},$.prototype.egcd=function(Y){K(Y.negative===0),K(!Y.isZero());var V=this,I=Y.clone();if(V.negative!==0)V=V.umod(Y);else V=V.clone();var G=new $(1),W=new $(0),C=new $(0),D=new $(1),H=0;while(V.isEven()&&I.isEven())V.iushrn(1),I.iushrn(1),++H;var J=I.clone(),O=V.clone();while(!V.isZero()){for(var P=0,R=1;(V.words[0]&R)===0&&P<26;++P,R<<=1);if(P>0){V.iushrn(P);while(P-- >0){if(G.isOdd()||W.isOdd())G.iadd(J),W.isub(O);G.iushrn(1),W.iushrn(1)}}for(var _=0,f=1;(I.words[0]&f)===0&&_<26;++_,f<<=1);if(_>0){I.iushrn(_);while(_-- >0){if(C.isOdd()||D.isOdd())C.iadd(J),D.isub(O);C.iushrn(1),D.iushrn(1)}}if(V.cmp(I)>=0)V.isub(I),G.isub(C),W.isub(D);else I.isub(V),C.isub(G),D.isub(W)}return{a:C,b:D,gcd:I.iushln(H)}},$.prototype._invmp=function(Y){K(Y.negative===0),K(!Y.isZero());var V=this,I=Y.clone();if(V.negative!==0)V=V.umod(Y);else V=V.clone();var G=new $(1),W=new $(0),C=I.clone();while(V.cmpn(1)>0&&I.cmpn(1)>0){for(var D=0,H=1;(V.words[0]&H)===0&&D<26;++D,H<<=1);if(D>0){V.iushrn(D);while(D-- >0){if(G.isOdd())G.iadd(C);G.iushrn(1)}}for(var J=0,O=1;(I.words[0]&O)===0&&J<26;++J,O<<=1);if(J>0){I.iushrn(J);while(J-- >0){if(W.isOdd())W.iadd(C);W.iushrn(1)}}if(V.cmp(I)>=0)V.isub(I),G.isub(W);else I.isub(V),W.isub(G)}var P;if(V.cmpn(1)===0)P=G;else P=W;if(P.cmpn(0)<0)P.iadd(Y);return P},$.prototype.gcd=function(Y){if(this.isZero())return Y.abs();if(Y.isZero())return this.abs();var V=this.clone(),I=Y.clone();V.negative=0,I.negative=0;for(var G=0;V.isEven()&&I.isEven();G++)V.iushrn(1),I.iushrn(1);do{while(V.isEven())V.iushrn(1);while(I.isEven())I.iushrn(1);var W=V.cmp(I);if(W<0){var C=V;V=I,I=C}else if(W===0||I.cmpn(1)===0)break;V.isub(I)}while(!0);return I.iushln(G)},$.prototype.invm=function(Y){return this.egcd(Y).a.umod(Y)},$.prototype.isEven=function(){return(this.words[0]&1)===0},$.prototype.isOdd=function(){return(this.words[0]&1)===1},$.prototype.andln=function(Y){return this.words[0]&Y},$.prototype.bincn=function(Y){K(typeof Y==="number");var V=Y%26,I=(Y-V)/26,G=1<<V;if(this.length<=I)return this._expand(I+1),this.words[I]|=G,this;var W=G;for(var C=I;W!==0&&C<this.length;C++){var D=this.words[C]|0;D+=W,W=D>>>26,D&=67108863,this.words[C]=D}if(W!==0)this.words[C]=W,this.length++;return this},$.prototype.isZero=function(){return this.length===1&&this.words[0]===0},$.prototype.cmpn=function(Y){var V=Y<0;if(this.negative!==0&&!V)return-1;if(this.negative===0&&V)return 1;this.strip();var I;if(this.length>1)I=1;else{if(V)Y=-Y;K(Y<=67108863,"Number is too big");var G=this.words[0]|0;I=G===Y?0:G<Y?-1:1}if(this.negative!==0)return-I|0;return I},$.prototype.cmp=function(Y){if(this.negative!==0&&Y.negative===0)return-1;if(this.negative===0&&Y.negative!==0)return 1;var V=this.ucmp(Y);if(this.negative!==0)return-V|0;return V},$.prototype.ucmp=function(Y){if(this.length>Y.length)return 1;if(this.length<Y.length)return-1;var V=0;for(var I=this.length-1;I>=0;I--){var G=this.words[I]|0,W=Y.words[I]|0;if(G===W)continue;if(G<W)V=-1;else if(G>W)V=1;break}return V},$.prototype.gtn=function(Y){return this.cmpn(Y)===1},$.prototype.gt=function(Y){return this.cmp(Y)===1},$.prototype.gten=function(Y){return this.cmpn(Y)>=0},$.prototype.gte=function(Y){return this.cmp(Y)>=0},$.prototype.ltn=function(Y){return this.cmpn(Y)===-1},$.prototype.lt=function(Y){return this.cmp(Y)===-1},$.prototype.lten=function(Y){return this.cmpn(Y)<=0},$.prototype.lte=function(Y){return this.cmp(Y)<=0},$.prototype.eqn=function(Y){return this.cmpn(Y)===0},$.prototype.eq=function(Y){return this.cmp(Y)===0},$.red=function(Y){return new b(Y)},$.prototype.toRed=function(Y){return K(!this.red,"Already a number in reduction context"),K(this.negative===0,"red works only with positives"),Y.convertTo(this)._forceRed(Y)},$.prototype.fromRed=function(){return K(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},$.prototype._forceRed=function(Y){return this.red=Y,this},$.prototype.forceRed=function(Y){return K(!this.red,"Already a number in reduction context"),this._forceRed(Y)},$.prototype.redAdd=function(Y){return K(this.red,"redAdd works only with red numbers"),this.red.add(this,Y)},$.prototype.redIAdd=function(Y){return K(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,Y)},$.prototype.redSub=function(Y){return K(this.red,"redSub works only with red numbers"),this.red.sub(this,Y)},$.prototype.redISub=function(Y){return K(this.red,"redISub works only with red numbers"),this.red.isub(this,Y)},$.prototype.redShl=function(Y){return K(this.red,"redShl works only with red numbers"),this.red.shl(this,Y)},$.prototype.redMul=function(Y){return K(this.red,"redMul works only with red numbers"),this.red._verify2(this,Y),this.red.mul(this,Y)},$.prototype.redIMul=function(Y){return K(this.red,"redMul works only with red numbers"),this.red._verify2(this,Y),this.red.imul(this,Y)},$.prototype.redSqr=function(){return K(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},$.prototype.redISqr=function(){return K(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},$.prototype.redSqrt=function(){return K(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},$.prototype.redInvm=function(){return K(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},$.prototype.redNeg=function(){return K(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},$.prototype.redPow=function(Y){return K(this.red&&!Y.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,Y)};var N={k256:null,p224:null,p192:null,p25519:null};function w(Y,V){this.name=Y,this.p=new $(V,16),this.n=this.p.bitLength(),this.k=new $(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}w.prototype._tmp=function(){var Y=new $(null);return Y.words=Array(Math.ceil(this.n/13)),Y},w.prototype.ireduce=function(Y){var V=Y,I;do this.split(V,this.tmp),V=this.imulK(V),V=V.iadd(this.tmp),I=V.bitLength();while(I>this.n);var G=I<this.n?-1:V.ucmp(this.p);if(G===0)V.words[0]=0,V.length=1;else if(G>0)V.isub(this.p);else if(V.strip!==void 0)V.strip();else V._strip();return V},w.prototype.split=function(Y,V){Y.iushrn(this.n,0,V)},w.prototype.imulK=function(Y){return Y.imul(this.k)};function u(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}F(u,w),u.prototype.split=function(Y,V){var I=4194303,G=Math.min(Y.length,9);for(var W=0;W<G;W++)V.words[W]=Y.words[W];if(V.length=G,Y.length<=9){Y.words[0]=0,Y.length=1;return}var C=Y.words[9];V.words[V.length++]=C&I;for(W=10;W<Y.length;W++){var D=Y.words[W]|0;Y.words[W-10]=(D&I)<<4|C>>>22,C=D}if(C>>>=22,Y.words[W-10]=C,C===0&&Y.length>10)Y.length-=10;else Y.length-=9},u.prototype.imulK=function(Y){Y.words[Y.length]=0,Y.words[Y.length+1]=0,Y.length+=2;var V=0;for(var I=0;I<Y.length;I++){var G=Y.words[I]|0;V+=G*977,Y.words[I]=V&67108863,V=G*64+(V/67108864|0)}if(Y.words[Y.length-1]===0){if(Y.length--,Y.words[Y.length-1]===0)Y.length--}return Y};function Z0(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}F(Z0,w);function V0(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}F(V0,w);function Y0(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}F(Y0,w),Y0.prototype.imulK=function(Y){var V=0;for(var I=0;I<Y.length;I++){var G=(Y.words[I]|0)*19+V,W=G&67108863;G>>>=26,Y.words[I]=W,V=G}if(V!==0)Y.words[Y.length++]=V;return Y},$._prime=function(Y){if(N[Y])return N[Y];var V;if(Y==="k256")V=new u;else if(Y==="p224")V=new Z0;else if(Y==="p192")V=new V0;else if(Y==="p25519")V=new Y0;else throw Error("Unknown prime "+Y);return N[Y]=V,V};function b(Y){if(typeof Y==="string"){var V=$._prime(Y);this.m=V.p,this.prime=V}else K(Y.gtn(1),"modulus must be greater than 1"),this.m=Y,this.prime=null}b.prototype._verify1=function(Y){K(Y.negative===0,"red works only with positives"),K(Y.red,"red works only with red numbers")},b.prototype._verify2=function(Y,V){K((Y.negative|V.negative)===0,"red works only with positives"),K(Y.red&&Y.red===V.red,"red works only with red numbers")},b.prototype.imod=function(Y){if(this.prime)return this.prime.ireduce(Y)._forceRed(this);return Y.umod(this.m)._forceRed(this)},b.prototype.neg=function(Y){if(Y.isZero())return Y.clone();return this.m.sub(Y)._forceRed(this)},b.prototype.add=function(Y,V){this._verify2(Y,V);var I=Y.add(V);if(I.cmp(this.m)>=0)I.isub(this.m);return I._forceRed(this)},b.prototype.iadd=function(Y,V){this._verify2(Y,V);var I=Y.iadd(V);if(I.cmp(this.m)>=0)I.isub(this.m);return I},b.prototype.sub=function(Y,V){this._verify2(Y,V);var I=Y.sub(V);if(I.cmpn(0)<0)I.iadd(this.m);return I._forceRed(this)},b.prototype.isub=function(Y,V){this._verify2(Y,V);var I=Y.isub(V);if(I.cmpn(0)<0)I.iadd(this.m);return I},b.prototype.shl=function(Y,V){return this._verify1(Y),this.imod(Y.ushln(V))},b.prototype.imul=function(Y,V){return this._verify2(Y,V),this.imod(Y.imul(V))},b.prototype.mul=function(Y,V){return this._verify2(Y,V),this.imod(Y.mul(V))},b.prototype.isqr=function(Y){return this.imul(Y,Y.clone())},b.prototype.sqr=function(Y){return this.mul(Y,Y)},b.prototype.sqrt=function(Y){if(Y.isZero())return Y.clone();var V=this.m.andln(3);if(K(V%2===1),V===3){var I=this.m.add(new $(1)).iushrn(2);return this.pow(Y,I)}var G=this.m.subn(1),W=0;while(!G.isZero()&&G.andln(1)===0)W++,G.iushrn(1);K(!G.isZero());var C=new $(1).toRed(this),D=C.redNeg(),H=this.m.subn(1).iushrn(1),J=this.m.bitLength();J=new $(2*J*J).toRed(this);while(this.pow(J,H).cmp(D)!==0)J.redIAdd(D);var O=this.pow(J,G),P=this.pow(Y,G.addn(1).iushrn(1)),R=this.pow(Y,G),_=W;while(R.cmp(C)!==0){var f=R;for(var c=0;f.cmp(C)!==0;c++)f=f.redSqr();K(c<_);var o=this.pow(O,new $(1).iushln(_-c-1));P=P.redMul(o),O=o.redSqr(),R=R.redMul(O),_=c}return P},b.prototype.invm=function(Y){var V=Y._invmp(this.m);if(V.negative!==0)return V.negative=0,this.imod(V).redNeg();else return this.imod(V)},b.prototype.pow=function(Y,V){if(V.isZero())return new $(1).toRed(this);if(V.cmpn(1)===0)return Y.clone();var I=4,G=Array(1<<I);G[0]=new $(1).toRed(this),G[1]=Y;for(var W=2;W<G.length;W++)G[W]=this.mul(G[W-1],Y);var C=G[0],D=0,H=0,J=V.bitLength()%26;if(J===0)J=26;for(W=V.length-1;W>=0;W--){var O=V.words[W];for(var P=J-1;P>=0;P--){var R=O>>P&1;if(C!==G[0])C=this.sqr(C);if(R===0&&D===0){H=0;continue}if(D<<=1,D|=R,H++,H!==I&&(W!==0||P!==0))continue;C=this.mul(C,G[D]),H=0,D=0}J=26}return C},b.prototype.convertTo=function(Y){var V=Y.umod(this.m);return V===Y?V.clone():V},b.prototype.convertFrom=function(Y){var V=Y.clone();return V.red=null,V},$.mont=function(Y){return new i(Y)};function i(Y){if(b.call(this,Y),this.shift=this.m.bitLength(),this.shift%26!==0)this.shift+=26-this.shift%26;this.r=new $(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}F(i,b),i.prototype.convertTo=function(Y){return this.imod(Y.ushln(this.shift))},i.prototype.convertFrom=function(Y){var V=this.imod(Y.mul(this.rinv));return V.red=null,V},i.prototype.imul=function(Y,V){if(Y.isZero()||V.isZero())return Y.words[0]=0,Y.length=1,Y;var I=Y.imul(V),G=I.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),W=I.isub(G).iushrn(this.shift),C=W;if(W.cmp(this.m)>=0)C=W.isub(this.m);else if(W.cmpn(0)<0)C=W.iadd(this.m);return C._forceRed(this)},i.prototype.mul=function(Y,V){if(Y.isZero()||V.isZero())return new $(0)._forceRed(this);var I=Y.mul(V),G=I.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),W=I.isub(G).iushrn(this.shift),C=W;if(W.cmp(this.m)>=0)C=W.isub(this.m);else if(W.cmpn(0)<0)C=W.iadd(this.m);return C._forceRed(this)},i.prototype.invm=function(Y){var V=this.imod(Y._invmp(this.m).mul(this.r2));return V._forceRed(this)}})(typeof Z>"u"||Z,U)}),pF=$0((U)=>{var Z=uZ(),X=YU(),Q=U;Q.define=function(F,$){return new K(F,$)};function K(F,$){this.name=F,this.body=$,this.decoders={},this.encoders={}}K.prototype._createNamed=function(F){var $;try{$=(()=>{throw new Error("Cannot require module "+"vm");})().runInThisContext("(function "+this.name+`(entity) {
|
|
13
13
|
this._initNamed(entity);
|
|
14
|
-
})`)}catch(M){$=function(q){this._initNamed(q)}}return X($,H),$.prototype._initNamed=function(M){H.call(this,M)},new $(this)},K.prototype._getDecoder=function(H){if(H=H||"der",!this.decoders.hasOwnProperty(H))this.decoders[H]=this._createNamed(Z.decoders[H]);return this.decoders[H]},K.prototype.decode=function(H,$,M){return this._getDecoder($).decode(H,M)},K.prototype._getEncoder=function(H){if(H=H||"der",!this.encoders.hasOwnProperty(H))this.encoders[H]=this._createNamed(Z.encoders[H]);return this.encoders[H]},K.prototype.encode=function(H,$,M){return this._getEncoder($).encode(H,M)}}),hH=$0((U)=>{var Z=YU();function X(K){this._reporterState={obj:null,path:[],options:K||{},errors:[]}}U.Reporter=X,X.prototype.isError=function(K){return K instanceof Q},X.prototype.save=function(){var K=this._reporterState;return{obj:K.obj,pathLen:K.path.length}},X.prototype.restore=function(K){var H=this._reporterState;H.obj=K.obj,H.path=H.path.slice(0,K.pathLen)},X.prototype.enterKey=function(K){return this._reporterState.path.push(K)},X.prototype.exitKey=function(K){var H=this._reporterState;H.path=H.path.slice(0,K-1)},X.prototype.leaveKey=function(K,H,$){var M=this._reporterState;if(this.exitKey(K),M.obj!==null)M.obj[H]=$},X.prototype.path=function(){return this._reporterState.path.join("/")},X.prototype.enterObject=function(){var K=this._reporterState,H=K.obj;return K.obj={},H},X.prototype.leaveObject=function(K){var H=this._reporterState,$=H.obj;return H.obj=K,$},X.prototype.error=function(K){var H,$=this._reporterState,M=K instanceof Q;if(M)H=K;else H=new Q($.path.map(function(q){return"["+JSON.stringify(q)+"]"}).join(""),K.message||K,K.stack);if(!$.options.partial)throw H;if(!M)$.errors.push(H);return H},X.prototype.wrapResult=function(K){var H=this._reporterState;if(!H.options.partial)return K;return{result:this.isError(K)?null:K,errors:H.errors}};function Q(K,H){this.path=K,this.rethrow(H)}Z(Q,Error),Q.prototype.rethrow=function(K){if(this.message=K+" at: "+(this.path||"(shallow)"),Error.captureStackTrace)Error.captureStackTrace(this,Q);if(!this.stack)try{throw Error(this.message)}catch(H){this.stack=H.stack}return this}}),uG=$0((U)=>{var Z=YU(),X=wZ().Reporter,Q=(g1(),m0(N1)).Buffer;function K($,M){if(X.call(this,M),!Q.isBuffer($)){this.error("Input not Buffer");return}this.base=$,this.offset=0,this.length=$.length}Z(K,X),U.DecoderBuffer=K,K.prototype.save=function(){return{offset:this.offset,reporter:X.prototype.save.call(this)}},K.prototype.restore=function($){var M=new K(this.base);return M.offset=$.offset,M.length=this.offset,this.offset=$.offset,X.prototype.restore.call(this,$.reporter),M},K.prototype.isEmpty=function(){return this.offset===this.length},K.prototype.readUInt8=function($){if(this.offset+1<=this.length)return this.base.readUInt8(this.offset++,!0);else return this.error($||"DecoderBuffer overrun")},K.prototype.skip=function($,M){if(!(this.offset+$<=this.length))return this.error(M||"DecoderBuffer overrun");var q=new K(this.base);return q._reporterState=this._reporterState,q.offset=this.offset,q.length=this.offset+$,this.offset+=$,q},K.prototype.raw=function($){return this.base.slice($?$.offset:this.offset,this.length)};function H($,M){if(Array.isArray($))this.length=0,this.value=$.map(function(q){if(!(q instanceof H))q=new H(q,M);return this.length+=q.length,q},this);else if(typeof $==="number"){if(!(0<=$&&$<=255))return M.error("non-byte EncoderBuffer value");this.value=$,this.length=1}else if(typeof $==="string")this.value=$,this.length=Q.byteLength($);else if(Q.isBuffer($))this.value=$,this.length=$.length;else return M.error("Unsupported type: "+typeof $)}U.EncoderBuffer=H,H.prototype.join=function($,M){if(!$)$=new Q(this.length);if(!M)M=0;if(this.length===0)return $;if(Array.isArray(this.value))this.value.forEach(function(q){q.join($,M),M+=q.length});else{if(typeof this.value==="number")$[M]=this.value;else if(typeof this.value==="string")$.write(this.value,M);else if(Q.isBuffer(this.value))this.value.copy($,M);M+=this.length}return $}}),uH=$0((U,Z)=>{var X=wZ().Reporter,Q=wZ().EncoderBuffer,K=wZ().DecoderBuffer,H=cU(),$=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],M=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat($),q=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];function z(A,L){var E={};if(this._baseState=E,E.enc=A,E.parent=L||null,E.children=null,E.tag=null,E.args=null,E.reverseArgs=null,E.choice=null,E.optional=!1,E.any=!1,E.obj=!1,E.use=null,E.useDecoder=null,E.key=null,E.default=null,E.explicit=null,E.implicit=null,E.contains=null,!E.parent)E.children=[],this._wrap()}Z.exports=z;var T=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];z.prototype.clone=function(){var A=this._baseState,L={};T.forEach(function(S){L[S]=A[S]});var E=new this.constructor(L.parent);return E._baseState=L,E},z.prototype._wrap=function(){var A=this._baseState;M.forEach(function(L){this[L]=function(){var E=new this.constructor(this);return A.children.push(E),E[L].apply(E,arguments)}},this)},z.prototype._init=function(A){var L=this._baseState;H(L.parent===null),A.call(this),L.children=L.children.filter(function(E){return E._baseState.parent===this},this),H.equal(L.children.length,1,"Root node can have only one child")},z.prototype._useArgs=function(A){var L=this._baseState,E=A.filter(function(S){return S instanceof this.constructor},this);if(A=A.filter(function(S){return!(S instanceof this.constructor)},this),E.length!==0)H(L.children===null),L.children=E,E.forEach(function(S){S._baseState.parent=this},this);if(A.length!==0)H(L.args===null),L.args=A,L.reverseArgs=A.map(function(S){if(typeof S!=="object"||S.constructor!==Object)return S;var j={};return Object.keys(S).forEach(function(k){if(k==(k|0))k|=0;var B=S[k];j[B]=k}),j})},q.forEach(function(A){z.prototype[A]=function(){var L=this._baseState;throw Error(A+" not implemented for encoding: "+L.enc)}}),$.forEach(function(A){z.prototype[A]=function(){var L=this._baseState,E=Array.prototype.slice.call(arguments);return H(L.tag===null),L.tag=A,this._useArgs(E),this}}),z.prototype.use=function(A){H(A);var L=this._baseState;return H(L.use===null),L.use=A,this},z.prototype.optional=function(){var A=this._baseState;return A.optional=!0,this},z.prototype.def=function(A){var L=this._baseState;return H(L.default===null),L.default=A,L.optional=!0,this},z.prototype.explicit=function(A){var L=this._baseState;return H(L.explicit===null&&L.implicit===null),L.explicit=A,this},z.prototype.implicit=function(A){var L=this._baseState;return H(L.explicit===null&&L.implicit===null),L.implicit=A,this},z.prototype.obj=function(){var A=this._baseState,L=Array.prototype.slice.call(arguments);if(A.obj=!0,L.length!==0)this._useArgs(L);return this},z.prototype.key=function(A){var L=this._baseState;return H(L.key===null),L.key=A,this},z.prototype.any=function(){var A=this._baseState;return A.any=!0,this},z.prototype.choice=function(A){var L=this._baseState;return H(L.choice===null),L.choice=A,this._useArgs(Object.keys(A).map(function(E){return A[E]})),this},z.prototype.contains=function(A){var L=this._baseState;return H(L.use===null),L.contains=A,this},z.prototype._decode=function(A,L){var E=this._baseState;if(E.parent===null)return A.wrapResult(E.children[0]._decode(A,L));var S=E.default,j=!0,k=null;if(E.key!==null)k=A.enterKey(E.key);if(E.optional){var B=null;if(E.explicit!==null)B=E.explicit;else if(E.implicit!==null)B=E.implicit;else if(E.tag!==null)B=E.tag;if(B===null&&!E.any){var v=A.save();try{if(E.choice===null)this._decodeGeneric(E.tag,A,L);else this._decodeChoice(A,L);j=!0}catch(V0){j=!1}A.restore(v)}else if(j=this._peekTag(A,B,E.any),A.isError(j))return j}var x;if(E.obj&&j)x=A.enterObject();if(j){if(E.explicit!==null){var N=this._decodeTag(A,E.explicit);if(A.isError(N))return N;A=N}var w=A.offset;if(E.use===null&&E.choice===null){if(E.any)var v=A.save();var u=this._decodeTag(A,E.implicit!==null?E.implicit:E.tag,E.any);if(A.isError(u))return u;if(E.any)S=A.raw(v);else A=u}if(L&&L.track&&E.tag!==null)L.track(A.path(),w,A.length,"tagged");if(L&&L.track&&E.tag!==null)L.track(A.path(),A.offset,A.length,"content");if(E.any)S=S;else if(E.choice===null)S=this._decodeGeneric(E.tag,A,L);else S=this._decodeChoice(A,L);if(A.isError(S))return S;if(!E.any&&E.choice===null&&E.children!==null)E.children.forEach(function(V0){V0._decode(A,L)});if(E.contains&&(E.tag==="octstr"||E.tag==="bitstr")){var Z0=new K(S);S=this._getUse(E.contains,A._reporterState.obj)._decode(Z0,L)}}if(E.obj&&j)S=A.leaveObject(x);if(E.key!==null&&(S!==null||j===!0))A.leaveKey(k,E.key,S);else if(k!==null)A.exitKey(k);return S},z.prototype._decodeGeneric=function(A,L,E){var S=this._baseState;if(A==="seq"||A==="set")return null;if(A==="seqof"||A==="setof")return this._decodeList(L,A,S.args[0],E);else if(/str$/.test(A))return this._decodeStr(L,A,E);else if(A==="objid"&&S.args)return this._decodeObjid(L,S.args[0],S.args[1],E);else if(A==="objid")return this._decodeObjid(L,null,null,E);else if(A==="gentime"||A==="utctime")return this._decodeTime(L,A,E);else if(A==="null_")return this._decodeNull(L,E);else if(A==="bool")return this._decodeBool(L,E);else if(A==="objDesc")return this._decodeStr(L,A,E);else if(A==="int"||A==="enum")return this._decodeInt(L,S.args&&S.args[0],E);if(S.use!==null)return this._getUse(S.use,L._reporterState.obj)._decode(L,E);else return L.error("unknown tag: "+A)},z.prototype._getUse=function(A,L){var E=this._baseState;if(E.useDecoder=this._use(A,L),H(E.useDecoder._baseState.parent===null),E.useDecoder=E.useDecoder._baseState.children[0],E.implicit!==E.useDecoder._baseState.implicit)E.useDecoder=E.useDecoder.clone(),E.useDecoder._baseState.implicit=E.implicit;return E.useDecoder},z.prototype._decodeChoice=function(A,L){var E=this._baseState,S=null,j=!1;if(Object.keys(E.choice).some(function(k){var B=A.save(),v=E.choice[k];try{var x=v._decode(A,L);if(A.isError(x))return!1;S={type:k,value:x},j=!0}catch(N){return A.restore(B),!1}return!0},this),!j)return A.error("Choice not matched");return S},z.prototype._createEncoderBuffer=function(A){return new Q(A,this.reporter)},z.prototype._encode=function(A,L,E){var S=this._baseState;if(S.default!==null&&S.default===A)return;var j=this._encodeValue(A,L,E);if(j===void 0)return;if(this._skipDefault(j,L,E))return;return j},z.prototype._encodeValue=function(A,L,E){var S=this._baseState;if(S.parent===null)return S.children[0]._encode(A,L||new X);var v=null;if(this.reporter=L,S.optional&&A===void 0)if(S.default!==null)A=S.default;else return;var j=null,k=!1;if(S.any)v=this._createEncoderBuffer(A);else if(S.choice)v=this._encodeChoice(A,L);else if(S.contains)j=this._getUse(S.contains,E)._encode(A,L),k=!0;else if(S.children)j=S.children.map(function(w){if(w._baseState.tag==="null_")return w._encode(null,L,A);if(w._baseState.key===null)return L.error("Child should have a key");var u=L.enterKey(w._baseState.key);if(typeof A!=="object")return L.error("Child expected, but input is not object");var Z0=w._encode(A[w._baseState.key],L,A);return L.leaveKey(u),Z0},this).filter(function(w){return w}),j=this._createEncoderBuffer(j);else if(S.tag==="seqof"||S.tag==="setof"){if(!(S.args&&S.args.length===1))return L.error("Too many args for : "+S.tag);if(!Array.isArray(A))return L.error("seqof/setof, but data is not Array");var B=this.clone();B._baseState.implicit=null,j=this._createEncoderBuffer(A.map(function(w){var u=this._baseState;return this._getUse(u.args[0],A)._encode(w,L)},B))}else if(S.use!==null)v=this._getUse(S.use,E)._encode(A,L);else j=this._encodePrimitive(S.tag,A),k=!0;var v;if(!S.any&&S.choice===null){var x=S.implicit!==null?S.implicit:S.tag,N=S.implicit===null?"universal":"context";if(x===null){if(S.use===null)L.error("Tag could be omitted only for .use()")}else if(S.use===null)v=this._encodeComposite(x,k,N,j)}if(S.explicit!==null)v=this._encodeComposite(S.explicit,!1,"context",v);return v},z.prototype._encodeChoice=function(A,L){var E=this._baseState,S=E.choice[A.type];if(!S)H(!1,A.type+" not found in "+JSON.stringify(Object.keys(E.choice)));return S._encode(A.value,L)},z.prototype._encodePrimitive=function(A,L){var E=this._baseState;if(/str$/.test(A))return this._encodeStr(L,A);else if(A==="objid"&&E.args)return this._encodeObjid(L,E.reverseArgs[0],E.args[1]);else if(A==="objid")return this._encodeObjid(L,null,null);else if(A==="gentime"||A==="utctime")return this._encodeTime(L,A);else if(A==="null_")return this._encodeNull();else if(A==="int"||A==="enum")return this._encodeInt(L,E.args&&E.reverseArgs[0]);else if(A==="bool")return this._encodeBool(L);else if(A==="objDesc")return this._encodeStr(L,A);else throw Error("Unsupported tag: "+A)},z.prototype._isNumstr=function(A){return/^[0-9 ]*$/.test(A)},z.prototype._isPrintstr=function(A){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(A)}}),wZ=$0((U)=>{var Z=U;Z.Reporter=hH().Reporter,Z.DecoderBuffer=uG().DecoderBuffer,Z.EncoderBuffer=uG().EncoderBuffer,Z.Node=uH()}),bH=$0((U)=>{var Z=GV();U.tagClass={0:"universal",1:"application",2:"context",3:"private"},U.tagClassByName=Z._reverse(U.tagClass),U.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},U.tagByName=Z._reverse(U.tag)}),GV=$0((U)=>{var Z=U;Z._reverse=function(X){var Q={};return Object.keys(X).forEach(function(K){if((K|0)==K)K=K|0;var H=X[K];Q[H]=K}),Q},Z.der=bH()}),VV=$0((U,Z)=>{var X=YU(),Q=uZ(),K=Q.base,H=Q.bignum,$=Q.constants.der;function M(A){this.enc="der",this.name=A.name,this.entity=A,this.tree=new q,this.tree._init(A.body)}Z.exports=M,M.prototype.decode=function(A,L){if(!(A instanceof K.DecoderBuffer))A=new K.DecoderBuffer(A,L);return this.tree._decode(A,L)};function q(A){K.Node.call(this,"der",A)}X(q,K.Node),q.prototype._peekTag=function(A,L,E){if(A.isEmpty())return!1;var S=A.save(),j=z(A,'Failed to peek tag: "'+L+'"');if(A.isError(j))return j;return A.restore(S),j.tag===L||j.tagStr===L||j.tagStr+"of"===L||E},q.prototype._decodeTag=function(A,L,E){var S=z(A,'Failed to decode tag of "'+L+'"');if(A.isError(S))return S;var j=T(A,S.primitive,'Failed to get length of "'+L+'"');if(A.isError(j))return j;if(!E&&S.tag!==L&&S.tagStr!==L&&S.tagStr+"of"!==L)return A.error('Failed to match tag: "'+L+'"');if(S.primitive||j!==null)return A.skip(j,'Failed to match body of: "'+L+'"');var k=A.save(),B=this._skipUntilEnd(A,'Failed to skip indefinite length body: "'+this.tag+'"');if(A.isError(B))return B;return j=A.offset-k.offset,A.restore(k),A.skip(j,'Failed to match body of: "'+L+'"')},q.prototype._skipUntilEnd=function(A,L){while(!0){var E=z(A,L);if(A.isError(E))return E;var S=T(A,E.primitive,L);if(A.isError(S))return S;var j;if(E.primitive||S!==null)j=A.skip(S);else j=this._skipUntilEnd(A,L);if(A.isError(j))return j;if(E.tagStr==="end")break}},q.prototype._decodeList=function(A,L,E,S){var j=[];while(!A.isEmpty()){var k=this._peekTag(A,"end");if(A.isError(k))return k;var B=E.decode(A,"der",S);if(A.isError(B)&&k)break;j.push(B)}return j},q.prototype._decodeStr=function(A,L){if(L==="bitstr"){var E=A.readUInt8();if(A.isError(E))return E;return{unused:E,data:A.raw()}}else if(L==="bmpstr"){var S=A.raw();if(S.length%2===1)return A.error("Decoding of string type: bmpstr length mismatch");var j="";for(var k=0;k<S.length/2;k++)j+=String.fromCharCode(S.readUInt16BE(k*2));return j}else if(L==="numstr"){var B=A.raw().toString("ascii");if(!this._isNumstr(B))return A.error("Decoding of string type: numstr unsupported characters");return B}else if(L==="octstr")return A.raw();else if(L==="objDesc")return A.raw();else if(L==="printstr"){var v=A.raw().toString("ascii");if(!this._isPrintstr(v))return A.error("Decoding of string type: printstr unsupported characters");return v}else if(/str$/.test(L))return A.raw().toString();else return A.error("Decoding of string type: "+L+" unsupported")},q.prototype._decodeObjid=function(A,L,E){var S,j=[],k=0;while(!A.isEmpty()){var B=A.readUInt8();if(k<<=7,k|=B&127,(B&128)===0)j.push(k),k=0}if(B&128)j.push(k);var v=j[0]/40|0,x=j[0]%40;if(E)S=j;else S=[v,x].concat(j.slice(1));if(L){var N=L[S.join(" ")];if(N===void 0)N=L[S.join(".")];if(N!==void 0)S=N}return S},q.prototype._decodeTime=function(A,L){var E=A.raw().toString();if(L==="gentime")var S=E.slice(0,4)|0,j=E.slice(4,6)|0,k=E.slice(6,8)|0,B=E.slice(8,10)|0,v=E.slice(10,12)|0,x=E.slice(12,14)|0;else if(L==="utctime"){var S=E.slice(0,2)|0,j=E.slice(2,4)|0,k=E.slice(4,6)|0,B=E.slice(6,8)|0,v=E.slice(8,10)|0,x=E.slice(10,12)|0;if(S<70)S=2000+S;else S=1900+S}else return A.error("Decoding "+L+" time is not supported yet");return Date.UTC(S,j-1,k,B,v,x,0)},q.prototype._decodeNull=function(A){return null},q.prototype._decodeBool=function(A){var L=A.readUInt8();if(A.isError(L))return L;else return L!==0},q.prototype._decodeInt=function(A,L){var E=A.raw(),S=new H(E);if(L)S=L[S.toString(10)]||S;return S},q.prototype._use=function(A,L){if(typeof A==="function")A=A(L);return A._getDecoder("der").tree};function z(A,L){var E=A.readUInt8(L);if(A.isError(E))return E;var S=$.tagClass[E>>6],j=(E&32)===0;if((E&31)===31){var k=E;E=0;while((k&128)===128){if(k=A.readUInt8(L),A.isError(k))return k;E<<=7,E|=k&127}}else E&=31;var B=$.tag[E];return{cls:S,primitive:j,tag:E,tagStr:B}}function T(A,L,E){var S=A.readUInt8(E);if(A.isError(S))return S;if(!L&&S===128)return null;if((S&128)===0)return S;var j=S&127;if(j>4)return A.error("length octect is too long");S=0;for(var k=0;k<j;k++){S<<=8;var B=A.readUInt8(E);if(A.isError(B))return B;S|=B}return S}}),dH=$0((U,Z)=>{var X=YU(),Q=(g1(),m0(N1)).Buffer,K=VV();function H($){K.call(this,$),this.enc="pem"}X(H,K),Z.exports=H,H.prototype.decode=function($,M){var q=$.toString().split(/[\r\n]+/g),z=M.label.toUpperCase(),T=/^-----(BEGIN|END) ([^-]+)-----$/,A=-1,L=-1;for(var E=0;E<q.length;E++){var S=q[E].match(T);if(S===null)continue;if(S[2]!==z)continue;if(A===-1){if(S[1]!=="BEGIN")break;A=E}else{if(S[1]!=="END")break;L=E;break}}if(A===-1||L===-1)throw Error("PEM section not found for: "+z);var j=q.slice(A+1,L).join("");j.replace(/[^a-z0-9\+\/=]+/gi,"");var k=new Q(j,"base64");return K.prototype.decode.call(this,k,M)}}),lH=$0((U)=>{var Z=U;Z.der=VV(),Z.pem=dH()}),$V=$0((U,Z)=>{var X=YU(),Q=(g1(),m0(N1)).Buffer,K=uZ(),H=K.base,$=K.constants.der;function M(A){this.enc="der",this.name=A.name,this.entity=A,this.tree=new q,this.tree._init(A.body)}Z.exports=M,M.prototype.encode=function(A,L){return this.tree._encode(A,L).join()};function q(A){H.Node.call(this,"der",A)}X(q,H.Node),q.prototype._encodeComposite=function(A,L,E,S){var j=T(A,L,E,this.reporter);if(S.length<128){var v=new Q(2);return v[0]=j,v[1]=S.length,this._createEncoderBuffer([v,S])}var k=1;for(var B=S.length;B>=256;B>>=8)k++;var v=new Q(2+k);v[0]=j,v[1]=128|k;for(var B=1+k,x=S.length;x>0;B--,x>>=8)v[B]=x&255;return this._createEncoderBuffer([v,S])},q.prototype._encodeStr=function(A,L){if(L==="bitstr")return this._createEncoderBuffer([A.unused|0,A.data]);else if(L==="bmpstr"){var E=new Q(A.length*2);for(var S=0;S<A.length;S++)E.writeUInt16BE(A.charCodeAt(S),S*2);return this._createEncoderBuffer(E)}else if(L==="numstr"){if(!this._isNumstr(A))return this.reporter.error("Encoding of string type: numstr supports only digits and space");return this._createEncoderBuffer(A)}else if(L==="printstr"){if(!this._isPrintstr(A))return this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark");return this._createEncoderBuffer(A)}else if(/str$/.test(L))return this._createEncoderBuffer(A);else if(L==="objDesc")return this._createEncoderBuffer(A);else return this.reporter.error("Encoding of string type: "+L+" unsupported")},q.prototype._encodeObjid=function(A,L,E){if(typeof A==="string"){if(!L)return this.reporter.error("string objid given, but no values map found");if(!L.hasOwnProperty(A))return this.reporter.error("objid not found in values map");A=L[A].split(/[\s\.]+/g);for(var S=0;S<A.length;S++)A[S]|=0}else if(Array.isArray(A)){A=A.slice();for(var S=0;S<A.length;S++)A[S]|=0}if(!Array.isArray(A))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(A));if(!E){if(A[1]>=40)return this.reporter.error("Second objid identifier OOB");A.splice(0,2,A[0]*40+A[1])}var j=0;for(var S=0;S<A.length;S++){var k=A[S];for(j++;k>=128;k>>=7)j++}var B=new Q(j),v=B.length-1;for(var S=A.length-1;S>=0;S--){var k=A[S];B[v--]=k&127;while((k>>=7)>0)B[v--]=128|k&127}return this._createEncoderBuffer(B)};function z(A){if(A<10)return"0"+A;else return A}q.prototype._encodeTime=function(A,L){var E,S=new Date(A);if(L==="gentime")E=[z(S.getFullYear()),z(S.getUTCMonth()+1),z(S.getUTCDate()),z(S.getUTCHours()),z(S.getUTCMinutes()),z(S.getUTCSeconds()),"Z"].join("");else if(L==="utctime")E=[z(S.getFullYear()%100),z(S.getUTCMonth()+1),z(S.getUTCDate()),z(S.getUTCHours()),z(S.getUTCMinutes()),z(S.getUTCSeconds()),"Z"].join("");else this.reporter.error("Encoding "+L+" time is not supported yet");return this._encodeStr(E,"octstr")},q.prototype._encodeNull=function(){return this._createEncoderBuffer("")},q.prototype._encodeInt=function(A,L){if(typeof A==="string"){if(!L)return this.reporter.error("String int or enum given, but no values map");if(!L.hasOwnProperty(A))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(A));A=L[A]}if(typeof A!=="number"&&!Q.isBuffer(A)){var E=A.toArray();if(!A.sign&&E[0]&128)E.unshift(0);A=new Q(E)}if(Q.isBuffer(A)){var S=A.length;if(A.length===0)S++;var k=new Q(S);if(A.copy(k),A.length===0)k[0]=0;return this._createEncoderBuffer(k)}if(A<128)return this._createEncoderBuffer(A);if(A<256)return this._createEncoderBuffer([0,A]);var S=1;for(var j=A;j>=256;j>>=8)S++;var k=Array(S);for(var j=k.length-1;j>=0;j--)k[j]=A&255,A>>=8;if(k[0]&128)k.unshift(0);return this._createEncoderBuffer(new Q(k))},q.prototype._encodeBool=function(A){return this._createEncoderBuffer(A?255:0)},q.prototype._use=function(A,L){if(typeof A==="function")A=A(L);return A._getEncoder("der").tree},q.prototype._skipDefault=function(A,L,E){var S=this._baseState,j;if(S.default===null)return!1;var k=A.join();if(S.defaultBuffer===void 0)S.defaultBuffer=this._encodeValue(S.default,L,E).join();if(k.length!==S.defaultBuffer.length)return!1;for(j=0;j<k.length;j++)if(k[j]!==S.defaultBuffer[j])return!1;return!0};function T(A,L,E,S){var j;if(A==="seqof")A="seq";else if(A==="setof")A="set";if($.tagByName.hasOwnProperty(A))j=$.tagByName[A];else if(typeof A==="number"&&(A|0)===A)j=A;else return S.error("Unknown tag: "+A);if(j>=31)return S.error("Multi-octet tag encoding unsupported");if(!L)j|=32;return j|=$.tagClassByName[E||"universal"]<<6,j}}),oH=$0((U,Z)=>{var X=YU(),Q=$V();function K(H){Q.call(this,H),this.enc="pem"}X(K,Q),Z.exports=K,K.prototype.encode=function(H,$){var M=Q.prototype.encode.call(this,H),q=M.toString("base64"),z=["-----BEGIN "+$.label+"-----"];for(var T=0;T<q.length;T+=64)z.push(q.slice(T,T+64));return z.push("-----END "+$.label+"-----"),z.join(`
|
|
15
|
-
`)}}),nH=$0((U)=>{var Z=U;Z.der=$V(),Z.pem=oH()}),uZ=$0((U)=>{var Z=U;Z.bignum=cH(),Z.define=pH().define,Z.base=wZ(),Z.constants=GV(),Z.decoders=lH(),Z.encoders=nH()}),mH=$0((U,Z)=>{var X=uZ(),Q=X.define("Time",function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})}),K=X.define("AttributeTypeValue",function(){this.seq().obj(this.key("type").objid(),this.key("value").any())}),H=X.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional(),this.key("curve").objid().optional())}),$=X.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(H),this.key("subjectPublicKey").bitstr())}),M=X.define("RelativeDistinguishedName",function(){this.setof(K)}),q=X.define("RDNSequence",function(){this.seqof(M)}),z=X.define("Name",function(){this.choice({rdnSequence:this.use(q)})}),T=X.define("Validity",function(){this.seq().obj(this.key("notBefore").use(Q),this.key("notAfter").use(Q))}),A=X.define("Extension",function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())}),L=X.define("TBSCertificate",function(){this.seq().obj(this.key("version").explicit(0).int().optional(),this.key("serialNumber").int(),this.key("signature").use(H),this.key("issuer").use(z),this.key("validity").use(T),this.key("subject").use(z),this.key("subjectPublicKeyInfo").use($),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(A).optional())}),E=X.define("X509Certificate",function(){this.seq().obj(this.key("tbsCertificate").use(L),this.key("signatureAlgorithm").use(H),this.key("signatureValue").bitstr())});Z.exports=E}),sH=$0((U)=>{var Z=uZ();U.certificate=mH();var X=Z.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())});U.RSAPrivateKey=X;var Q=Z.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});U.RSAPublicKey=Q;var K=Z.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())}),H=Z.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(K),this.key("subjectPublicKey").bitstr())});U.PublicKey=H;var $=Z.define("PrivateKeyInfo",function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(K),this.key("subjectPrivateKey").octstr())});U.PrivateKey=$;var M=Z.define("EncryptedPrivateKeyInfo",function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())});U.EncryptedPrivateKey=M;var q=Z.define("DSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())});U.DSAPrivateKey=q,U.DSAparam=Z.define("DSAparam",function(){this.int()});var z=Z.define("ECParameters",function(){this.choice({namedCurve:this.objid()})}),T=Z.define("ECPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(z),this.key("publicKey").optional().explicit(1).bitstr())});U.ECPrivateKey=T,U.signature=Z.define("signature",function(){this.seq().obj(this.key("r").int(),this.key("s").int())})}),rH=$0((U,Z)=>{Z.exports={"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"}}),aH=$0((U,Z)=>{var X=m1().Buffer,Q=mY().Transform,K=YU();function H(z){Q.call(this),this._block=X.allocUnsafe(z),this._blockSize=z,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}K(H,Q),H.prototype._transform=function(z,T,A){var L=null;try{this.update(z,T)}catch(E){L=E}A(L)},H.prototype._flush=function(z){var T=null;try{this.push(this.digest())}catch(A){T=A}z(T)};var $=typeof Uint8Array<"u",M=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&ArrayBuffer.isView&&(X.prototype instanceof Uint8Array||X.TYPED_ARRAY_SUPPORT);function q(z,T){if(z instanceof X)return z;if(typeof z==="string")return X.from(z,T);if(M&&ArrayBuffer.isView(z)){if(z.byteLength===0)return X.alloc(0);var A=X.from(z.buffer,z.byteOffset,z.byteLength);if(A.byteLength===z.byteLength)return A}if($&&z instanceof Uint8Array)return X.from(z);if(X.isBuffer(z)&&z.constructor&&typeof z.constructor.isBuffer==="function"&&z.constructor.isBuffer(z))return X.from(z);throw TypeError('The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView.')}H.prototype.update=function(z,T){if(this._finalized)throw Error("Digest already called");z=q(z,T);var A=this._block,L=0;while(this._blockOffset+z.length-L>=this._blockSize){for(var E=this._blockOffset;E<this._blockSize;)A[E++]=z[L++];this._update(),this._blockOffset=0}while(L<z.length)A[this._blockOffset++]=z[L++];for(var S=0,j=z.length*8;j>0;++S)if(this._length[S]+=j,j=this._length[S]/4294967296|0,j>0)this._length[S]-=4294967296*j;return this},H.prototype._update=function(){throw Error("_update is not implemented")},H.prototype.digest=function(z){if(this._finalized)throw Error("Digest already called");this._finalized=!0;var T=this._digest();if(z!==void 0)T=T.toString(z);this._block.fill(0),this._blockOffset=0;for(var A=0;A<4;++A)this._length[A]=0;return T},H.prototype._digest=function(){throw Error("_digest is not implemented")},Z.exports=H}),tH=$0((U,Z)=>{var X=YU(),Q=aH(),K=m1().Buffer,H=Array(16);function $(){Q.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}X($,Q),$.prototype._update=function(){var L=H;for(var E=0;E<16;++E)L[E]=this._block.readInt32LE(E*4);var S=this._a,j=this._b,k=this._c,B=this._d;S=q(S,j,k,B,L[0],3614090360,7),B=q(B,S,j,k,L[1],3905402710,12),k=q(k,B,S,j,L[2],606105819,17),j=q(j,k,B,S,L[3],3250441966,22),S=q(S,j,k,B,L[4],4118548399,7),B=q(B,S,j,k,L[5],1200080426,12),k=q(k,B,S,j,L[6],2821735955,17),j=q(j,k,B,S,L[7],4249261313,22),S=q(S,j,k,B,L[8],1770035416,7),B=q(B,S,j,k,L[9],2336552879,12),k=q(k,B,S,j,L[10],4294925233,17),j=q(j,k,B,S,L[11],2304563134,22),S=q(S,j,k,B,L[12],1804603682,7),B=q(B,S,j,k,L[13],4254626195,12),k=q(k,B,S,j,L[14],2792965006,17),j=q(j,k,B,S,L[15],1236535329,22),S=z(S,j,k,B,L[1],4129170786,5),B=z(B,S,j,k,L[6],3225465664,9),k=z(k,B,S,j,L[11],643717713,14),j=z(j,k,B,S,L[0],3921069994,20),S=z(S,j,k,B,L[5],3593408605,5),B=z(B,S,j,k,L[10],38016083,9),k=z(k,B,S,j,L[15],3634488961,14),j=z(j,k,B,S,L[4],3889429448,20),S=z(S,j,k,B,L[9],568446438,5),B=z(B,S,j,k,L[14],3275163606,9),k=z(k,B,S,j,L[3],4107603335,14),j=z(j,k,B,S,L[8],1163531501,20),S=z(S,j,k,B,L[13],2850285829,5),B=z(B,S,j,k,L[2],4243563512,9),k=z(k,B,S,j,L[7],1735328473,14),j=z(j,k,B,S,L[12],2368359562,20),S=T(S,j,k,B,L[5],4294588738,4),B=T(B,S,j,k,L[8],2272392833,11),k=T(k,B,S,j,L[11],1839030562,16),j=T(j,k,B,S,L[14],4259657740,23),S=T(S,j,k,B,L[1],2763975236,4),B=T(B,S,j,k,L[4],1272893353,11),k=T(k,B,S,j,L[7],4139469664,16),j=T(j,k,B,S,L[10],3200236656,23),S=T(S,j,k,B,L[13],681279174,4),B=T(B,S,j,k,L[0],3936430074,11),k=T(k,B,S,j,L[3],3572445317,16),j=T(j,k,B,S,L[6],76029189,23),S=T(S,j,k,B,L[9],3654602809,4),B=T(B,S,j,k,L[12],3873151461,11),k=T(k,B,S,j,L[15],530742520,16),j=T(j,k,B,S,L[2],3299628645,23),S=A(S,j,k,B,L[0],4096336452,6),B=A(B,S,j,k,L[7],1126891415,10),k=A(k,B,S,j,L[14],2878612391,15),j=A(j,k,B,S,L[5],4237533241,21),S=A(S,j,k,B,L[12],1700485571,6),B=A(B,S,j,k,L[3],2399980690,10),k=A(k,B,S,j,L[10],4293915773,15),j=A(j,k,B,S,L[1],2240044497,21),S=A(S,j,k,B,L[8],1873313359,6),B=A(B,S,j,k,L[15],4264355552,10),k=A(k,B,S,j,L[6],2734768916,15),j=A(j,k,B,S,L[13],1309151649,21),S=A(S,j,k,B,L[4],4149444226,6),B=A(B,S,j,k,L[11],3174756917,10),k=A(k,B,S,j,L[2],718787259,15),j=A(j,k,B,S,L[9],3951481745,21),this._a=this._a+S|0,this._b=this._b+j|0,this._c=this._c+k|0,this._d=this._d+B|0},$.prototype._digest=function(){if(this._block[this._blockOffset++]=128,this._blockOffset>56)this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0;this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var L=K.allocUnsafe(16);return L.writeInt32LE(this._a,0),L.writeInt32LE(this._b,4),L.writeInt32LE(this._c,8),L.writeInt32LE(this._d,12),L};function M(L,E){return L<<E|L>>>32-E}function q(L,E,S,j,k,B,v){return M(L+(E&S|~E&j)+k+B|0,v)+E|0}function z(L,E,S,j,k,B,v){return M(L+(E&j|S&~j)+k+B|0,v)+E|0}function T(L,E,S,j,k,B,v){return M(L+(E^S^j)+k+B|0,v)+E|0}function A(L,E,S,j,k,B,v){return M(L+(S^(E|~j))+k+B|0,v)+E|0}Z.exports=$}),iH=$0((U,Z)=>{var X=m1().Buffer,Q=tH();function K(H,$,M,q){if(!X.isBuffer(H))H=X.from(H,"binary");if($){if(!X.isBuffer($))$=X.from($,"binary");if($.length!==8)throw RangeError("salt should be Buffer with 8 byte length")}var z=M/8,T=X.alloc(z),A=X.alloc(q||0),L=X.alloc(0);while(z>0||q>0){var E=new Q;if(E.update(L),E.update(H),$)E.update($);L=E.digest();var S=0;if(z>0){var j=T.length-z;S=Math.min(z,L.length),L.copy(T,j,0,S),z-=S}if(S<L.length&&q>0){var k=A.length-q,B=Math.min(q,L.length-S);L.copy(A,k,S,S+B),q-=B}}return L.fill(0),{key:T,iv:A}}Z.exports=K}),KV=$0((U)=>{var Z=(UU(),m0(e1));U.createCipher=U.Cipher=Z.createCipher,U.createCipheriv=U.Cipheriv=Z.createCipheriv,U.createDecipher=U.Decipher=Z.createDecipher,U.createDecipheriv=U.Decipheriv=Z.createDecipheriv,U.listCiphers=U.getCiphers=Z.getCiphers}),eH=$0((U,Z)=>{var X=/Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r+/=]+)[\n\r]+/m,Q=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,K=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m,H=iH(),$=KV(),M=m1().Buffer;Z.exports=function(q,z){var T=q.toString(),A=T.match(X),L;if(!A){var E=T.match(K);L=M.from(E[2].replace(/[\r\n]/g,""),"base64")}else{var S="aes"+A[1],j=M.from(A[2],"hex"),k=M.from(A[3].replace(/[\r\n]/g,""),"base64"),B=H(z,j.slice(0,8),parseInt(A[1],10)).key,v=[],x=$.createDecipheriv(S,B,j);v.push(x.update(k)),v.push(x.final()),L=M.concat(v)}var N=T.match(Q)[1];return{tag:N,data:L}}}),WV=$0((U,Z)=>{var X=sH(),Q=rH(),K=eH(),H=KV(),$=eG().pbkdf2Sync,M=m1().Buffer;function q(T,A){var L=T.algorithm.decrypt.kde.kdeparams.salt,E=parseInt(T.algorithm.decrypt.kde.kdeparams.iters.toString(),10),S=Q[T.algorithm.decrypt.cipher.algo.join(".")],j=T.algorithm.decrypt.cipher.iv,k=T.subjectPrivateKey,B=parseInt(S.split("-")[1],10)/8,v=$(A,L,E,B,"sha1"),x=H.createDecipheriv(S,v,j),N=[];return N.push(x.update(k)),N.push(x.final()),M.concat(N)}function z(T){var A;if(typeof T==="object"&&!M.isBuffer(T))A=T.passphrase,T=T.key;if(typeof T==="string")T=M.from(T);var L=K(T,A),E=L.tag,S=L.data,j,k;switch(E){case"CERTIFICATE":k=X.certificate.decode(S,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":if(!k)k=X.PublicKey.decode(S,"der");switch(j=k.algorithm.algorithm.join("."),j){case"1.2.840.113549.1.1.1":return X.RSAPublicKey.decode(k.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return k.subjectPrivateKey=k.subjectPublicKey,{type:"ec",data:k};case"1.2.840.10040.4.1":return k.algorithm.params.pub_key=X.DSAparam.decode(k.subjectPublicKey.data,"der"),{type:"dsa",data:k.algorithm.params};default:throw Error("unknown key id "+j)}case"ENCRYPTED PRIVATE KEY":S=X.EncryptedPrivateKey.decode(S,"der"),S=q(S,A);case"PRIVATE KEY":switch(k=X.PrivateKey.decode(S,"der"),j=k.algorithm.algorithm.join("."),j){case"1.2.840.113549.1.1.1":return X.RSAPrivateKey.decode(k.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:k.algorithm.curve,privateKey:X.ECPrivateKey.decode(k.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return k.algorithm.params.priv_key=X.DSAparam.decode(k.subjectPrivateKey,"der"),{type:"dsa",params:k.algorithm.params};default:throw Error("unknown key id "+j)}case"RSA PUBLIC KEY":return X.RSAPublicKey.decode(S,"der");case"RSA PRIVATE KEY":return X.RSAPrivateKey.decode(S,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:X.DSAPrivateKey.decode(S,"der")};case"EC PRIVATE KEY":return S=X.ECPrivateKey.decode(S,"der"),{curve:S.parameters.value,privateKey:S.privateKey};default:throw Error("unknown key type "+E)}}z.signature=X.signature,Z.exports=z}),IV=$0((U,Z)=>{var X=_X(),Q=m1().Buffer;Z.exports=function(H,$){var M=Q.alloc(0),q=0,z;while(M.length<$)z=K(q++),M=Q.concat([M,X("sha1").update(H).update(z).digest()]);return M.slice(0,$)};function K(H){var $=Q.allocUnsafe(4);return $.writeUInt32BE(H,0),$}}),HV=$0((U,Z)=>{Z.exports=function(X,Q){var K=X.length,H=-1;while(++H<K)X[H]^=Q[H];return X}}),YJ=$0((U,Z)=>{(function(X,Q){function K(Y,V){if(!Y)throw Error(V||"Assertion failed")}function H(Y,V){Y.super_=V;var I=function(){};I.prototype=V.prototype,Y.prototype=new I,Y.prototype.constructor=Y}function $(Y,V,I){if($.isBN(Y))return Y;if(this.negative=0,this.words=null,this.length=0,this.red=null,Y!==null){if(V==="le"||V==="be")I=V,V=10;this._init(Y||0,V||10,I||"be")}}if(typeof X==="object")X.exports=$;else Q.BN=$;$.BN=$,$.wordSize=26;var M;try{if(typeof window<"u"&&typeof window.Buffer<"u")M=window.Buffer;else M=(g1(),m0(N1)).Buffer}catch(Y){}$.isBN=function(Y){if(Y instanceof $)return!0;return Y!==null&&typeof Y==="object"&&Y.constructor.wordSize===$.wordSize&&Array.isArray(Y.words)},$.max=function(Y,V){if(Y.cmp(V)>0)return Y;return V},$.min=function(Y,V){if(Y.cmp(V)<0)return Y;return V},$.prototype._init=function(Y,V,I){if(typeof Y==="number")return this._initNumber(Y,V,I);if(typeof Y==="object")return this._initArray(Y,V,I);if(V==="hex")V=16;K(V===(V|0)&&V>=2&&V<=36),Y=Y.toString().replace(/\s+/g,"");var G=0;if(Y[0]==="-")G++,this.negative=1;if(G<Y.length){if(V===16)this._parseHex(Y,G,I);else if(this._parseBase(Y,V,G),I==="le")this._initArray(this.toArray(),V,I)}},$.prototype._initNumber=function(Y,V,I){if(Y<0)this.negative=1,Y=-Y;if(Y<67108864)this.words=[Y&67108863],this.length=1;else if(Y<4503599627370496)this.words=[Y&67108863,Y/67108864&67108863],this.length=2;else K(Y<9007199254740992),this.words=[Y&67108863,Y/67108864&67108863,1],this.length=3;if(I!=="le")return;this._initArray(this.toArray(),V,I)},$.prototype._initArray=function(Y,V,I){if(K(typeof Y.length==="number"),Y.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(Y.length/3),this.words=Array(this.length);for(var G=0;G<this.length;G++)this.words[G]=0;var W,C,D=0;if(I==="be"){for(G=Y.length-1,W=0;G>=0;G-=3)if(C=Y[G]|Y[G-1]<<8|Y[G-2]<<16,this.words[W]|=C<<D&67108863,this.words[W+1]=C>>>26-D&67108863,D+=24,D>=26)D-=26,W++}else if(I==="le"){for(G=0,W=0;G<Y.length;G+=3)if(C=Y[G]|Y[G+1]<<8|Y[G+2]<<16,this.words[W]|=C<<D&67108863,this.words[W+1]=C>>>26-D&67108863,D+=24,D>=26)D-=26,W++}return this.strip()};function q(Y,V){var I=Y.charCodeAt(V);if(I>=65&&I<=70)return I-55;else if(I>=97&&I<=102)return I-87;else return I-48&15}function z(Y,V,I){var G=q(Y,I);if(I-1>=V)G|=q(Y,I-1)<<4;return G}$.prototype._parseHex=function(Y,V,I){this.length=Math.ceil((Y.length-V)/6),this.words=Array(this.length);for(var G=0;G<this.length;G++)this.words[G]=0;var W=0,C=0,D;if(I==="be")for(G=Y.length-1;G>=V;G-=2)if(D=z(Y,V,G)<<W,this.words[C]|=D&67108863,W>=18)W-=18,C+=1,this.words[C]|=D>>>26;else W+=8;else{var F=Y.length-V;for(G=F%2===0?V+1:V;G<Y.length;G+=2)if(D=z(Y,V,G)<<W,this.words[C]|=D&67108863,W>=18)W-=18,C+=1,this.words[C]|=D>>>26;else W+=8}this.strip()};function T(Y,V,I,G){var W=0,C=Math.min(Y.length,I);for(var D=V;D<C;D++){var F=Y.charCodeAt(D)-48;if(W*=G,F>=49)W+=F-49+10;else if(F>=17)W+=F-17+10;else W+=F}return W}$.prototype._parseBase=function(Y,V,I){this.words=[0],this.length=1;for(var G=0,W=1;W<=67108863;W*=V)G++;G--,W=W/V|0;var C=Y.length-I,D=C%G,F=Math.min(C,C-D)+I,J=0;for(var O=I;O<F;O+=G)if(J=T(Y,O,O+G,V),this.imuln(W),this.words[0]+J<67108864)this.words[0]+=J;else this._iaddn(J);if(D!==0){var P=1;J=T(Y,O,Y.length,V);for(O=0;O<D;O++)P*=V;if(this.imuln(P),this.words[0]+J<67108864)this.words[0]+=J;else this._iaddn(J)}this.strip()},$.prototype.copy=function(Y){Y.words=Array(this.length);for(var V=0;V<this.length;V++)Y.words[V]=this.words[V];Y.length=this.length,Y.negative=this.negative,Y.red=this.red},$.prototype.clone=function(){var Y=new $(null);return this.copy(Y),Y},$.prototype._expand=function(Y){while(this.length<Y)this.words[this.length++]=0;return this},$.prototype.strip=function(){while(this.length>1&&this.words[this.length-1]===0)this.length--;return this._normSign()},$.prototype._normSign=function(){if(this.length===1&&this.words[0]===0)this.negative=0;return this},$.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var A=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],L=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],E=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64000000,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,24300000,28629151,33554432,39135393,45435424,52521875,60466176];if($.prototype.toString=function(Y,V){Y=Y||10,V=V|0||1;var I;if(Y===16||Y==="hex"){I="";var G=0,W=0;for(var C=0;C<this.length;C++){var D=this.words[C],F=((D<<G|W)&16777215).toString(16);if(W=D>>>24-G&16777215,G+=2,G>=26)G-=26,C--;if(W!==0||C!==this.length-1)I=A[6-F.length]+F+I;else I=F+I}if(W!==0)I=W.toString(16)+I;while(I.length%V!==0)I="0"+I;if(this.negative!==0)I="-"+I;return I}if(Y===(Y|0)&&Y>=2&&Y<=36){var J=L[Y],O=E[Y];I="";var P=this.clone();P.negative=0;while(!P.isZero()){var R=P.modn(O).toString(Y);if(P=P.idivn(O),!P.isZero())I=A[J-R.length]+R+I;else I=R+I}if(this.isZero())I="0"+I;while(I.length%V!==0)I="0"+I;if(this.negative!==0)I="-"+I;return I}K(!1,"Base should be between 2 and 36")},$.prototype.toNumber=function(){var Y=this.words[0];if(this.length===2)Y+=this.words[1]*67108864;else if(this.length===3&&this.words[2]===1)Y+=4503599627370496+this.words[1]*67108864;else if(this.length>2)K(!1,"Number can only safely store up to 53 bits");return this.negative!==0?-Y:Y},$.prototype.toJSON=function(){return this.toString(16)},$.prototype.toBuffer=function(Y,V){return K(typeof M<"u"),this.toArrayLike(M,Y,V)},$.prototype.toArray=function(Y,V){return this.toArrayLike(Array,Y,V)},$.prototype.toArrayLike=function(Y,V,I){var G=this.byteLength(),W=I||Math.max(1,G);K(G<=W,"byte array longer than desired length"),K(W>0,"Requested array length <= 0"),this.strip();var C=V==="le",D=new Y(W),F,J,O=this.clone();if(!C){for(J=0;J<W-G;J++)D[J]=0;for(J=0;!O.isZero();J++)F=O.andln(255),O.iushrn(8),D[W-J-1]=F}else{for(J=0;!O.isZero();J++)F=O.andln(255),O.iushrn(8),D[J]=F;for(;J<W;J++)D[J]=0}return D},Math.clz32)$.prototype._countBits=function(Y){return 32-Math.clz32(Y)};else $.prototype._countBits=function(Y){var V=Y,I=0;if(V>=4096)I+=13,V>>>=13;if(V>=64)I+=7,V>>>=7;if(V>=8)I+=4,V>>>=4;if(V>=2)I+=2,V>>>=2;return I+V};$.prototype._zeroBits=function(Y){if(Y===0)return 26;var V=Y,I=0;if((V&8191)===0)I+=13,V>>>=13;if((V&127)===0)I+=7,V>>>=7;if((V&15)===0)I+=4,V>>>=4;if((V&3)===0)I+=2,V>>>=2;if((V&1)===0)I++;return I},$.prototype.bitLength=function(){var Y=this.words[this.length-1],V=this._countBits(Y);return(this.length-1)*26+V};function S(Y){var V=Array(Y.bitLength());for(var I=0;I<V.length;I++){var G=I/26|0,W=I%26;V[I]=(Y.words[G]&1<<W)>>>W}return V}$.prototype.zeroBits=function(){if(this.isZero())return 0;var Y=0;for(var V=0;V<this.length;V++){var I=this._zeroBits(this.words[V]);if(Y+=I,I!==26)break}return Y},$.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},$.prototype.toTwos=function(Y){if(this.negative!==0)return this.abs().inotn(Y).iaddn(1);return this.clone()},$.prototype.fromTwos=function(Y){if(this.testn(Y-1))return this.notn(Y).iaddn(1).ineg();return this.clone()},$.prototype.isNeg=function(){return this.negative!==0},$.prototype.neg=function(){return this.clone().ineg()},$.prototype.ineg=function(){if(!this.isZero())this.negative^=1;return this},$.prototype.iuor=function(Y){while(this.length<Y.length)this.words[this.length++]=0;for(var V=0;V<Y.length;V++)this.words[V]=this.words[V]|Y.words[V];return this.strip()},$.prototype.ior=function(Y){return K((this.negative|Y.negative)===0),this.iuor(Y)},$.prototype.or=function(Y){if(this.length>Y.length)return this.clone().ior(Y);return Y.clone().ior(this)},$.prototype.uor=function(Y){if(this.length>Y.length)return this.clone().iuor(Y);return Y.clone().iuor(this)},$.prototype.iuand=function(Y){var V;if(this.length>Y.length)V=Y;else V=this;for(var I=0;I<V.length;I++)this.words[I]=this.words[I]&Y.words[I];return this.length=V.length,this.strip()},$.prototype.iand=function(Y){return K((this.negative|Y.negative)===0),this.iuand(Y)},$.prototype.and=function(Y){if(this.length>Y.length)return this.clone().iand(Y);return Y.clone().iand(this)},$.prototype.uand=function(Y){if(this.length>Y.length)return this.clone().iuand(Y);return Y.clone().iuand(this)},$.prototype.iuxor=function(Y){var V,I;if(this.length>Y.length)V=this,I=Y;else V=Y,I=this;for(var G=0;G<I.length;G++)this.words[G]=V.words[G]^I.words[G];if(this!==V)for(;G<V.length;G++)this.words[G]=V.words[G];return this.length=V.length,this.strip()},$.prototype.ixor=function(Y){return K((this.negative|Y.negative)===0),this.iuxor(Y)},$.prototype.xor=function(Y){if(this.length>Y.length)return this.clone().ixor(Y);return Y.clone().ixor(this)},$.prototype.uxor=function(Y){if(this.length>Y.length)return this.clone().iuxor(Y);return Y.clone().iuxor(this)},$.prototype.inotn=function(Y){K(typeof Y==="number"&&Y>=0);var V=Math.ceil(Y/26)|0,I=Y%26;if(this._expand(V),I>0)V--;for(var G=0;G<V;G++)this.words[G]=~this.words[G]&67108863;if(I>0)this.words[G]=~this.words[G]&67108863>>26-I;return this.strip()},$.prototype.notn=function(Y){return this.clone().inotn(Y)},$.prototype.setn=function(Y,V){K(typeof Y==="number"&&Y>=0);var I=Y/26|0,G=Y%26;if(this._expand(I+1),V)this.words[I]=this.words[I]|1<<G;else this.words[I]=this.words[I]&~(1<<G);return this.strip()},$.prototype.iadd=function(Y){var V;if(this.negative!==0&&Y.negative===0)return this.negative=0,V=this.isub(Y),this.negative^=1,this._normSign();else if(this.negative===0&&Y.negative!==0)return Y.negative=0,V=this.isub(Y),Y.negative=1,V._normSign();var I,G;if(this.length>Y.length)I=this,G=Y;else I=Y,G=this;var W=0;for(var C=0;C<G.length;C++)V=(I.words[C]|0)+(G.words[C]|0)+W,this.words[C]=V&67108863,W=V>>>26;for(;W!==0&&C<I.length;C++)V=(I.words[C]|0)+W,this.words[C]=V&67108863,W=V>>>26;if(this.length=I.length,W!==0)this.words[this.length]=W,this.length++;else if(I!==this)for(;C<I.length;C++)this.words[C]=I.words[C];return this},$.prototype.add=function(Y){var V;if(Y.negative!==0&&this.negative===0)return Y.negative=0,V=this.sub(Y),Y.negative^=1,V;else if(Y.negative===0&&this.negative!==0)return this.negative=0,V=Y.sub(this),this.negative=1,V;if(this.length>Y.length)return this.clone().iadd(Y);return Y.clone().iadd(this)},$.prototype.isub=function(Y){if(Y.negative!==0){Y.negative=0;var V=this.iadd(Y);return Y.negative=1,V._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(Y),this.negative=1,this._normSign();var I=this.cmp(Y);if(I===0)return this.negative=0,this.length=1,this.words[0]=0,this;var G,W;if(I>0)G=this,W=Y;else G=Y,W=this;var C=0;for(var D=0;D<W.length;D++)V=(G.words[D]|0)-(W.words[D]|0)+C,C=V>>26,this.words[D]=V&67108863;for(;C!==0&&D<G.length;D++)V=(G.words[D]|0)+C,C=V>>26,this.words[D]=V&67108863;if(C===0&&D<G.length&&G!==this)for(;D<G.length;D++)this.words[D]=G.words[D];if(this.length=Math.max(this.length,D),G!==this)this.negative=1;return this.strip()},$.prototype.sub=function(Y){return this.clone().isub(Y)};function j(Y,V,I){I.negative=V.negative^Y.negative;var G=Y.length+V.length|0;I.length=G,G=G-1|0;var W=Y.words[0]|0,C=V.words[0]|0,D=W*C,F=D&67108863,J=D/67108864|0;I.words[0]=F;for(var O=1;O<G;O++){var P=J>>>26,R=J&67108863,_=Math.min(O,V.length-1);for(var f=Math.max(0,O-Y.length+1);f<=_;f++){var c=O-f|0;W=Y.words[c]|0,C=V.words[f]|0,D=W*C+R,P+=D/67108864|0,R=D&67108863}I.words[O]=R|0,J=P|0}if(J!==0)I.words[O]=J|0;else I.length--;return I.strip()}var k=function(Y,V,I){var G=Y.words,W=V.words,C=I.words,D=0,F,J,O,P=G[0]|0,R=P&8191,_=P>>>13,f=G[1]|0,c=f&8191,o=f>>>13,K0=G[2]|0,a=K0&8191,l=K0>>>13,Q0=G[3]|0,n=Q0&8191,s=Q0>>>13,f0=G[4]|0,y=f0&8191,h=f0>>>13,G0=G[5]|0,t=G0&8191,U0=G0>>>13,L0=G[6]|0,p=L0&8191,m=L0>>>13,g0=G[7]|0,r=g0&8191,J0=g0>>>13,h0=G[8]|0,F0=h0&8191,O0=h0>>>13,J1=G[9]|0,I0=J1&8191,C0=J1>>>13,K1=W[0]|0,M0=K1&8191,z0=K1>>>13,d1=W[1]|0,T0=d1&8191,j0=d1>>>13,l1=W[2]|0,v0=l1&8191,R0=l1>>>13,h1=W[3]|0,_0=h1&8191,E0=h1>>>13,_1=W[4]|0,B0=_1&8191,x0=_1>>>13,B1=W[5]|0,S0=B1&8191,g=B1>>>13,d=W[6]|0,e=d&8191,X0=d>>>13,y0=W[7]|0,H0=y0&8191,A0=y0>>>13,Q1=W[8]|0,P0=Q1&8191,N0=Q1>>>13,u1=W[9]|0,k0=u1&8191,q0=u1>>>13;I.negative=Y.negative^V.negative,I.length=19,F=Math.imul(R,M0),J=Math.imul(R,z0),J=J+Math.imul(_,M0)|0,O=Math.imul(_,z0);var G1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(G1>>>26)|0,G1&=67108863,F=Math.imul(c,M0),J=Math.imul(c,z0),J=J+Math.imul(o,M0)|0,O=Math.imul(o,z0),F=F+Math.imul(R,T0)|0,J=J+Math.imul(R,j0)|0,J=J+Math.imul(_,T0)|0,O=O+Math.imul(_,j0)|0;var l0=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(l0>>>26)|0,l0&=67108863,F=Math.imul(a,M0),J=Math.imul(a,z0),J=J+Math.imul(l,M0)|0,O=Math.imul(l,z0),F=F+Math.imul(c,T0)|0,J=J+Math.imul(c,j0)|0,J=J+Math.imul(o,T0)|0,O=O+Math.imul(o,j0)|0,F=F+Math.imul(R,v0)|0,J=J+Math.imul(R,R0)|0,J=J+Math.imul(_,v0)|0,O=O+Math.imul(_,R0)|0;var b0=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(b0>>>26)|0,b0&=67108863,F=Math.imul(n,M0),J=Math.imul(n,z0),J=J+Math.imul(s,M0)|0,O=Math.imul(s,z0),F=F+Math.imul(a,T0)|0,J=J+Math.imul(a,j0)|0,J=J+Math.imul(l,T0)|0,O=O+Math.imul(l,j0)|0,F=F+Math.imul(c,v0)|0,J=J+Math.imul(c,R0)|0,J=J+Math.imul(o,v0)|0,O=O+Math.imul(o,R0)|0,F=F+Math.imul(R,_0)|0,J=J+Math.imul(R,E0)|0,J=J+Math.imul(_,_0)|0,O=O+Math.imul(_,E0)|0;var t0=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(t0>>>26)|0,t0&=67108863,F=Math.imul(y,M0),J=Math.imul(y,z0),J=J+Math.imul(h,M0)|0,O=Math.imul(h,z0),F=F+Math.imul(n,T0)|0,J=J+Math.imul(n,j0)|0,J=J+Math.imul(s,T0)|0,O=O+Math.imul(s,j0)|0,F=F+Math.imul(a,v0)|0,J=J+Math.imul(a,R0)|0,J=J+Math.imul(l,v0)|0,O=O+Math.imul(l,R0)|0,F=F+Math.imul(c,_0)|0,J=J+Math.imul(c,E0)|0,J=J+Math.imul(o,_0)|0,O=O+Math.imul(o,E0)|0,F=F+Math.imul(R,B0)|0,J=J+Math.imul(R,x0)|0,J=J+Math.imul(_,B0)|0,O=O+Math.imul(_,x0)|0;var r0=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(r0>>>26)|0,r0&=67108863,F=Math.imul(t,M0),J=Math.imul(t,z0),J=J+Math.imul(U0,M0)|0,O=Math.imul(U0,z0),F=F+Math.imul(y,T0)|0,J=J+Math.imul(y,j0)|0,J=J+Math.imul(h,T0)|0,O=O+Math.imul(h,j0)|0,F=F+Math.imul(n,v0)|0,J=J+Math.imul(n,R0)|0,J=J+Math.imul(s,v0)|0,O=O+Math.imul(s,R0)|0,F=F+Math.imul(a,_0)|0,J=J+Math.imul(a,E0)|0,J=J+Math.imul(l,_0)|0,O=O+Math.imul(l,E0)|0,F=F+Math.imul(c,B0)|0,J=J+Math.imul(c,x0)|0,J=J+Math.imul(o,B0)|0,O=O+Math.imul(o,x0)|0,F=F+Math.imul(R,S0)|0,J=J+Math.imul(R,g)|0,J=J+Math.imul(_,S0)|0,O=O+Math.imul(_,g)|0;var F1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(F1>>>26)|0,F1&=67108863,F=Math.imul(p,M0),J=Math.imul(p,z0),J=J+Math.imul(m,M0)|0,O=Math.imul(m,z0),F=F+Math.imul(t,T0)|0,J=J+Math.imul(t,j0)|0,J=J+Math.imul(U0,T0)|0,O=O+Math.imul(U0,j0)|0,F=F+Math.imul(y,v0)|0,J=J+Math.imul(y,R0)|0,J=J+Math.imul(h,v0)|0,O=O+Math.imul(h,R0)|0,F=F+Math.imul(n,_0)|0,J=J+Math.imul(n,E0)|0,J=J+Math.imul(s,_0)|0,O=O+Math.imul(s,E0)|0,F=F+Math.imul(a,B0)|0,J=J+Math.imul(a,x0)|0,J=J+Math.imul(l,B0)|0,O=O+Math.imul(l,x0)|0,F=F+Math.imul(c,S0)|0,J=J+Math.imul(c,g)|0,J=J+Math.imul(o,S0)|0,O=O+Math.imul(o,g)|0,F=F+Math.imul(R,e)|0,J=J+Math.imul(R,X0)|0,J=J+Math.imul(_,e)|0,O=O+Math.imul(_,X0)|0;var O1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(O1>>>26)|0,O1&=67108863,F=Math.imul(r,M0),J=Math.imul(r,z0),J=J+Math.imul(J0,M0)|0,O=Math.imul(J0,z0),F=F+Math.imul(p,T0)|0,J=J+Math.imul(p,j0)|0,J=J+Math.imul(m,T0)|0,O=O+Math.imul(m,j0)|0,F=F+Math.imul(t,v0)|0,J=J+Math.imul(t,R0)|0,J=J+Math.imul(U0,v0)|0,O=O+Math.imul(U0,R0)|0,F=F+Math.imul(y,_0)|0,J=J+Math.imul(y,E0)|0,J=J+Math.imul(h,_0)|0,O=O+Math.imul(h,E0)|0,F=F+Math.imul(n,B0)|0,J=J+Math.imul(n,x0)|0,J=J+Math.imul(s,B0)|0,O=O+Math.imul(s,x0)|0,F=F+Math.imul(a,S0)|0,J=J+Math.imul(a,g)|0,J=J+Math.imul(l,S0)|0,O=O+Math.imul(l,g)|0,F=F+Math.imul(c,e)|0,J=J+Math.imul(c,X0)|0,J=J+Math.imul(o,e)|0,O=O+Math.imul(o,X0)|0,F=F+Math.imul(R,H0)|0,J=J+Math.imul(R,A0)|0,J=J+Math.imul(_,H0)|0,O=O+Math.imul(_,A0)|0;var C1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(C1>>>26)|0,C1&=67108863,F=Math.imul(F0,M0),J=Math.imul(F0,z0),J=J+Math.imul(O0,M0)|0,O=Math.imul(O0,z0),F=F+Math.imul(r,T0)|0,J=J+Math.imul(r,j0)|0,J=J+Math.imul(J0,T0)|0,O=O+Math.imul(J0,j0)|0,F=F+Math.imul(p,v0)|0,J=J+Math.imul(p,R0)|0,J=J+Math.imul(m,v0)|0,O=O+Math.imul(m,R0)|0,F=F+Math.imul(t,_0)|0,J=J+Math.imul(t,E0)|0,J=J+Math.imul(U0,_0)|0,O=O+Math.imul(U0,E0)|0,F=F+Math.imul(y,B0)|0,J=J+Math.imul(y,x0)|0,J=J+Math.imul(h,B0)|0,O=O+Math.imul(h,x0)|0,F=F+Math.imul(n,S0)|0,J=J+Math.imul(n,g)|0,J=J+Math.imul(s,S0)|0,O=O+Math.imul(s,g)|0,F=F+Math.imul(a,e)|0,J=J+Math.imul(a,X0)|0,J=J+Math.imul(l,e)|0,O=O+Math.imul(l,X0)|0,F=F+Math.imul(c,H0)|0,J=J+Math.imul(c,A0)|0,J=J+Math.imul(o,H0)|0,O=O+Math.imul(o,A0)|0,F=F+Math.imul(R,P0)|0,J=J+Math.imul(R,N0)|0,J=J+Math.imul(_,P0)|0,O=O+Math.imul(_,N0)|0;var A1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(A1>>>26)|0,A1&=67108863,F=Math.imul(I0,M0),J=Math.imul(I0,z0),J=J+Math.imul(C0,M0)|0,O=Math.imul(C0,z0),F=F+Math.imul(F0,T0)|0,J=J+Math.imul(F0,j0)|0,J=J+Math.imul(O0,T0)|0,O=O+Math.imul(O0,j0)|0,F=F+Math.imul(r,v0)|0,J=J+Math.imul(r,R0)|0,J=J+Math.imul(J0,v0)|0,O=O+Math.imul(J0,R0)|0,F=F+Math.imul(p,_0)|0,J=J+Math.imul(p,E0)|0,J=J+Math.imul(m,_0)|0,O=O+Math.imul(m,E0)|0,F=F+Math.imul(t,B0)|0,J=J+Math.imul(t,x0)|0,J=J+Math.imul(U0,B0)|0,O=O+Math.imul(U0,x0)|0,F=F+Math.imul(y,S0)|0,J=J+Math.imul(y,g)|0,J=J+Math.imul(h,S0)|0,O=O+Math.imul(h,g)|0,F=F+Math.imul(n,e)|0,J=J+Math.imul(n,X0)|0,J=J+Math.imul(s,e)|0,O=O+Math.imul(s,X0)|0,F=F+Math.imul(a,H0)|0,J=J+Math.imul(a,A0)|0,J=J+Math.imul(l,H0)|0,O=O+Math.imul(l,A0)|0,F=F+Math.imul(c,P0)|0,J=J+Math.imul(c,N0)|0,J=J+Math.imul(o,P0)|0,O=O+Math.imul(o,N0)|0,F=F+Math.imul(R,k0)|0,J=J+Math.imul(R,q0)|0,J=J+Math.imul(_,k0)|0,O=O+Math.imul(_,q0)|0;var z1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(z1>>>26)|0,z1&=67108863,F=Math.imul(I0,T0),J=Math.imul(I0,j0),J=J+Math.imul(C0,T0)|0,O=Math.imul(C0,j0),F=F+Math.imul(F0,v0)|0,J=J+Math.imul(F0,R0)|0,J=J+Math.imul(O0,v0)|0,O=O+Math.imul(O0,R0)|0,F=F+Math.imul(r,_0)|0,J=J+Math.imul(r,E0)|0,J=J+Math.imul(J0,_0)|0,O=O+Math.imul(J0,E0)|0,F=F+Math.imul(p,B0)|0,J=J+Math.imul(p,x0)|0,J=J+Math.imul(m,B0)|0,O=O+Math.imul(m,x0)|0,F=F+Math.imul(t,S0)|0,J=J+Math.imul(t,g)|0,J=J+Math.imul(U0,S0)|0,O=O+Math.imul(U0,g)|0,F=F+Math.imul(y,e)|0,J=J+Math.imul(y,X0)|0,J=J+Math.imul(h,e)|0,O=O+Math.imul(h,X0)|0,F=F+Math.imul(n,H0)|0,J=J+Math.imul(n,A0)|0,J=J+Math.imul(s,H0)|0,O=O+Math.imul(s,A0)|0,F=F+Math.imul(a,P0)|0,J=J+Math.imul(a,N0)|0,J=J+Math.imul(l,P0)|0,O=O+Math.imul(l,N0)|0,F=F+Math.imul(c,k0)|0,J=J+Math.imul(c,q0)|0,J=J+Math.imul(o,k0)|0,O=O+Math.imul(o,q0)|0;var D1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(D1>>>26)|0,D1&=67108863,F=Math.imul(I0,v0),J=Math.imul(I0,R0),J=J+Math.imul(C0,v0)|0,O=Math.imul(C0,R0),F=F+Math.imul(F0,_0)|0,J=J+Math.imul(F0,E0)|0,J=J+Math.imul(O0,_0)|0,O=O+Math.imul(O0,E0)|0,F=F+Math.imul(r,B0)|0,J=J+Math.imul(r,x0)|0,J=J+Math.imul(J0,B0)|0,O=O+Math.imul(J0,x0)|0,F=F+Math.imul(p,S0)|0,J=J+Math.imul(p,g)|0,J=J+Math.imul(m,S0)|0,O=O+Math.imul(m,g)|0,F=F+Math.imul(t,e)|0,J=J+Math.imul(t,X0)|0,J=J+Math.imul(U0,e)|0,O=O+Math.imul(U0,X0)|0,F=F+Math.imul(y,H0)|0,J=J+Math.imul(y,A0)|0,J=J+Math.imul(h,H0)|0,O=O+Math.imul(h,A0)|0,F=F+Math.imul(n,P0)|0,J=J+Math.imul(n,N0)|0,J=J+Math.imul(s,P0)|0,O=O+Math.imul(s,N0)|0,F=F+Math.imul(a,k0)|0,J=J+Math.imul(a,q0)|0,J=J+Math.imul(l,k0)|0,O=O+Math.imul(l,q0)|0;var M1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(M1>>>26)|0,M1&=67108863,F=Math.imul(I0,_0),J=Math.imul(I0,E0),J=J+Math.imul(C0,_0)|0,O=Math.imul(C0,E0),F=F+Math.imul(F0,B0)|0,J=J+Math.imul(F0,x0)|0,J=J+Math.imul(O0,B0)|0,O=O+Math.imul(O0,x0)|0,F=F+Math.imul(r,S0)|0,J=J+Math.imul(r,g)|0,J=J+Math.imul(J0,S0)|0,O=O+Math.imul(J0,g)|0,F=F+Math.imul(p,e)|0,J=J+Math.imul(p,X0)|0,J=J+Math.imul(m,e)|0,O=O+Math.imul(m,X0)|0,F=F+Math.imul(t,H0)|0,J=J+Math.imul(t,A0)|0,J=J+Math.imul(U0,H0)|0,O=O+Math.imul(U0,A0)|0,F=F+Math.imul(y,P0)|0,J=J+Math.imul(y,N0)|0,J=J+Math.imul(h,P0)|0,O=O+Math.imul(h,N0)|0,F=F+Math.imul(n,k0)|0,J=J+Math.imul(n,q0)|0,J=J+Math.imul(s,k0)|0,O=O+Math.imul(s,q0)|0;var q1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(q1>>>26)|0,q1&=67108863,F=Math.imul(I0,B0),J=Math.imul(I0,x0),J=J+Math.imul(C0,B0)|0,O=Math.imul(C0,x0),F=F+Math.imul(F0,S0)|0,J=J+Math.imul(F0,g)|0,J=J+Math.imul(O0,S0)|0,O=O+Math.imul(O0,g)|0,F=F+Math.imul(r,e)|0,J=J+Math.imul(r,X0)|0,J=J+Math.imul(J0,e)|0,O=O+Math.imul(J0,X0)|0,F=F+Math.imul(p,H0)|0,J=J+Math.imul(p,A0)|0,J=J+Math.imul(m,H0)|0,O=O+Math.imul(m,A0)|0,F=F+Math.imul(t,P0)|0,J=J+Math.imul(t,N0)|0,J=J+Math.imul(U0,P0)|0,O=O+Math.imul(U0,N0)|0,F=F+Math.imul(y,k0)|0,J=J+Math.imul(y,q0)|0,J=J+Math.imul(h,k0)|0,O=O+Math.imul(h,q0)|0;var L1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(L1>>>26)|0,L1&=67108863,F=Math.imul(I0,S0),J=Math.imul(I0,g),J=J+Math.imul(C0,S0)|0,O=Math.imul(C0,g),F=F+Math.imul(F0,e)|0,J=J+Math.imul(F0,X0)|0,J=J+Math.imul(O0,e)|0,O=O+Math.imul(O0,X0)|0,F=F+Math.imul(r,H0)|0,J=J+Math.imul(r,A0)|0,J=J+Math.imul(J0,H0)|0,O=O+Math.imul(J0,A0)|0,F=F+Math.imul(p,P0)|0,J=J+Math.imul(p,N0)|0,J=J+Math.imul(m,P0)|0,O=O+Math.imul(m,N0)|0,F=F+Math.imul(t,k0)|0,J=J+Math.imul(t,q0)|0,J=J+Math.imul(U0,k0)|0,O=O+Math.imul(U0,q0)|0;var T1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(T1>>>26)|0,T1&=67108863,F=Math.imul(I0,e),J=Math.imul(I0,X0),J=J+Math.imul(C0,e)|0,O=Math.imul(C0,X0),F=F+Math.imul(F0,H0)|0,J=J+Math.imul(F0,A0)|0,J=J+Math.imul(O0,H0)|0,O=O+Math.imul(O0,A0)|0,F=F+Math.imul(r,P0)|0,J=J+Math.imul(r,N0)|0,J=J+Math.imul(J0,P0)|0,O=O+Math.imul(J0,N0)|0,F=F+Math.imul(p,k0)|0,J=J+Math.imul(p,q0)|0,J=J+Math.imul(m,k0)|0,O=O+Math.imul(m,q0)|0;var R1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(R1>>>26)|0,R1&=67108863,F=Math.imul(I0,H0),J=Math.imul(I0,A0),J=J+Math.imul(C0,H0)|0,O=Math.imul(C0,A0),F=F+Math.imul(F0,P0)|0,J=J+Math.imul(F0,N0)|0,J=J+Math.imul(O0,P0)|0,O=O+Math.imul(O0,N0)|0,F=F+Math.imul(r,k0)|0,J=J+Math.imul(r,q0)|0,J=J+Math.imul(J0,k0)|0,O=O+Math.imul(J0,q0)|0;var E1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(E1>>>26)|0,E1&=67108863,F=Math.imul(I0,P0),J=Math.imul(I0,N0),J=J+Math.imul(C0,P0)|0,O=Math.imul(C0,N0),F=F+Math.imul(F0,k0)|0,J=J+Math.imul(F0,q0)|0,J=J+Math.imul(O0,k0)|0,O=O+Math.imul(O0,q0)|0;var S1=(D+F|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(S1>>>26)|0,S1&=67108863,F=Math.imul(I0,k0),J=Math.imul(I0,q0),J=J+Math.imul(C0,k0)|0,O=Math.imul(C0,q0);var P1=(D+F|0)+((J&8191)<<13)|0;if(D=(O+(J>>>13)|0)+(P1>>>26)|0,P1&=67108863,C[0]=G1,C[1]=l0,C[2]=b0,C[3]=t0,C[4]=r0,C[5]=F1,C[6]=O1,C[7]=C1,C[8]=A1,C[9]=z1,C[10]=D1,C[11]=M1,C[12]=q1,C[13]=L1,C[14]=T1,C[15]=R1,C[16]=E1,C[17]=S1,C[18]=P1,D!==0)C[19]=D,I.length++;return I};if(!Math.imul)k=j;function B(Y,V,I){I.negative=V.negative^Y.negative,I.length=Y.length+V.length;var G=0,W=0;for(var C=0;C<I.length-1;C++){var D=W;W=0;var F=G&67108863,J=Math.min(C,V.length-1);for(var O=Math.max(0,C-Y.length+1);O<=J;O++){var P=C-O,R=Y.words[P]|0,_=V.words[O]|0,f=R*_,c=f&67108863;D=D+(f/67108864|0)|0,c=c+F|0,F=c&67108863,D=D+(c>>>26)|0,W+=D>>>26,D&=67108863}I.words[C]=F,G=D,D=W}if(G!==0)I.words[C]=G;else I.length--;return I.strip()}function v(Y,V,I){var G=new x;return G.mulp(Y,V,I)}$.prototype.mulTo=function(Y,V){var I,G=this.length+Y.length;if(this.length===10&&Y.length===10)I=k(this,Y,V);else if(G<63)I=j(this,Y,V);else if(G<1024)I=B(this,Y,V);else I=v(this,Y,V);return I};function x(Y,V){this.x=Y,this.y=V}x.prototype.makeRBT=function(Y){var V=Array(Y),I=$.prototype._countBits(Y)-1;for(var G=0;G<Y;G++)V[G]=this.revBin(G,I,Y);return V},x.prototype.revBin=function(Y,V,I){if(Y===0||Y===I-1)return Y;var G=0;for(var W=0;W<V;W++)G|=(Y&1)<<V-W-1,Y>>=1;return G},x.prototype.permute=function(Y,V,I,G,W,C){for(var D=0;D<C;D++)G[D]=V[Y[D]],W[D]=I[Y[D]]},x.prototype.transform=function(Y,V,I,G,W,C){this.permute(C,Y,V,I,G,W);for(var D=1;D<W;D<<=1){var F=D<<1,J=Math.cos(2*Math.PI/F),O=Math.sin(2*Math.PI/F);for(var P=0;P<W;P+=F){var R=J,_=O;for(var f=0;f<D;f++){var c=I[P+f],o=G[P+f],K0=I[P+f+D],a=G[P+f+D],l=R*K0-_*a;if(a=R*a+_*K0,K0=l,I[P+f]=c+K0,G[P+f]=o+a,I[P+f+D]=c-K0,G[P+f+D]=o-a,f!==F)l=J*R-O*_,_=J*_+O*R,R=l}}}},x.prototype.guessLen13b=function(Y,V){var I=Math.max(V,Y)|1,G=I&1,W=0;for(I=I/2|0;I;I=I>>>1)W++;return 1<<W+1+G},x.prototype.conjugate=function(Y,V,I){if(I<=1)return;for(var G=0;G<I/2;G++){var W=Y[G];Y[G]=Y[I-G-1],Y[I-G-1]=W,W=V[G],V[G]=-V[I-G-1],V[I-G-1]=-W}},x.prototype.normalize13b=function(Y,V){var I=0;for(var G=0;G<V/2;G++){var W=Math.round(Y[2*G+1]/V)*8192+Math.round(Y[2*G]/V)+I;if(Y[G]=W&67108863,W<67108864)I=0;else I=W/67108864|0}return Y},x.prototype.convert13b=function(Y,V,I,G){var W=0;for(var C=0;C<V;C++)W=W+(Y[C]|0),I[2*C]=W&8191,W=W>>>13,I[2*C+1]=W&8191,W=W>>>13;for(C=2*V;C<G;++C)I[C]=0;K(W===0),K((W&-8192)===0)},x.prototype.stub=function(Y){var V=Array(Y);for(var I=0;I<Y;I++)V[I]=0;return V},x.prototype.mulp=function(Y,V,I){var G=2*this.guessLen13b(Y.length,V.length),W=this.makeRBT(G),C=this.stub(G),D=Array(G),F=Array(G),J=Array(G),O=Array(G),P=Array(G),R=Array(G),_=I.words;_.length=G,this.convert13b(Y.words,Y.length,D,G),this.convert13b(V.words,V.length,O,G),this.transform(D,C,F,J,G,W),this.transform(O,C,P,R,G,W);for(var f=0;f<G;f++){var c=F[f]*P[f]-J[f]*R[f];J[f]=F[f]*R[f]+J[f]*P[f],F[f]=c}return this.conjugate(F,J,G),this.transform(F,J,_,C,G,W),this.conjugate(_,C,G),this.normalize13b(_,G),I.negative=Y.negative^V.negative,I.length=Y.length+V.length,I.strip()},$.prototype.mul=function(Y){var V=new $(null);return V.words=Array(this.length+Y.length),this.mulTo(Y,V)},$.prototype.mulf=function(Y){var V=new $(null);return V.words=Array(this.length+Y.length),v(this,Y,V)},$.prototype.imul=function(Y){return this.clone().mulTo(Y,this)},$.prototype.imuln=function(Y){K(typeof Y==="number"),K(Y<67108864);var V=0;for(var I=0;I<this.length;I++){var G=(this.words[I]|0)*Y,W=(G&67108863)+(V&67108863);V>>=26,V+=G/67108864|0,V+=W>>>26,this.words[I]=W&67108863}if(V!==0)this.words[I]=V,this.length++;return this.length=Y===0?1:this.length,this},$.prototype.muln=function(Y){return this.clone().imuln(Y)},$.prototype.sqr=function(){return this.mul(this)},$.prototype.isqr=function(){return this.imul(this.clone())},$.prototype.pow=function(Y){var V=S(Y);if(V.length===0)return new $(1);var I=this;for(var G=0;G<V.length;G++,I=I.sqr())if(V[G]!==0)break;if(++G<V.length)for(var W=I.sqr();G<V.length;G++,W=W.sqr()){if(V[G]===0)continue;I=I.mul(W)}return I},$.prototype.iushln=function(Y){K(typeof Y==="number"&&Y>=0);var V=Y%26,I=(Y-V)/26,G=67108863>>>26-V<<26-V,W;if(V!==0){var C=0;for(W=0;W<this.length;W++){var D=this.words[W]&G,F=(this.words[W]|0)-D<<V;this.words[W]=F|C,C=D>>>26-V}if(C)this.words[W]=C,this.length++}if(I!==0){for(W=this.length-1;W>=0;W--)this.words[W+I]=this.words[W];for(W=0;W<I;W++)this.words[W]=0;this.length+=I}return this.strip()},$.prototype.ishln=function(Y){return K(this.negative===0),this.iushln(Y)},$.prototype.iushrn=function(Y,V,I){K(typeof Y==="number"&&Y>=0);var G;if(V)G=(V-V%26)/26;else G=0;var W=Y%26,C=Math.min((Y-W)/26,this.length),D=67108863^67108863>>>W<<W,F=I;if(G-=C,G=Math.max(0,G),F){for(var J=0;J<C;J++)F.words[J]=this.words[J];F.length=C}if(C===0);else if(this.length>C){this.length-=C;for(J=0;J<this.length;J++)this.words[J]=this.words[J+C]}else this.words[0]=0,this.length=1;var O=0;for(J=this.length-1;J>=0&&(O!==0||J>=G);J--){var P=this.words[J]|0;this.words[J]=O<<26-W|P>>>W,O=P&D}if(F&&O!==0)F.words[F.length++]=O;if(this.length===0)this.words[0]=0,this.length=1;return this.strip()},$.prototype.ishrn=function(Y,V,I){return K(this.negative===0),this.iushrn(Y,V,I)},$.prototype.shln=function(Y){return this.clone().ishln(Y)},$.prototype.ushln=function(Y){return this.clone().iushln(Y)},$.prototype.shrn=function(Y){return this.clone().ishrn(Y)},$.prototype.ushrn=function(Y){return this.clone().iushrn(Y)},$.prototype.testn=function(Y){K(typeof Y==="number"&&Y>=0);var V=Y%26,I=(Y-V)/26,G=1<<V;if(this.length<=I)return!1;var W=this.words[I];return!!(W&G)},$.prototype.imaskn=function(Y){K(typeof Y==="number"&&Y>=0);var V=Y%26,I=(Y-V)/26;if(K(this.negative===0,"imaskn works only with positive numbers"),this.length<=I)return this;if(V!==0)I++;if(this.length=Math.min(I,this.length),V!==0){var G=67108863^67108863>>>V<<V;this.words[this.length-1]&=G}return this.strip()},$.prototype.maskn=function(Y){return this.clone().imaskn(Y)},$.prototype.iaddn=function(Y){if(K(typeof Y==="number"),K(Y<67108864),Y<0)return this.isubn(-Y);if(this.negative!==0){if(this.length===1&&(this.words[0]|0)<Y)return this.words[0]=Y-(this.words[0]|0),this.negative=0,this;return this.negative=0,this.isubn(Y),this.negative=1,this}return this._iaddn(Y)},$.prototype._iaddn=function(Y){this.words[0]+=Y;for(var V=0;V<this.length&&this.words[V]>=67108864;V++)if(this.words[V]-=67108864,V===this.length-1)this.words[V+1]=1;else this.words[V+1]++;return this.length=Math.max(this.length,V+1),this},$.prototype.isubn=function(Y){if(K(typeof Y==="number"),K(Y<67108864),Y<0)return this.iaddn(-Y);if(this.negative!==0)return this.negative=0,this.iaddn(Y),this.negative=1,this;if(this.words[0]-=Y,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var V=0;V<this.length&&this.words[V]<0;V++)this.words[V]+=67108864,this.words[V+1]-=1;return this.strip()},$.prototype.addn=function(Y){return this.clone().iaddn(Y)},$.prototype.subn=function(Y){return this.clone().isubn(Y)},$.prototype.iabs=function(){return this.negative=0,this},$.prototype.abs=function(){return this.clone().iabs()},$.prototype._ishlnsubmul=function(Y,V,I){var G=Y.length+I,W;this._expand(G);var C,D=0;for(W=0;W<Y.length;W++){C=(this.words[W+I]|0)+D;var F=(Y.words[W]|0)*V;C-=F&67108863,D=(C>>26)-(F/67108864|0),this.words[W+I]=C&67108863}for(;W<this.length-I;W++)C=(this.words[W+I]|0)+D,D=C>>26,this.words[W+I]=C&67108863;if(D===0)return this.strip();K(D===-1),D=0;for(W=0;W<this.length;W++)C=-(this.words[W]|0)+D,D=C>>26,this.words[W]=C&67108863;return this.negative=1,this.strip()},$.prototype._wordDiv=function(Y,V){var I=this.length-Y.length,G=this.clone(),W=Y,C=W.words[W.length-1]|0,D=this._countBits(C);if(I=26-D,I!==0)W=W.ushln(I),G.iushln(I),C=W.words[W.length-1]|0;var F=G.length-W.length,J;if(V!=="mod"){J=new $(null),J.length=F+1,J.words=Array(J.length);for(var O=0;O<J.length;O++)J.words[O]=0}var P=G.clone()._ishlnsubmul(W,1,F);if(P.negative===0){if(G=P,J)J.words[F]=1}for(var R=F-1;R>=0;R--){var _=(G.words[W.length+R]|0)*67108864+(G.words[W.length+R-1]|0);_=Math.min(_/C|0,67108863),G._ishlnsubmul(W,_,R);while(G.negative!==0)if(_--,G.negative=0,G._ishlnsubmul(W,1,R),!G.isZero())G.negative^=1;if(J)J.words[R]=_}if(J)J.strip();if(G.strip(),V!=="div"&&I!==0)G.iushrn(I);return{div:J||null,mod:G}},$.prototype.divmod=function(Y,V,I){if(K(!Y.isZero()),this.isZero())return{div:new $(0),mod:new $(0)};var G,W,C;if(this.negative!==0&&Y.negative===0){if(C=this.neg().divmod(Y,V),V!=="mod")G=C.div.neg();if(V!=="div"){if(W=C.mod.neg(),I&&W.negative!==0)W.iadd(Y)}return{div:G,mod:W}}if(this.negative===0&&Y.negative!==0){if(C=this.divmod(Y.neg(),V),V!=="mod")G=C.div.neg();return{div:G,mod:C.mod}}if((this.negative&Y.negative)!==0){if(C=this.neg().divmod(Y.neg(),V),V!=="div"){if(W=C.mod.neg(),I&&W.negative!==0)W.isub(Y)}return{div:C.div,mod:W}}if(Y.length>this.length||this.cmp(Y)<0)return{div:new $(0),mod:this};if(Y.length===1){if(V==="div")return{div:this.divn(Y.words[0]),mod:null};if(V==="mod")return{div:null,mod:new $(this.modn(Y.words[0]))};return{div:this.divn(Y.words[0]),mod:new $(this.modn(Y.words[0]))}}return this._wordDiv(Y,V)},$.prototype.div=function(Y){return this.divmod(Y,"div",!1).div},$.prototype.mod=function(Y){return this.divmod(Y,"mod",!1).mod},$.prototype.umod=function(Y){return this.divmod(Y,"mod",!0).mod},$.prototype.divRound=function(Y){var V=this.divmod(Y);if(V.mod.isZero())return V.div;var I=V.div.negative!==0?V.mod.isub(Y):V.mod,G=Y.ushrn(1),W=Y.andln(1),C=I.cmp(G);if(C<0||W===1&&C===0)return V.div;return V.div.negative!==0?V.div.isubn(1):V.div.iaddn(1)},$.prototype.modn=function(Y){K(Y<=67108863);var V=67108864%Y,I=0;for(var G=this.length-1;G>=0;G--)I=(V*I+(this.words[G]|0))%Y;return I},$.prototype.idivn=function(Y){K(Y<=67108863);var V=0;for(var I=this.length-1;I>=0;I--){var G=(this.words[I]|0)+V*67108864;this.words[I]=G/Y|0,V=G%Y}return this.strip()},$.prototype.divn=function(Y){return this.clone().idivn(Y)},$.prototype.egcd=function(Y){K(Y.negative===0),K(!Y.isZero());var V=this,I=Y.clone();if(V.negative!==0)V=V.umod(Y);else V=V.clone();var G=new $(1),W=new $(0),C=new $(0),D=new $(1),F=0;while(V.isEven()&&I.isEven())V.iushrn(1),I.iushrn(1),++F;var J=I.clone(),O=V.clone();while(!V.isZero()){for(var P=0,R=1;(V.words[0]&R)===0&&P<26;++P,R<<=1);if(P>0){V.iushrn(P);while(P-- >0){if(G.isOdd()||W.isOdd())G.iadd(J),W.isub(O);G.iushrn(1),W.iushrn(1)}}for(var _=0,f=1;(I.words[0]&f)===0&&_<26;++_,f<<=1);if(_>0){I.iushrn(_);while(_-- >0){if(C.isOdd()||D.isOdd())C.iadd(J),D.isub(O);C.iushrn(1),D.iushrn(1)}}if(V.cmp(I)>=0)V.isub(I),G.isub(C),W.isub(D);else I.isub(V),C.isub(G),D.isub(W)}return{a:C,b:D,gcd:I.iushln(F)}},$.prototype._invmp=function(Y){K(Y.negative===0),K(!Y.isZero());var V=this,I=Y.clone();if(V.negative!==0)V=V.umod(Y);else V=V.clone();var G=new $(1),W=new $(0),C=I.clone();while(V.cmpn(1)>0&&I.cmpn(1)>0){for(var D=0,F=1;(V.words[0]&F)===0&&D<26;++D,F<<=1);if(D>0){V.iushrn(D);while(D-- >0){if(G.isOdd())G.iadd(C);G.iushrn(1)}}for(var J=0,O=1;(I.words[0]&O)===0&&J<26;++J,O<<=1);if(J>0){I.iushrn(J);while(J-- >0){if(W.isOdd())W.iadd(C);W.iushrn(1)}}if(V.cmp(I)>=0)V.isub(I),G.isub(W);else I.isub(V),W.isub(G)}var P;if(V.cmpn(1)===0)P=G;else P=W;if(P.cmpn(0)<0)P.iadd(Y);return P},$.prototype.gcd=function(Y){if(this.isZero())return Y.abs();if(Y.isZero())return this.abs();var V=this.clone(),I=Y.clone();V.negative=0,I.negative=0;for(var G=0;V.isEven()&&I.isEven();G++)V.iushrn(1),I.iushrn(1);do{while(V.isEven())V.iushrn(1);while(I.isEven())I.iushrn(1);var W=V.cmp(I);if(W<0){var C=V;V=I,I=C}else if(W===0||I.cmpn(1)===0)break;V.isub(I)}while(!0);return I.iushln(G)},$.prototype.invm=function(Y){return this.egcd(Y).a.umod(Y)},$.prototype.isEven=function(){return(this.words[0]&1)===0},$.prototype.isOdd=function(){return(this.words[0]&1)===1},$.prototype.andln=function(Y){return this.words[0]&Y},$.prototype.bincn=function(Y){K(typeof Y==="number");var V=Y%26,I=(Y-V)/26,G=1<<V;if(this.length<=I)return this._expand(I+1),this.words[I]|=G,this;var W=G;for(var C=I;W!==0&&C<this.length;C++){var D=this.words[C]|0;D+=W,W=D>>>26,D&=67108863,this.words[C]=D}if(W!==0)this.words[C]=W,this.length++;return this},$.prototype.isZero=function(){return this.length===1&&this.words[0]===0},$.prototype.cmpn=function(Y){var V=Y<0;if(this.negative!==0&&!V)return-1;if(this.negative===0&&V)return 1;this.strip();var I;if(this.length>1)I=1;else{if(V)Y=-Y;K(Y<=67108863,"Number is too big");var G=this.words[0]|0;I=G===Y?0:G<Y?-1:1}if(this.negative!==0)return-I|0;return I},$.prototype.cmp=function(Y){if(this.negative!==0&&Y.negative===0)return-1;if(this.negative===0&&Y.negative!==0)return 1;var V=this.ucmp(Y);if(this.negative!==0)return-V|0;return V},$.prototype.ucmp=function(Y){if(this.length>Y.length)return 1;if(this.length<Y.length)return-1;var V=0;for(var I=this.length-1;I>=0;I--){var G=this.words[I]|0,W=Y.words[I]|0;if(G===W)continue;if(G<W)V=-1;else if(G>W)V=1;break}return V},$.prototype.gtn=function(Y){return this.cmpn(Y)===1},$.prototype.gt=function(Y){return this.cmp(Y)===1},$.prototype.gten=function(Y){return this.cmpn(Y)>=0},$.prototype.gte=function(Y){return this.cmp(Y)>=0},$.prototype.ltn=function(Y){return this.cmpn(Y)===-1},$.prototype.lt=function(Y){return this.cmp(Y)===-1},$.prototype.lten=function(Y){return this.cmpn(Y)<=0},$.prototype.lte=function(Y){return this.cmp(Y)<=0},$.prototype.eqn=function(Y){return this.cmpn(Y)===0},$.prototype.eq=function(Y){return this.cmp(Y)===0},$.red=function(Y){return new b(Y)},$.prototype.toRed=function(Y){return K(!this.red,"Already a number in reduction context"),K(this.negative===0,"red works only with positives"),Y.convertTo(this)._forceRed(Y)},$.prototype.fromRed=function(){return K(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},$.prototype._forceRed=function(Y){return this.red=Y,this},$.prototype.forceRed=function(Y){return K(!this.red,"Already a number in reduction context"),this._forceRed(Y)},$.prototype.redAdd=function(Y){return K(this.red,"redAdd works only with red numbers"),this.red.add(this,Y)},$.prototype.redIAdd=function(Y){return K(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,Y)},$.prototype.redSub=function(Y){return K(this.red,"redSub works only with red numbers"),this.red.sub(this,Y)},$.prototype.redISub=function(Y){return K(this.red,"redISub works only with red numbers"),this.red.isub(this,Y)},$.prototype.redShl=function(Y){return K(this.red,"redShl works only with red numbers"),this.red.shl(this,Y)},$.prototype.redMul=function(Y){return K(this.red,"redMul works only with red numbers"),this.red._verify2(this,Y),this.red.mul(this,Y)},$.prototype.redIMul=function(Y){return K(this.red,"redMul works only with red numbers"),this.red._verify2(this,Y),this.red.imul(this,Y)},$.prototype.redSqr=function(){return K(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},$.prototype.redISqr=function(){return K(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},$.prototype.redSqrt=function(){return K(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},$.prototype.redInvm=function(){return K(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},$.prototype.redNeg=function(){return K(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},$.prototype.redPow=function(Y){return K(this.red&&!Y.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,Y)};var N={k256:null,p224:null,p192:null,p25519:null};function w(Y,V){this.name=Y,this.p=new $(V,16),this.n=this.p.bitLength(),this.k=new $(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}w.prototype._tmp=function(){var Y=new $(null);return Y.words=Array(Math.ceil(this.n/13)),Y},w.prototype.ireduce=function(Y){var V=Y,I;do this.split(V,this.tmp),V=this.imulK(V),V=V.iadd(this.tmp),I=V.bitLength();while(I>this.n);var G=I<this.n?-1:V.ucmp(this.p);if(G===0)V.words[0]=0,V.length=1;else if(G>0)V.isub(this.p);else if(V.strip!==void 0)V.strip();else V._strip();return V},w.prototype.split=function(Y,V){Y.iushrn(this.n,0,V)},w.prototype.imulK=function(Y){return Y.imul(this.k)};function u(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}H(u,w),u.prototype.split=function(Y,V){var I=4194303,G=Math.min(Y.length,9);for(var W=0;W<G;W++)V.words[W]=Y.words[W];if(V.length=G,Y.length<=9){Y.words[0]=0,Y.length=1;return}var C=Y.words[9];V.words[V.length++]=C&I;for(W=10;W<Y.length;W++){var D=Y.words[W]|0;Y.words[W-10]=(D&I)<<4|C>>>22,C=D}if(C>>>=22,Y.words[W-10]=C,C===0&&Y.length>10)Y.length-=10;else Y.length-=9},u.prototype.imulK=function(Y){Y.words[Y.length]=0,Y.words[Y.length+1]=0,Y.length+=2;var V=0;for(var I=0;I<Y.length;I++){var G=Y.words[I]|0;V+=G*977,Y.words[I]=V&67108863,V=G*64+(V/67108864|0)}if(Y.words[Y.length-1]===0){if(Y.length--,Y.words[Y.length-1]===0)Y.length--}return Y};function Z0(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}H(Z0,w);function V0(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}H(V0,w);function Y0(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}H(Y0,w),Y0.prototype.imulK=function(Y){var V=0;for(var I=0;I<Y.length;I++){var G=(Y.words[I]|0)*19+V,W=G&67108863;G>>>=26,Y.words[I]=W,V=G}if(V!==0)Y.words[Y.length++]=V;return Y},$._prime=function(Y){if(N[Y])return N[Y];var V;if(Y==="k256")V=new u;else if(Y==="p224")V=new Z0;else if(Y==="p192")V=new V0;else if(Y==="p25519")V=new Y0;else throw Error("Unknown prime "+Y);return N[Y]=V,V};function b(Y){if(typeof Y==="string"){var V=$._prime(Y);this.m=V.p,this.prime=V}else K(Y.gtn(1),"modulus must be greater than 1"),this.m=Y,this.prime=null}b.prototype._verify1=function(Y){K(Y.negative===0,"red works only with positives"),K(Y.red,"red works only with red numbers")},b.prototype._verify2=function(Y,V){K((Y.negative|V.negative)===0,"red works only with positives"),K(Y.red&&Y.red===V.red,"red works only with red numbers")},b.prototype.imod=function(Y){if(this.prime)return this.prime.ireduce(Y)._forceRed(this);return Y.umod(this.m)._forceRed(this)},b.prototype.neg=function(Y){if(Y.isZero())return Y.clone();return this.m.sub(Y)._forceRed(this)},b.prototype.add=function(Y,V){this._verify2(Y,V);var I=Y.add(V);if(I.cmp(this.m)>=0)I.isub(this.m);return I._forceRed(this)},b.prototype.iadd=function(Y,V){this._verify2(Y,V);var I=Y.iadd(V);if(I.cmp(this.m)>=0)I.isub(this.m);return I},b.prototype.sub=function(Y,V){this._verify2(Y,V);var I=Y.sub(V);if(I.cmpn(0)<0)I.iadd(this.m);return I._forceRed(this)},b.prototype.isub=function(Y,V){this._verify2(Y,V);var I=Y.isub(V);if(I.cmpn(0)<0)I.iadd(this.m);return I},b.prototype.shl=function(Y,V){return this._verify1(Y),this.imod(Y.ushln(V))},b.prototype.imul=function(Y,V){return this._verify2(Y,V),this.imod(Y.imul(V))},b.prototype.mul=function(Y,V){return this._verify2(Y,V),this.imod(Y.mul(V))},b.prototype.isqr=function(Y){return this.imul(Y,Y.clone())},b.prototype.sqr=function(Y){return this.mul(Y,Y)},b.prototype.sqrt=function(Y){if(Y.isZero())return Y.clone();var V=this.m.andln(3);if(K(V%2===1),V===3){var I=this.m.add(new $(1)).iushrn(2);return this.pow(Y,I)}var G=this.m.subn(1),W=0;while(!G.isZero()&&G.andln(1)===0)W++,G.iushrn(1);K(!G.isZero());var C=new $(1).toRed(this),D=C.redNeg(),F=this.m.subn(1).iushrn(1),J=this.m.bitLength();J=new $(2*J*J).toRed(this);while(this.pow(J,F).cmp(D)!==0)J.redIAdd(D);var O=this.pow(J,G),P=this.pow(Y,G.addn(1).iushrn(1)),R=this.pow(Y,G),_=W;while(R.cmp(C)!==0){var f=R;for(var c=0;f.cmp(C)!==0;c++)f=f.redSqr();K(c<_);var o=this.pow(O,new $(1).iushln(_-c-1));P=P.redMul(o),O=o.redSqr(),R=R.redMul(O),_=c}return P},b.prototype.invm=function(Y){var V=Y._invmp(this.m);if(V.negative!==0)return V.negative=0,this.imod(V).redNeg();else return this.imod(V)},b.prototype.pow=function(Y,V){if(V.isZero())return new $(1).toRed(this);if(V.cmpn(1)===0)return Y.clone();var I=4,G=Array(1<<I);G[0]=new $(1).toRed(this),G[1]=Y;for(var W=2;W<G.length;W++)G[W]=this.mul(G[W-1],Y);var C=G[0],D=0,F=0,J=V.bitLength()%26;if(J===0)J=26;for(W=V.length-1;W>=0;W--){var O=V.words[W];for(var P=J-1;P>=0;P--){var R=O>>P&1;if(C!==G[0])C=this.sqr(C);if(R===0&&D===0){F=0;continue}if(D<<=1,D|=R,F++,F!==I&&(W!==0||P!==0))continue;C=this.mul(C,G[D]),F=0,D=0}J=26}return C},b.prototype.convertTo=function(Y){var V=Y.umod(this.m);return V===Y?V.clone():V},b.prototype.convertFrom=function(Y){var V=Y.clone();return V.red=null,V},$.mont=function(Y){return new i(Y)};function i(Y){if(b.call(this,Y),this.shift=this.m.bitLength(),this.shift%26!==0)this.shift+=26-this.shift%26;this.r=new $(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}H(i,b),i.prototype.convertTo=function(Y){return this.imod(Y.ushln(this.shift))},i.prototype.convertFrom=function(Y){var V=this.imod(Y.mul(this.rinv));return V.red=null,V},i.prototype.imul=function(Y,V){if(Y.isZero()||V.isZero())return Y.words[0]=0,Y.length=1,Y;var I=Y.imul(V),G=I.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),W=I.isub(G).iushrn(this.shift),C=W;if(W.cmp(this.m)>=0)C=W.isub(this.m);else if(W.cmpn(0)<0)C=W.iadd(this.m);return C._forceRed(this)},i.prototype.mul=function(Y,V){if(Y.isZero()||V.isZero())return new $(0)._forceRed(this);var I=Y.mul(V),G=I.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),W=I.isub(G).iushrn(this.shift),C=W;if(W.cmp(this.m)>=0)C=W.isub(this.m);else if(W.cmpn(0)<0)C=W.iadd(this.m);return C._forceRed(this)},i.prototype.invm=function(Y){var V=this.imod(Y._invmp(this.m).mul(this.r2));return V._forceRed(this)}})(typeof Z>"u"||Z,U)}),FV=$0((U,Z)=>{var X=YJ(),Q=m1().Buffer;function K(H,$){return Q.from(H.toRed(X.mont($.modulus)).redPow(new X($.publicExponent)).fromRed().toArray())}Z.exports=K}),UF=$0((U,Z)=>{(function(X,Q){function K(G,W){if(!G)throw Error(W||"Assertion failed")}function H(G,W){G.super_=W;var C=function(){};C.prototype=W.prototype,G.prototype=new C,G.prototype.constructor=G}function $(G,W,C){if($.isBN(G))return G;if(this.negative=0,this.words=null,this.length=0,this.red=null,G!==null){if(W==="le"||W==="be")C=W,W=10;this._init(G||0,W||10,C||"be")}}if(typeof X==="object")X.exports=$;else Q.BN=$;$.BN=$,$.wordSize=26;var M;try{if(typeof window<"u"&&typeof window.Buffer<"u")M=window.Buffer;else M=(g1(),m0(N1)).Buffer}catch(G){}$.isBN=function(G){if(G instanceof $)return!0;return G!==null&&typeof G==="object"&&G.constructor.wordSize===$.wordSize&&Array.isArray(G.words)},$.max=function(G,W){if(G.cmp(W)>0)return G;return W},$.min=function(G,W){if(G.cmp(W)<0)return G;return W},$.prototype._init=function(G,W,C){if(typeof G==="number")return this._initNumber(G,W,C);if(typeof G==="object")return this._initArray(G,W,C);if(W==="hex")W=16;K(W===(W|0)&&W>=2&&W<=36),G=G.toString().replace(/\s+/g,"");var D=0;if(G[0]==="-")D++,this.negative=1;if(D<G.length){if(W===16)this._parseHex(G,D,C);else if(this._parseBase(G,W,D),C==="le")this._initArray(this.toArray(),W,C)}},$.prototype._initNumber=function(G,W,C){if(G<0)this.negative=1,G=-G;if(G<67108864)this.words=[G&67108863],this.length=1;else if(G<4503599627370496)this.words=[G&67108863,G/67108864&67108863],this.length=2;else K(G<9007199254740992),this.words=[G&67108863,G/67108864&67108863,1],this.length=3;if(C!=="le")return;this._initArray(this.toArray(),W,C)},$.prototype._initArray=function(G,W,C){if(K(typeof G.length==="number"),G.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(G.length/3),this.words=Array(this.length);for(var D=0;D<this.length;D++)this.words[D]=0;var F,J,O=0;if(C==="be"){for(D=G.length-1,F=0;D>=0;D-=3)if(J=G[D]|G[D-1]<<8|G[D-2]<<16,this.words[F]|=J<<O&67108863,this.words[F+1]=J>>>26-O&67108863,O+=24,O>=26)O-=26,F++}else if(C==="le"){for(D=0,F=0;D<G.length;D+=3)if(J=G[D]|G[D+1]<<8|G[D+2]<<16,this.words[F]|=J<<O&67108863,this.words[F+1]=J>>>26-O&67108863,O+=24,O>=26)O-=26,F++}return this._strip()};function q(G,W){var C=G.charCodeAt(W);if(C>=48&&C<=57)return C-48;else if(C>=65&&C<=70)return C-55;else if(C>=97&&C<=102)return C-87;else K(!1,"Invalid character in "+G)}function z(G,W,C){var D=q(G,C);if(C-1>=W)D|=q(G,C-1)<<4;return D}$.prototype._parseHex=function(G,W,C){this.length=Math.ceil((G.length-W)/6),this.words=Array(this.length);for(var D=0;D<this.length;D++)this.words[D]=0;var F=0,J=0,O;if(C==="be")for(D=G.length-1;D>=W;D-=2)if(O=z(G,W,D)<<F,this.words[J]|=O&67108863,F>=18)F-=18,J+=1,this.words[J]|=O>>>26;else F+=8;else{var P=G.length-W;for(D=P%2===0?W+1:W;D<G.length;D+=2)if(O=z(G,W,D)<<F,this.words[J]|=O&67108863,F>=18)F-=18,J+=1,this.words[J]|=O>>>26;else F+=8}this._strip()};function T(G,W,C,D){var F=0,J=0,O=Math.min(G.length,C);for(var P=W;P<O;P++){var R=G.charCodeAt(P)-48;if(F*=D,R>=49)J=R-49+10;else if(R>=17)J=R-17+10;else J=R;K(R>=0&&J<D,"Invalid character"),F+=J}return F}$.prototype._parseBase=function(G,W,C){this.words=[0],this.length=1;for(var D=0,F=1;F<=67108863;F*=W)D++;D--,F=F/W|0;var J=G.length-C,O=J%D,P=Math.min(J,J-O)+C,R=0;for(var _=C;_<P;_+=D)if(R=T(G,_,_+D,W),this.imuln(F),this.words[0]+R<67108864)this.words[0]+=R;else this._iaddn(R);if(O!==0){var f=1;R=T(G,_,G.length,W);for(_=0;_<O;_++)f*=W;if(this.imuln(f),this.words[0]+R<67108864)this.words[0]+=R;else this._iaddn(R)}this._strip()},$.prototype.copy=function(G){G.words=Array(this.length);for(var W=0;W<this.length;W++)G.words[W]=this.words[W];G.length=this.length,G.negative=this.negative,G.red=this.red};function A(G,W){G.words=W.words,G.length=W.length,G.negative=W.negative,G.red=W.red}if($.prototype._move=function(G){A(G,this)},$.prototype.clone=function(){var G=new $(null);return this.copy(G),G},$.prototype._expand=function(G){while(this.length<G)this.words[this.length++]=0;return this},$.prototype._strip=function(){while(this.length>1&&this.words[this.length-1]===0)this.length--;return this._normSign()},$.prototype._normSign=function(){if(this.length===1&&this.words[0]===0)this.negative=0;return this},typeof Symbol<"u"&&typeof Symbol.for==="function")try{$.prototype[Symbol.for("nodejs.util.inspect.custom")]=L}catch(G){$.prototype.inspect=L}else $.prototype.inspect=L;function L(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var E=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],S=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],j=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64000000,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,24300000,28629151,33554432,39135393,45435424,52521875,60466176];if($.prototype.toString=function(G,W){G=G||10,W=W|0||1;var C;if(G===16||G==="hex"){C="";var D=0,F=0;for(var J=0;J<this.length;J++){var O=this.words[J],P=((O<<D|F)&16777215).toString(16);if(F=O>>>24-D&16777215,D+=2,D>=26)D-=26,J--;if(F!==0||J!==this.length-1)C=E[6-P.length]+P+C;else C=P+C}if(F!==0)C=F.toString(16)+C;while(C.length%W!==0)C="0"+C;if(this.negative!==0)C="-"+C;return C}if(G===(G|0)&&G>=2&&G<=36){var R=S[G],_=j[G];C="";var f=this.clone();f.negative=0;while(!f.isZero()){var c=f.modrn(_).toString(G);if(f=f.idivn(_),!f.isZero())C=E[R-c.length]+c+C;else C=c+C}if(this.isZero())C="0"+C;while(C.length%W!==0)C="0"+C;if(this.negative!==0)C="-"+C;return C}K(!1,"Base should be between 2 and 36")},$.prototype.toNumber=function(){var G=this.words[0];if(this.length===2)G+=this.words[1]*67108864;else if(this.length===3&&this.words[2]===1)G+=4503599627370496+this.words[1]*67108864;else if(this.length>2)K(!1,"Number can only safely store up to 53 bits");return this.negative!==0?-G:G},$.prototype.toJSON=function(){return this.toString(16,2)},M)$.prototype.toBuffer=function(G,W){return this.toArrayLike(M,G,W)};$.prototype.toArray=function(G,W){return this.toArrayLike(Array,G,W)};var k=function(G,W){if(G.allocUnsafe)return G.allocUnsafe(W);return new G(W)};if($.prototype.toArrayLike=function(G,W,C){this._strip();var D=this.byteLength(),F=C||Math.max(1,D);K(D<=F,"byte array longer than desired length"),K(F>0,"Requested array length <= 0");var J=k(G,F),O=W==="le"?"LE":"BE";return this["_toArrayLike"+O](J,D),J},$.prototype._toArrayLikeLE=function(G,W){var C=0,D=0;for(var F=0,J=0;F<this.length;F++){var O=this.words[F]<<J|D;if(G[C++]=O&255,C<G.length)G[C++]=O>>8&255;if(C<G.length)G[C++]=O>>16&255;if(J===6){if(C<G.length)G[C++]=O>>24&255;D=0,J=0}else D=O>>>24,J+=2}if(C<G.length){G[C++]=D;while(C<G.length)G[C++]=0}},$.prototype._toArrayLikeBE=function(G,W){var C=G.length-1,D=0;for(var F=0,J=0;F<this.length;F++){var O=this.words[F]<<J|D;if(G[C--]=O&255,C>=0)G[C--]=O>>8&255;if(C>=0)G[C--]=O>>16&255;if(J===6){if(C>=0)G[C--]=O>>24&255;D=0,J=0}else D=O>>>24,J+=2}if(C>=0){G[C--]=D;while(C>=0)G[C--]=0}},Math.clz32)$.prototype._countBits=function(G){return 32-Math.clz32(G)};else $.prototype._countBits=function(G){var W=G,C=0;if(W>=4096)C+=13,W>>>=13;if(W>=64)C+=7,W>>>=7;if(W>=8)C+=4,W>>>=4;if(W>=2)C+=2,W>>>=2;return C+W};$.prototype._zeroBits=function(G){if(G===0)return 26;var W=G,C=0;if((W&8191)===0)C+=13,W>>>=13;if((W&127)===0)C+=7,W>>>=7;if((W&15)===0)C+=4,W>>>=4;if((W&3)===0)C+=2,W>>>=2;if((W&1)===0)C++;return C},$.prototype.bitLength=function(){var G=this.words[this.length-1],W=this._countBits(G);return(this.length-1)*26+W};function B(G){var W=Array(G.bitLength());for(var C=0;C<W.length;C++){var D=C/26|0,F=C%26;W[C]=G.words[D]>>>F&1}return W}$.prototype.zeroBits=function(){if(this.isZero())return 0;var G=0;for(var W=0;W<this.length;W++){var C=this._zeroBits(this.words[W]);if(G+=C,C!==26)break}return G},$.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},$.prototype.toTwos=function(G){if(this.negative!==0)return this.abs().inotn(G).iaddn(1);return this.clone()},$.prototype.fromTwos=function(G){if(this.testn(G-1))return this.notn(G).iaddn(1).ineg();return this.clone()},$.prototype.isNeg=function(){return this.negative!==0},$.prototype.neg=function(){return this.clone().ineg()},$.prototype.ineg=function(){if(!this.isZero())this.negative^=1;return this},$.prototype.iuor=function(G){while(this.length<G.length)this.words[this.length++]=0;for(var W=0;W<G.length;W++)this.words[W]=this.words[W]|G.words[W];return this._strip()},$.prototype.ior=function(G){return K((this.negative|G.negative)===0),this.iuor(G)},$.prototype.or=function(G){if(this.length>G.length)return this.clone().ior(G);return G.clone().ior(this)},$.prototype.uor=function(G){if(this.length>G.length)return this.clone().iuor(G);return G.clone().iuor(this)},$.prototype.iuand=function(G){var W;if(this.length>G.length)W=G;else W=this;for(var C=0;C<W.length;C++)this.words[C]=this.words[C]&G.words[C];return this.length=W.length,this._strip()},$.prototype.iand=function(G){return K((this.negative|G.negative)===0),this.iuand(G)},$.prototype.and=function(G){if(this.length>G.length)return this.clone().iand(G);return G.clone().iand(this)},$.prototype.uand=function(G){if(this.length>G.length)return this.clone().iuand(G);return G.clone().iuand(this)},$.prototype.iuxor=function(G){var W,C;if(this.length>G.length)W=this,C=G;else W=G,C=this;for(var D=0;D<C.length;D++)this.words[D]=W.words[D]^C.words[D];if(this!==W)for(;D<W.length;D++)this.words[D]=W.words[D];return this.length=W.length,this._strip()},$.prototype.ixor=function(G){return K((this.negative|G.negative)===0),this.iuxor(G)},$.prototype.xor=function(G){if(this.length>G.length)return this.clone().ixor(G);return G.clone().ixor(this)},$.prototype.uxor=function(G){if(this.length>G.length)return this.clone().iuxor(G);return G.clone().iuxor(this)},$.prototype.inotn=function(G){K(typeof G==="number"&&G>=0);var W=Math.ceil(G/26)|0,C=G%26;if(this._expand(W),C>0)W--;for(var D=0;D<W;D++)this.words[D]=~this.words[D]&67108863;if(C>0)this.words[D]=~this.words[D]&67108863>>26-C;return this._strip()},$.prototype.notn=function(G){return this.clone().inotn(G)},$.prototype.setn=function(G,W){K(typeof G==="number"&&G>=0);var C=G/26|0,D=G%26;if(this._expand(C+1),W)this.words[C]=this.words[C]|1<<D;else this.words[C]=this.words[C]&~(1<<D);return this._strip()},$.prototype.iadd=function(G){var W;if(this.negative!==0&&G.negative===0)return this.negative=0,W=this.isub(G),this.negative^=1,this._normSign();else if(this.negative===0&&G.negative!==0)return G.negative=0,W=this.isub(G),G.negative=1,W._normSign();var C,D;if(this.length>G.length)C=this,D=G;else C=G,D=this;var F=0;for(var J=0;J<D.length;J++)W=(C.words[J]|0)+(D.words[J]|0)+F,this.words[J]=W&67108863,F=W>>>26;for(;F!==0&&J<C.length;J++)W=(C.words[J]|0)+F,this.words[J]=W&67108863,F=W>>>26;if(this.length=C.length,F!==0)this.words[this.length]=F,this.length++;else if(C!==this)for(;J<C.length;J++)this.words[J]=C.words[J];return this},$.prototype.add=function(G){var W;if(G.negative!==0&&this.negative===0)return G.negative=0,W=this.sub(G),G.negative^=1,W;else if(G.negative===0&&this.negative!==0)return this.negative=0,W=G.sub(this),this.negative=1,W;if(this.length>G.length)return this.clone().iadd(G);return G.clone().iadd(this)},$.prototype.isub=function(G){if(G.negative!==0){G.negative=0;var W=this.iadd(G);return G.negative=1,W._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(G),this.negative=1,this._normSign();var C=this.cmp(G);if(C===0)return this.negative=0,this.length=1,this.words[0]=0,this;var D,F;if(C>0)D=this,F=G;else D=G,F=this;var J=0;for(var O=0;O<F.length;O++)W=(D.words[O]|0)-(F.words[O]|0)+J,J=W>>26,this.words[O]=W&67108863;for(;J!==0&&O<D.length;O++)W=(D.words[O]|0)+J,J=W>>26,this.words[O]=W&67108863;if(J===0&&O<D.length&&D!==this)for(;O<D.length;O++)this.words[O]=D.words[O];if(this.length=Math.max(this.length,O),D!==this)this.negative=1;return this._strip()},$.prototype.sub=function(G){return this.clone().isub(G)};function v(G,W,C){C.negative=W.negative^G.negative;var D=G.length+W.length|0;C.length=D,D=D-1|0;var F=G.words[0]|0,J=W.words[0]|0,O=F*J,P=O&67108863,R=O/67108864|0;C.words[0]=P;for(var _=1;_<D;_++){var f=R>>>26,c=R&67108863,o=Math.min(_,W.length-1);for(var K0=Math.max(0,_-G.length+1);K0<=o;K0++){var a=_-K0|0;F=G.words[a]|0,J=W.words[K0]|0,O=F*J+c,f+=O/67108864|0,c=O&67108863}C.words[_]=c|0,R=f|0}if(R!==0)C.words[_]=R|0;else C.length--;return C._strip()}var x=function(G,W,C){var D=G.words,F=W.words,J=C.words,O=0,P,R,_,f=D[0]|0,c=f&8191,o=f>>>13,K0=D[1]|0,a=K0&8191,l=K0>>>13,Q0=D[2]|0,n=Q0&8191,s=Q0>>>13,f0=D[3]|0,y=f0&8191,h=f0>>>13,G0=D[4]|0,t=G0&8191,U0=G0>>>13,L0=D[5]|0,p=L0&8191,m=L0>>>13,g0=D[6]|0,r=g0&8191,J0=g0>>>13,h0=D[7]|0,F0=h0&8191,O0=h0>>>13,J1=D[8]|0,I0=J1&8191,C0=J1>>>13,K1=D[9]|0,M0=K1&8191,z0=K1>>>13,d1=F[0]|0,T0=d1&8191,j0=d1>>>13,l1=F[1]|0,v0=l1&8191,R0=l1>>>13,h1=F[2]|0,_0=h1&8191,E0=h1>>>13,_1=F[3]|0,B0=_1&8191,x0=_1>>>13,B1=F[4]|0,S0=B1&8191,g=B1>>>13,d=F[5]|0,e=d&8191,X0=d>>>13,y0=F[6]|0,H0=y0&8191,A0=y0>>>13,Q1=F[7]|0,P0=Q1&8191,N0=Q1>>>13,u1=F[8]|0,k0=u1&8191,q0=u1>>>13,G1=F[9]|0,l0=G1&8191,b0=G1>>>13;C.negative=G.negative^W.negative,C.length=19,P=Math.imul(c,T0),R=Math.imul(c,j0),R=R+Math.imul(o,T0)|0,_=Math.imul(o,j0);var t0=(O+P|0)+((R&8191)<<13)|0;O=(_+(R>>>13)|0)+(t0>>>26)|0,t0&=67108863,P=Math.imul(a,T0),R=Math.imul(a,j0),R=R+Math.imul(l,T0)|0,_=Math.imul(l,j0),P=P+Math.imul(c,v0)|0,R=R+Math.imul(c,R0)|0,R=R+Math.imul(o,v0)|0,_=_+Math.imul(o,R0)|0;var r0=(O+P|0)+((R&8191)<<13)|0;O=(_+(R>>>13)|0)+(r0>>>26)|0,r0&=67108863,P=Math.imul(n,T0),R=Math.imul(n,j0),R=R+Math.imul(s,T0)|0,_=Math.imul(s,j0),P=P+Math.imul(a,v0)|0,R=R+Math.imul(a,R0)|0,R=R+Math.imul(l,v0)|0,_=_+Math.imul(l,R0)|0,P=P+Math.imul(c,_0)|0,R=R+Math.imul(c,E0)|0,R=R+Math.imul(o,_0)|0,_=_+Math.imul(o,E0)|0;var F1=(O+P|0)+((R&8191)<<13)|0;O=(_+(R>>>13)|0)+(F1>>>26)|0,F1&=67108863,P=Math.imul(y,T0),R=Math.imul(y,j0),R=R+Math.imul(h,T0)|0,_=Math.imul(h,j0),P=P+Math.imul(n,v0)|0,R=R+Math.imul(n,R0)|0,R=R+Math.imul(s,v0)|0,_=_+Math.imul(s,R0)|0,P=P+Math.imul(a,_0)|0,R=R+Math.imul(a,E0)|0,R=R+Math.imul(l,_0)|0,_=_+Math.imul(l,E0)|0,P=P+Math.imul(c,B0)|0,R=R+Math.imul(c,x0)|0,R=R+Math.imul(o,B0)|0,_=_+Math.imul(o,x0)|0;var O1=(O+P|0)+((R&8191)<<13)|0;O=(_+(R>>>13)|0)+(O1>>>26)|0,O1&=67108863,P=Math.imul(t,T0),R=Math.imul(t,j0),R=R+Math.imul(U0,T0)|0,_=Math.imul(U0,j0),P=P+Math.imul(y,v0)|0,R=R+Math.imul(y,R0)|0,R=R+Math.imul(h,v0)|0,_=_+Math.imul(h,R0)|0,P=P+Math.imul(n,_0)|0,R=R+Math.imul(n,E0)|0,R=R+Math.imul(s,_0)|0,_=_+Math.imul(s,E0)|0,P=P+Math.imul(a,B0)|0,R=R+Math.imul(a,x0)|0,R=R+Math.imul(l,B0)|0,_=_+Math.imul(l,x0)|0,P=P+Math.imul(c,S0)|0,R=R+Math.imul(c,g)|0,R=R+Math.imul(o,S0)|0,_=_+Math.imul(o,g)|0;var C1=(O+P|0)+((R&8191)<<13)|0;O=(_+(R>>>13)|0)+(C1>>>26)|0,C1&=67108863,P=Math.imul(p,T0),R=Math.imul(p,j0),R=R+Math.imul(m,T0)|0,_=Math.imul(m,j0),P=P+Math.imul(t,v0)|0,R=R+Math.imul(t,R0)|0,R=R+Math.imul(U0,v0)|0,_=_+Math.imul(U0,R0)|0,P=P+Math.imul(y,_0)|0,R=R+Math.imul(y,E0)|0,R=R+Math.imul(h,_0)|0,_=_+Math.imul(h,E0)|0,P=P+Math.imul(n,B0)|0,R=R+Math.imul(n,x0)|0,R=R+Math.imul(s,B0)|0,_=_+Math.imul(s,x0)|0,P=P+Math.imul(a,S0)|0,R=R+Math.imul(a,g)|0,R=R+Math.imul(l,S0)|0,_=_+Math.imul(l,g)|0,P=P+Math.imul(c,e)|0,R=R+Math.imul(c,X0)|0,R=R+Math.imul(o,e)|0,_=_+Math.imul(o,X0)|0;var A1=(O+P|0)+((R&8191)<<13)|0;O=(_+(R>>>13)|0)+(A1>>>26)|0,A1&=67108863,P=Math.imul(r,T0),R=Math.imul(r,j0),R=R+Math.imul(J0,T0)|0,_=Math.imul(J0,j0),P=P+Math.imul(p,v0)|0,R=R+Math.imul(p,R0)|0,R=R+Math.imul(m,v0)|0,_=_+Math.imul(m,R0)|0,P=P+Math.imul(t,_0)|0,R=R+Math.imul(t,E0)|0,R=R+Math.imul(U0,_0)|0,_=_+Math.imul(U0,E0)|0,P=P+Math.imul(y,B0)|0,R=R+Math.imul(y,x0)|0,R=R+Math.imul(h,B0)|0,_=_+Math.imul(h,x0)|0,P=P+Math.imul(n,S0)|0,R=R+Math.imul(n,g)|0,R=R+Math.imul(s,S0)|0,_=_+Math.imul(s,g)|0,P=P+Math.imul(a,e)|0,R=R+Math.imul(a,X0)|0,R=R+Math.imul(l,e)|0,_=_+Math.imul(l,X0)|0,P=P+Math.imul(c,H0)|0,R=R+Math.imul(c,A0)|0,R=R+Math.imul(o,H0)|0,_=_+Math.imul(o,A0)|0;var z1=(O+P|0)+((R&8191)<<13)|0;O=(_+(R>>>13)|0)+(z1>>>26)|0,z1&=67108863,P=Math.imul(F0,T0),R=Math.imul(F0,j0),R=R+Math.imul(O0,T0)|0,_=Math.imul(O0,j0),P=P+Math.imul(r,v0)|0,R=R+Math.imul(r,R0)|0,R=R+Math.imul(J0,v0)|0,_=_+Math.imul(J0,R0)|0,P=P+Math.imul(p,_0)|0,R=R+Math.imul(p,E0)|0,R=R+Math.imul(m,_0)|0,_=_+Math.imul(m,E0)|0,P=P+Math.imul(t,B0)|0,R=R+Math.imul(t,x0)|0,R=R+Math.imul(U0,B0)|0,_=_+Math.imul(U0,x0)|0,P=P+Math.imul(y,S0)|0,R=R+Math.imul(y,g)|0,R=R+Math.imul(h,S0)|0,_=_+Math.imul(h,g)|0,P=P+Math.imul(n,e)|0,R=R+Math.imul(n,X0)|0,R=R+Math.imul(s,e)|0,_=_+Math.imul(s,X0)|0,P=P+Math.imul(a,H0)|0,R=R+Math.imul(a,A0)|0,R=R+Math.imul(l,H0)|0,_=_+Math.imul(l,A0)|0,P=P+Math.imul(c,P0)|0,R=R+Math.imul(c,N0)|0,R=R+Math.imul(o,P0)|0,_=_+Math.imul(o,N0)|0;var D1=(O+P|0)+((R&8191)<<13)|0;O=(_+(R>>>13)|0)+(D1>>>26)|0,D1&=67108863,P=Math.imul(I0,T0),R=Math.imul(I0,j0),R=R+Math.imul(C0,T0)|0,_=Math.imul(C0,j0),P=P+Math.imul(F0,v0)|0,R=R+Math.imul(F0,R0)|0,R=R+Math.imul(O0,v0)|0,_=_+Math.imul(O0,R0)|0,P=P+Math.imul(r,_0)|0,R=R+Math.imul(r,E0)|0,R=R+Math.imul(J0,_0)|0,_=_+Math.imul(J0,E0)|0,P=P+Math.imul(p,B0)|0,R=R+Math.imul(p,x0)|0,R=R+Math.imul(m,B0)|0,_=_+Math.imul(m,x0)|0,P=P+Math.imul(t,S0)|0,R=R+Math.imul(t,g)|0,R=R+Math.imul(U0,S0)|0,_=_+Math.imul(U0,g)|0,P=P+Math.imul(y,e)|0,R=R+Math.imul(y,X0)|0,R=R+Math.imul(h,e)|0,_=_+Math.imul(h,X0)|0,P=P+Math.imul(n,H0)|0,R=R+Math.imul(n,A0)|0,R=R+Math.imul(s,H0)|0,_=_+Math.imul(s,A0)|0,P=P+Math.imul(a,P0)|0,R=R+Math.imul(a,N0)|0,R=R+Math.imul(l,P0)|0,_=_+Math.imul(l,N0)|0,P=P+Math.imul(c,k0)|0,R=R+Math.imul(c,q0)|0,R=R+Math.imul(o,k0)|0,_=_+Math.imul(o,q0)|0;var M1=(O+P|0)+((R&8191)<<13)|0;O=(_+(R>>>13)|0)+(M1>>>26)|0,M1&=67108863,P=Math.imul(M0,T0),R=Math.imul(M0,j0),R=R+Math.imul(z0,T0)|0,_=Math.imul(z0,j0),P=P+Math.imul(I0,v0)|0,R=R+Math.imul(I0,R0)|0,R=R+Math.imul(C0,v0)|0,_=_+Math.imul(C0,R0)|0,P=P+Math.imul(F0,_0)|0,R=R+Math.imul(F0,E0)|0,R=R+Math.imul(O0,_0)|0,_=_+Math.imul(O0,E0)|0,P=P+Math.imul(r,B0)|0,R=R+Math.imul(r,x0)|0,R=R+Math.imul(J0,B0)|0,_=_+Math.imul(J0,x0)|0,P=P+Math.imul(p,S0)|0,R=R+Math.imul(p,g)|0,R=R+Math.imul(m,S0)|0,_=_+Math.imul(m,g)|0,P=P+Math.imul(t,e)|0,R=R+Math.imul(t,X0)|0,R=R+Math.imul(U0,e)|0,_=_+Math.imul(U0,X0)|0,P=P+Math.imul(y,H0)|0,R=R+Math.imul(y,A0)|0,R=R+Math.imul(h,H0)|0,_=_+Math.imul(h,A0)|0,P=P+Math.imul(n,P0)|0,R=R+Math.imul(n,N0)|0,R=R+Math.imul(s,P0)|0,_=_+Math.imul(s,N0)|0,P=P+Math.imul(a,k0)|0,R=R+Math.imul(a,q0)|0,R=R+Math.imul(l,k0)|0,_=_+Math.imul(l,q0)|0,P=P+Math.imul(c,l0)|0,R=R+Math.imul(c,b0)|0,R=R+Math.imul(o,l0)|0,_=_+Math.imul(o,b0)|0;var q1=(O+P|0)+((R&8191)<<13)|0;O=(_+(R>>>13)|0)+(q1>>>26)|0,q1&=67108863,P=Math.imul(M0,v0),R=Math.imul(M0,R0),R=R+Math.imul(z0,v0)|0,_=Math.imul(z0,R0),P=P+Math.imul(I0,_0)|0,R=R+Math.imul(I0,E0)|0,R=R+Math.imul(C0,_0)|0,_=_+Math.imul(C0,E0)|0,P=P+Math.imul(F0,B0)|0,R=R+Math.imul(F0,x0)|0,R=R+Math.imul(O0,B0)|0,_=_+Math.imul(O0,x0)|0,P=P+Math.imul(r,S0)|0,R=R+Math.imul(r,g)|0,R=R+Math.imul(J0,S0)|0,_=_+Math.imul(J0,g)|0,P=P+Math.imul(p,e)|0,R=R+Math.imul(p,X0)|0,R=R+Math.imul(m,e)|0,_=_+Math.imul(m,X0)|0,P=P+Math.imul(t,H0)|0,R=R+Math.imul(t,A0)|0,R=R+Math.imul(U0,H0)|0,_=_+Math.imul(U0,A0)|0,P=P+Math.imul(y,P0)|0,R=R+Math.imul(y,N0)|0,R=R+Math.imul(h,P0)|0,_=_+Math.imul(h,N0)|0,P=P+Math.imul(n,k0)|0,R=R+Math.imul(n,q0)|0,R=R+Math.imul(s,k0)|0,_=_+Math.imul(s,q0)|0,P=P+Math.imul(a,l0)|0,R=R+Math.imul(a,b0)|0,R=R+Math.imul(l,l0)|0,_=_+Math.imul(l,b0)|0;var L1=(O+P|0)+((R&8191)<<13)|0;O=(_+(R>>>13)|0)+(L1>>>26)|0,L1&=67108863,P=Math.imul(M0,_0),R=Math.imul(M0,E0),R=R+Math.imul(z0,_0)|0,_=Math.imul(z0,E0),P=P+Math.imul(I0,B0)|0,R=R+Math.imul(I0,x0)|0,R=R+Math.imul(C0,B0)|0,_=_+Math.imul(C0,x0)|0,P=P+Math.imul(F0,S0)|0,R=R+Math.imul(F0,g)|0,R=R+Math.imul(O0,S0)|0,_=_+Math.imul(O0,g)|0,P=P+Math.imul(r,e)|0,R=R+Math.imul(r,X0)|0,R=R+Math.imul(J0,e)|0,_=_+Math.imul(J0,X0)|0,P=P+Math.imul(p,H0)|0,R=R+Math.imul(p,A0)|0,R=R+Math.imul(m,H0)|0,_=_+Math.imul(m,A0)|0,P=P+Math.imul(t,P0)|0,R=R+Math.imul(t,N0)|0,R=R+Math.imul(U0,P0)|0,_=_+Math.imul(U0,N0)|0,P=P+Math.imul(y,k0)|0,R=R+Math.imul(y,q0)|0,R=R+Math.imul(h,k0)|0,_=_+Math.imul(h,q0)|0,P=P+Math.imul(n,l0)|0,R=R+Math.imul(n,b0)|0,R=R+Math.imul(s,l0)|0,_=_+Math.imul(s,b0)|0;var T1=(O+P|0)+((R&8191)<<13)|0;O=(_+(R>>>13)|0)+(T1>>>26)|0,T1&=67108863,P=Math.imul(M0,B0),R=Math.imul(M0,x0),R=R+Math.imul(z0,B0)|0,_=Math.imul(z0,x0),P=P+Math.imul(I0,S0)|0,R=R+Math.imul(I0,g)|0,R=R+Math.imul(C0,S0)|0,_=_+Math.imul(C0,g)|0,P=P+Math.imul(F0,e)|0,R=R+Math.imul(F0,X0)|0,R=R+Math.imul(O0,e)|0,_=_+Math.imul(O0,X0)|0,P=P+Math.imul(r,H0)|0,R=R+Math.imul(r,A0)|0,R=R+Math.imul(J0,H0)|0,_=_+Math.imul(J0,A0)|0,P=P+Math.imul(p,P0)|0,R=R+Math.imul(p,N0)|0,R=R+Math.imul(m,P0)|0,_=_+Math.imul(m,N0)|0,P=P+Math.imul(t,k0)|0,R=R+Math.imul(t,q0)|0,R=R+Math.imul(U0,k0)|0,_=_+Math.imul(U0,q0)|0,P=P+Math.imul(y,l0)|0,R=R+Math.imul(y,b0)|0,R=R+Math.imul(h,l0)|0,_=_+Math.imul(h,b0)|0;var R1=(O+P|0)+((R&8191)<<13)|0;O=(_+(R>>>13)|0)+(R1>>>26)|0,R1&=67108863,P=Math.imul(M0,S0),R=Math.imul(M0,g),R=R+Math.imul(z0,S0)|0,_=Math.imul(z0,g),P=P+Math.imul(I0,e)|0,R=R+Math.imul(I0,X0)|0,R=R+Math.imul(C0,e)|0,_=_+Math.imul(C0,X0)|0,P=P+Math.imul(F0,H0)|0,R=R+Math.imul(F0,A0)|0,R=R+Math.imul(O0,H0)|0,_=_+Math.imul(O0,A0)|0,P=P+Math.imul(r,P0)|0,R=R+Math.imul(r,N0)|0,R=R+Math.imul(J0,P0)|0,_=_+Math.imul(J0,N0)|0,P=P+Math.imul(p,k0)|0,R=R+Math.imul(p,q0)|0,R=R+Math.imul(m,k0)|0,_=_+Math.imul(m,q0)|0,P=P+Math.imul(t,l0)|0,R=R+Math.imul(t,b0)|0,R=R+Math.imul(U0,l0)|0,_=_+Math.imul(U0,b0)|0;var E1=(O+P|0)+((R&8191)<<13)|0;O=(_+(R>>>13)|0)+(E1>>>26)|0,E1&=67108863,P=Math.imul(M0,e),R=Math.imul(M0,X0),R=R+Math.imul(z0,e)|0,_=Math.imul(z0,X0),P=P+Math.imul(I0,H0)|0,R=R+Math.imul(I0,A0)|0,R=R+Math.imul(C0,H0)|0,_=_+Math.imul(C0,A0)|0,P=P+Math.imul(F0,P0)|0,R=R+Math.imul(F0,N0)|0,R=R+Math.imul(O0,P0)|0,_=_+Math.imul(O0,N0)|0,P=P+Math.imul(r,k0)|0,R=R+Math.imul(r,q0)|0,R=R+Math.imul(J0,k0)|0,_=_+Math.imul(J0,q0)|0,P=P+Math.imul(p,l0)|0,R=R+Math.imul(p,b0)|0,R=R+Math.imul(m,l0)|0,_=_+Math.imul(m,b0)|0;var S1=(O+P|0)+((R&8191)<<13)|0;O=(_+(R>>>13)|0)+(S1>>>26)|0,S1&=67108863,P=Math.imul(M0,H0),R=Math.imul(M0,A0),R=R+Math.imul(z0,H0)|0,_=Math.imul(z0,A0),P=P+Math.imul(I0,P0)|0,R=R+Math.imul(I0,N0)|0,R=R+Math.imul(C0,P0)|0,_=_+Math.imul(C0,N0)|0,P=P+Math.imul(F0,k0)|0,R=R+Math.imul(F0,q0)|0,R=R+Math.imul(O0,k0)|0,_=_+Math.imul(O0,q0)|0,P=P+Math.imul(r,l0)|0,R=R+Math.imul(r,b0)|0,R=R+Math.imul(J0,l0)|0,_=_+Math.imul(J0,b0)|0;var P1=(O+P|0)+((R&8191)<<13)|0;O=(_+(R>>>13)|0)+(P1>>>26)|0,P1&=67108863,P=Math.imul(M0,P0),R=Math.imul(M0,N0),R=R+Math.imul(z0,P0)|0,_=Math.imul(z0,N0),P=P+Math.imul(I0,k0)|0,R=R+Math.imul(I0,q0)|0,R=R+Math.imul(C0,k0)|0,_=_+Math.imul(C0,q0)|0,P=P+Math.imul(F0,l0)|0,R=R+Math.imul(F0,b0)|0,R=R+Math.imul(O0,l0)|0,_=_+Math.imul(O0,b0)|0;var WY=(O+P|0)+((R&8191)<<13)|0;O=(_+(R>>>13)|0)+(WY>>>26)|0,WY&=67108863,P=Math.imul(M0,k0),R=Math.imul(M0,q0),R=R+Math.imul(z0,k0)|0,_=Math.imul(z0,q0),P=P+Math.imul(I0,l0)|0,R=R+Math.imul(I0,b0)|0,R=R+Math.imul(C0,l0)|0,_=_+Math.imul(C0,b0)|0;var IY=(O+P|0)+((R&8191)<<13)|0;O=(_+(R>>>13)|0)+(IY>>>26)|0,IY&=67108863,P=Math.imul(M0,l0),R=Math.imul(M0,b0),R=R+Math.imul(z0,l0)|0,_=Math.imul(z0,b0);var HY=(O+P|0)+((R&8191)<<13)|0;if(O=(_+(R>>>13)|0)+(HY>>>26)|0,HY&=67108863,J[0]=t0,J[1]=r0,J[2]=F1,J[3]=O1,J[4]=C1,J[5]=A1,J[6]=z1,J[7]=D1,J[8]=M1,J[9]=q1,J[10]=L1,J[11]=T1,J[12]=R1,J[13]=E1,J[14]=S1,J[15]=P1,J[16]=WY,J[17]=IY,J[18]=HY,O!==0)J[19]=O,C.length++;return C};if(!Math.imul)x=v;function N(G,W,C){C.negative=W.negative^G.negative,C.length=G.length+W.length;var D=0,F=0;for(var J=0;J<C.length-1;J++){var O=F;F=0;var P=D&67108863,R=Math.min(J,W.length-1);for(var _=Math.max(0,J-G.length+1);_<=R;_++){var f=J-_,c=G.words[f]|0,o=W.words[_]|0,K0=c*o,a=K0&67108863;O=O+(K0/67108864|0)|0,a=a+P|0,P=a&67108863,O=O+(a>>>26)|0,F+=O>>>26,O&=67108863}C.words[J]=P,D=O,O=F}if(D!==0)C.words[J]=D;else C.length--;return C._strip()}function w(G,W,C){return N(G,W,C)}$.prototype.mulTo=function(G,W){var C,D=this.length+G.length;if(this.length===10&&G.length===10)C=x(this,G,W);else if(D<63)C=v(this,G,W);else if(D<1024)C=N(this,G,W);else C=w(this,G,W);return C};function u(G,W){this.x=G,this.y=W}u.prototype.makeRBT=function(G){var W=Array(G),C=$.prototype._countBits(G)-1;for(var D=0;D<G;D++)W[D]=this.revBin(D,C,G);return W},u.prototype.revBin=function(G,W,C){if(G===0||G===C-1)return G;var D=0;for(var F=0;F<W;F++)D|=(G&1)<<W-F-1,G>>=1;return D},u.prototype.permute=function(G,W,C,D,F,J){for(var O=0;O<J;O++)D[O]=W[G[O]],F[O]=C[G[O]]},u.prototype.transform=function(G,W,C,D,F,J){this.permute(J,G,W,C,D,F);for(var O=1;O<F;O<<=1){var P=O<<1,R=Math.cos(2*Math.PI/P),_=Math.sin(2*Math.PI/P);for(var f=0;f<F;f+=P){var c=R,o=_;for(var K0=0;K0<O;K0++){var a=C[f+K0],l=D[f+K0],Q0=C[f+K0+O],n=D[f+K0+O],s=c*Q0-o*n;if(n=c*n+o*Q0,Q0=s,C[f+K0]=a+Q0,D[f+K0]=l+n,C[f+K0+O]=a-Q0,D[f+K0+O]=l-n,K0!==P)s=R*c-_*o,o=R*o+_*c,c=s}}}},u.prototype.guessLen13b=function(G,W){var C=Math.max(W,G)|1,D=C&1,F=0;for(C=C/2|0;C;C=C>>>1)F++;return 1<<F+1+D},u.prototype.conjugate=function(G,W,C){if(C<=1)return;for(var D=0;D<C/2;D++){var F=G[D];G[D]=G[C-D-1],G[C-D-1]=F,F=W[D],W[D]=-W[C-D-1],W[C-D-1]=-F}},u.prototype.normalize13b=function(G,W){var C=0;for(var D=0;D<W/2;D++){var F=Math.round(G[2*D+1]/W)*8192+Math.round(G[2*D]/W)+C;if(G[D]=F&67108863,F<67108864)C=0;else C=F/67108864|0}return G},u.prototype.convert13b=function(G,W,C,D){var F=0;for(var J=0;J<W;J++)F=F+(G[J]|0),C[2*J]=F&8191,F=F>>>13,C[2*J+1]=F&8191,F=F>>>13;for(J=2*W;J<D;++J)C[J]=0;K(F===0),K((F&-8192)===0)},u.prototype.stub=function(G){var W=Array(G);for(var C=0;C<G;C++)W[C]=0;return W},u.prototype.mulp=function(G,W,C){var D=2*this.guessLen13b(G.length,W.length),F=this.makeRBT(D),J=this.stub(D),O=Array(D),P=Array(D),R=Array(D),_=Array(D),f=Array(D),c=Array(D),o=C.words;o.length=D,this.convert13b(G.words,G.length,O,D),this.convert13b(W.words,W.length,_,D),this.transform(O,J,P,R,D,F),this.transform(_,J,f,c,D,F);for(var K0=0;K0<D;K0++){var a=P[K0]*f[K0]-R[K0]*c[K0];R[K0]=P[K0]*c[K0]+R[K0]*f[K0],P[K0]=a}return this.conjugate(P,R,D),this.transform(P,R,o,J,D,F),this.conjugate(o,J,D),this.normalize13b(o,D),C.negative=G.negative^W.negative,C.length=G.length+W.length,C._strip()},$.prototype.mul=function(G){var W=new $(null);return W.words=Array(this.length+G.length),this.mulTo(G,W)},$.prototype.mulf=function(G){var W=new $(null);return W.words=Array(this.length+G.length),w(this,G,W)},$.prototype.imul=function(G){return this.clone().mulTo(G,this)},$.prototype.imuln=function(G){var W=G<0;if(W)G=-G;K(typeof G==="number"),K(G<67108864);var C=0;for(var D=0;D<this.length;D++){var F=(this.words[D]|0)*G,J=(F&67108863)+(C&67108863);C>>=26,C+=F/67108864|0,C+=J>>>26,this.words[D]=J&67108863}if(C!==0)this.words[D]=C,this.length++;return this.length=G===0?1:this.length,W?this.ineg():this},$.prototype.muln=function(G){return this.clone().imuln(G)},$.prototype.sqr=function(){return this.mul(this)},$.prototype.isqr=function(){return this.imul(this.clone())},$.prototype.pow=function(G){var W=B(G);if(W.length===0)return new $(1);var C=this;for(var D=0;D<W.length;D++,C=C.sqr())if(W[D]!==0)break;if(++D<W.length)for(var F=C.sqr();D<W.length;D++,F=F.sqr()){if(W[D]===0)continue;C=C.mul(F)}return C},$.prototype.iushln=function(G){K(typeof G==="number"&&G>=0);var W=G%26,C=(G-W)/26,D=67108863>>>26-W<<26-W,F;if(W!==0){var J=0;for(F=0;F<this.length;F++){var O=this.words[F]&D,P=(this.words[F]|0)-O<<W;this.words[F]=P|J,J=O>>>26-W}if(J)this.words[F]=J,this.length++}if(C!==0){for(F=this.length-1;F>=0;F--)this.words[F+C]=this.words[F];for(F=0;F<C;F++)this.words[F]=0;this.length+=C}return this._strip()},$.prototype.ishln=function(G){return K(this.negative===0),this.iushln(G)},$.prototype.iushrn=function(G,W,C){K(typeof G==="number"&&G>=0);var D;if(W)D=(W-W%26)/26;else D=0;var F=G%26,J=Math.min((G-F)/26,this.length),O=67108863^67108863>>>F<<F,P=C;if(D-=J,D=Math.max(0,D),P){for(var R=0;R<J;R++)P.words[R]=this.words[R];P.length=J}if(J===0);else if(this.length>J){this.length-=J;for(R=0;R<this.length;R++)this.words[R]=this.words[R+J]}else this.words[0]=0,this.length=1;var _=0;for(R=this.length-1;R>=0&&(_!==0||R>=D);R--){var f=this.words[R]|0;this.words[R]=_<<26-F|f>>>F,_=f&O}if(P&&_!==0)P.words[P.length++]=_;if(this.length===0)this.words[0]=0,this.length=1;return this._strip()},$.prototype.ishrn=function(G,W,C){return K(this.negative===0),this.iushrn(G,W,C)},$.prototype.shln=function(G){return this.clone().ishln(G)},$.prototype.ushln=function(G){return this.clone().iushln(G)},$.prototype.shrn=function(G){return this.clone().ishrn(G)},$.prototype.ushrn=function(G){return this.clone().iushrn(G)},$.prototype.testn=function(G){K(typeof G==="number"&&G>=0);var W=G%26,C=(G-W)/26,D=1<<W;if(this.length<=C)return!1;var F=this.words[C];return!!(F&D)},$.prototype.imaskn=function(G){K(typeof G==="number"&&G>=0);var W=G%26,C=(G-W)/26;if(K(this.negative===0,"imaskn works only with positive numbers"),this.length<=C)return this;if(W!==0)C++;if(this.length=Math.min(C,this.length),W!==0){var D=67108863^67108863>>>W<<W;this.words[this.length-1]&=D}return this._strip()},$.prototype.maskn=function(G){return this.clone().imaskn(G)},$.prototype.iaddn=function(G){if(K(typeof G==="number"),K(G<67108864),G<0)return this.isubn(-G);if(this.negative!==0){if(this.length===1&&(this.words[0]|0)<=G)return this.words[0]=G-(this.words[0]|0),this.negative=0,this;return this.negative=0,this.isubn(G),this.negative=1,this}return this._iaddn(G)},$.prototype._iaddn=function(G){this.words[0]+=G;for(var W=0;W<this.length&&this.words[W]>=67108864;W++)if(this.words[W]-=67108864,W===this.length-1)this.words[W+1]=1;else this.words[W+1]++;return this.length=Math.max(this.length,W+1),this},$.prototype.isubn=function(G){if(K(typeof G==="number"),K(G<67108864),G<0)return this.iaddn(-G);if(this.negative!==0)return this.negative=0,this.iaddn(G),this.negative=1,this;if(this.words[0]-=G,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var W=0;W<this.length&&this.words[W]<0;W++)this.words[W]+=67108864,this.words[W+1]-=1;return this._strip()},$.prototype.addn=function(G){return this.clone().iaddn(G)},$.prototype.subn=function(G){return this.clone().isubn(G)},$.prototype.iabs=function(){return this.negative=0,this},$.prototype.abs=function(){return this.clone().iabs()},$.prototype._ishlnsubmul=function(G,W,C){var D=G.length+C,F;this._expand(D);var J,O=0;for(F=0;F<G.length;F++){J=(this.words[F+C]|0)+O;var P=(G.words[F]|0)*W;J-=P&67108863,O=(J>>26)-(P/67108864|0),this.words[F+C]=J&67108863}for(;F<this.length-C;F++)J=(this.words[F+C]|0)+O,O=J>>26,this.words[F+C]=J&67108863;if(O===0)return this._strip();K(O===-1),O=0;for(F=0;F<this.length;F++)J=-(this.words[F]|0)+O,O=J>>26,this.words[F]=J&67108863;return this.negative=1,this._strip()},$.prototype._wordDiv=function(G,W){var C=this.length-G.length,D=this.clone(),F=G,J=F.words[F.length-1]|0,O=this._countBits(J);if(C=26-O,C!==0)F=F.ushln(C),D.iushln(C),J=F.words[F.length-1]|0;var P=D.length-F.length,R;if(W!=="mod"){R=new $(null),R.length=P+1,R.words=Array(R.length);for(var _=0;_<R.length;_++)R.words[_]=0}var f=D.clone()._ishlnsubmul(F,1,P);if(f.negative===0){if(D=f,R)R.words[P]=1}for(var c=P-1;c>=0;c--){var o=(D.words[F.length+c]|0)*67108864+(D.words[F.length+c-1]|0);o=Math.min(o/J|0,67108863),D._ishlnsubmul(F,o,c);while(D.negative!==0)if(o--,D.negative=0,D._ishlnsubmul(F,1,c),!D.isZero())D.negative^=1;if(R)R.words[c]=o}if(R)R._strip();if(D._strip(),W!=="div"&&C!==0)D.iushrn(C);return{div:R||null,mod:D}},$.prototype.divmod=function(G,W,C){if(K(!G.isZero()),this.isZero())return{div:new $(0),mod:new $(0)};var D,F,J;if(this.negative!==0&&G.negative===0){if(J=this.neg().divmod(G,W),W!=="mod")D=J.div.neg();if(W!=="div"){if(F=J.mod.neg(),C&&F.negative!==0)F.iadd(G)}return{div:D,mod:F}}if(this.negative===0&&G.negative!==0){if(J=this.divmod(G.neg(),W),W!=="mod")D=J.div.neg();return{div:D,mod:J.mod}}if((this.negative&G.negative)!==0){if(J=this.neg().divmod(G.neg(),W),W!=="div"){if(F=J.mod.neg(),C&&F.negative!==0)F.isub(G)}return{div:J.div,mod:F}}if(G.length>this.length||this.cmp(G)<0)return{div:new $(0),mod:this};if(G.length===1){if(W==="div")return{div:this.divn(G.words[0]),mod:null};if(W==="mod")return{div:null,mod:new $(this.modrn(G.words[0]))};return{div:this.divn(G.words[0]),mod:new $(this.modrn(G.words[0]))}}return this._wordDiv(G,W)},$.prototype.div=function(G){return this.divmod(G,"div",!1).div},$.prototype.mod=function(G){return this.divmod(G,"mod",!1).mod},$.prototype.umod=function(G){return this.divmod(G,"mod",!0).mod},$.prototype.divRound=function(G){var W=this.divmod(G);if(W.mod.isZero())return W.div;var C=W.div.negative!==0?W.mod.isub(G):W.mod,D=G.ushrn(1),F=G.andln(1),J=C.cmp(D);if(J<0||F===1&&J===0)return W.div;return W.div.negative!==0?W.div.isubn(1):W.div.iaddn(1)},$.prototype.modrn=function(G){var W=G<0;if(W)G=-G;K(G<=67108863);var C=67108864%G,D=0;for(var F=this.length-1;F>=0;F--)D=(C*D+(this.words[F]|0))%G;return W?-D:D},$.prototype.modn=function(G){return this.modrn(G)},$.prototype.idivn=function(G){var W=G<0;if(W)G=-G;K(G<=67108863);var C=0;for(var D=this.length-1;D>=0;D--){var F=(this.words[D]|0)+C*67108864;this.words[D]=F/G|0,C=F%G}return this._strip(),W?this.ineg():this},$.prototype.divn=function(G){return this.clone().idivn(G)},$.prototype.egcd=function(G){K(G.negative===0),K(!G.isZero());var W=this,C=G.clone();if(W.negative!==0)W=W.umod(G);else W=W.clone();var D=new $(1),F=new $(0),J=new $(0),O=new $(1),P=0;while(W.isEven()&&C.isEven())W.iushrn(1),C.iushrn(1),++P;var R=C.clone(),_=W.clone();while(!W.isZero()){for(var f=0,c=1;(W.words[0]&c)===0&&f<26;++f,c<<=1);if(f>0){W.iushrn(f);while(f-- >0){if(D.isOdd()||F.isOdd())D.iadd(R),F.isub(_);D.iushrn(1),F.iushrn(1)}}for(var o=0,K0=1;(C.words[0]&K0)===0&&o<26;++o,K0<<=1);if(o>0){C.iushrn(o);while(o-- >0){if(J.isOdd()||O.isOdd())J.iadd(R),O.isub(_);J.iushrn(1),O.iushrn(1)}}if(W.cmp(C)>=0)W.isub(C),D.isub(J),F.isub(O);else C.isub(W),J.isub(D),O.isub(F)}return{a:J,b:O,gcd:C.iushln(P)}},$.prototype._invmp=function(G){K(G.negative===0),K(!G.isZero());var W=this,C=G.clone();if(W.negative!==0)W=W.umod(G);else W=W.clone();var D=new $(1),F=new $(0),J=C.clone();while(W.cmpn(1)>0&&C.cmpn(1)>0){for(var O=0,P=1;(W.words[0]&P)===0&&O<26;++O,P<<=1);if(O>0){W.iushrn(O);while(O-- >0){if(D.isOdd())D.iadd(J);D.iushrn(1)}}for(var R=0,_=1;(C.words[0]&_)===0&&R<26;++R,_<<=1);if(R>0){C.iushrn(R);while(R-- >0){if(F.isOdd())F.iadd(J);F.iushrn(1)}}if(W.cmp(C)>=0)W.isub(C),D.isub(F);else C.isub(W),F.isub(D)}var f;if(W.cmpn(1)===0)f=D;else f=F;if(f.cmpn(0)<0)f.iadd(G);return f},$.prototype.gcd=function(G){if(this.isZero())return G.abs();if(G.isZero())return this.abs();var W=this.clone(),C=G.clone();W.negative=0,C.negative=0;for(var D=0;W.isEven()&&C.isEven();D++)W.iushrn(1),C.iushrn(1);do{while(W.isEven())W.iushrn(1);while(C.isEven())C.iushrn(1);var F=W.cmp(C);if(F<0){var J=W;W=C,C=J}else if(F===0||C.cmpn(1)===0)break;W.isub(C)}while(!0);return C.iushln(D)},$.prototype.invm=function(G){return this.egcd(G).a.umod(G)},$.prototype.isEven=function(){return(this.words[0]&1)===0},$.prototype.isOdd=function(){return(this.words[0]&1)===1},$.prototype.andln=function(G){return this.words[0]&G},$.prototype.bincn=function(G){K(typeof G==="number");var W=G%26,C=(G-W)/26,D=1<<W;if(this.length<=C)return this._expand(C+1),this.words[C]|=D,this;var F=D;for(var J=C;F!==0&&J<this.length;J++){var O=this.words[J]|0;O+=F,F=O>>>26,O&=67108863,this.words[J]=O}if(F!==0)this.words[J]=F,this.length++;return this},$.prototype.isZero=function(){return this.length===1&&this.words[0]===0},$.prototype.cmpn=function(G){var W=G<0;if(this.negative!==0&&!W)return-1;if(this.negative===0&&W)return 1;this._strip();var C;if(this.length>1)C=1;else{if(W)G=-G;K(G<=67108863,"Number is too big");var D=this.words[0]|0;C=D===G?0:D<G?-1:1}if(this.negative!==0)return-C|0;return C},$.prototype.cmp=function(G){if(this.negative!==0&&G.negative===0)return-1;if(this.negative===0&&G.negative!==0)return 1;var W=this.ucmp(G);if(this.negative!==0)return-W|0;return W},$.prototype.ucmp=function(G){if(this.length>G.length)return 1;if(this.length<G.length)return-1;var W=0;for(var C=this.length-1;C>=0;C--){var D=this.words[C]|0,F=G.words[C]|0;if(D===F)continue;if(D<F)W=-1;else if(D>F)W=1;break}return W},$.prototype.gtn=function(G){return this.cmpn(G)===1},$.prototype.gt=function(G){return this.cmp(G)===1},$.prototype.gten=function(G){return this.cmpn(G)>=0},$.prototype.gte=function(G){return this.cmp(G)>=0},$.prototype.ltn=function(G){return this.cmpn(G)===-1},$.prototype.lt=function(G){return this.cmp(G)===-1},$.prototype.lten=function(G){return this.cmpn(G)<=0},$.prototype.lte=function(G){return this.cmp(G)<=0},$.prototype.eqn=function(G){return this.cmpn(G)===0},$.prototype.eq=function(G){return this.cmp(G)===0},$.red=function(G){return new V(G)},$.prototype.toRed=function(G){return K(!this.red,"Already a number in reduction context"),K(this.negative===0,"red works only with positives"),G.convertTo(this)._forceRed(G)},$.prototype.fromRed=function(){return K(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},$.prototype._forceRed=function(G){return this.red=G,this},$.prototype.forceRed=function(G){return K(!this.red,"Already a number in reduction context"),this._forceRed(G)},$.prototype.redAdd=function(G){return K(this.red,"redAdd works only with red numbers"),this.red.add(this,G)},$.prototype.redIAdd=function(G){return K(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,G)},$.prototype.redSub=function(G){return K(this.red,"redSub works only with red numbers"),this.red.sub(this,G)},$.prototype.redISub=function(G){return K(this.red,"redISub works only with red numbers"),this.red.isub(this,G)},$.prototype.redShl=function(G){return K(this.red,"redShl works only with red numbers"),this.red.shl(this,G)},$.prototype.redMul=function(G){return K(this.red,"redMul works only with red numbers"),this.red._verify2(this,G),this.red.mul(this,G)},$.prototype.redIMul=function(G){return K(this.red,"redMul works only with red numbers"),this.red._verify2(this,G),this.red.imul(this,G)},$.prototype.redSqr=function(){return K(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},$.prototype.redISqr=function(){return K(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},$.prototype.redSqrt=function(){return K(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},$.prototype.redInvm=function(){return K(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},$.prototype.redNeg=function(){return K(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},$.prototype.redPow=function(G){return K(this.red&&!G.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,G)};var Z0={k256:null,p224:null,p192:null,p25519:null};function V0(G,W){this.name=G,this.p=new $(W,16),this.n=this.p.bitLength(),this.k=new $(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}V0.prototype._tmp=function(){var G=new $(null);return G.words=Array(Math.ceil(this.n/13)),G},V0.prototype.ireduce=function(G){var W=G,C;do this.split(W,this.tmp),W=this.imulK(W),W=W.iadd(this.tmp),C=W.bitLength();while(C>this.n);var D=C<this.n?-1:W.ucmp(this.p);if(D===0)W.words[0]=0,W.length=1;else if(D>0)W.isub(this.p);else if(W.strip!==void 0)W.strip();else W._strip();return W},V0.prototype.split=function(G,W){G.iushrn(this.n,0,W)},V0.prototype.imulK=function(G){return G.imul(this.k)};function Y0(){V0.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}H(Y0,V0),Y0.prototype.split=function(G,W){var C=4194303,D=Math.min(G.length,9);for(var F=0;F<D;F++)W.words[F]=G.words[F];if(W.length=D,G.length<=9){G.words[0]=0,G.length=1;return}var J=G.words[9];W.words[W.length++]=J&C;for(F=10;F<G.length;F++){var O=G.words[F]|0;G.words[F-10]=(O&C)<<4|J>>>22,J=O}if(J>>>=22,G.words[F-10]=J,J===0&&G.length>10)G.length-=10;else G.length-=9},Y0.prototype.imulK=function(G){G.words[G.length]=0,G.words[G.length+1]=0,G.length+=2;var W=0;for(var C=0;C<G.length;C++){var D=G.words[C]|0;W+=D*977,G.words[C]=W&67108863,W=D*64+(W/67108864|0)}if(G.words[G.length-1]===0){if(G.length--,G.words[G.length-1]===0)G.length--}return G};function b(){V0.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}H(b,V0);function i(){V0.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}H(i,V0);function Y(){V0.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}H(Y,V0),Y.prototype.imulK=function(G){var W=0;for(var C=0;C<G.length;C++){var D=(G.words[C]|0)*19+W,F=D&67108863;D>>>=26,G.words[C]=F,W=D}if(W!==0)G.words[G.length++]=W;return G},$._prime=function(G){if(Z0[G])return Z0[G];var W;if(G==="k256")W=new Y0;else if(G==="p224")W=new b;else if(G==="p192")W=new i;else if(G==="p25519")W=new Y;else throw Error("Unknown prime "+G);return Z0[G]=W,W};function V(G){if(typeof G==="string"){var W=$._prime(G);this.m=W.p,this.prime=W}else K(G.gtn(1),"modulus must be greater than 1"),this.m=G,this.prime=null}V.prototype._verify1=function(G){K(G.negative===0,"red works only with positives"),K(G.red,"red works only with red numbers")},V.prototype._verify2=function(G,W){K((G.negative|W.negative)===0,"red works only with positives"),K(G.red&&G.red===W.red,"red works only with red numbers")},V.prototype.imod=function(G){if(this.prime)return this.prime.ireduce(G)._forceRed(this);return A(G,G.umod(this.m)._forceRed(this)),G},V.prototype.neg=function(G){if(G.isZero())return G.clone();return this.m.sub(G)._forceRed(this)},V.prototype.add=function(G,W){this._verify2(G,W);var C=G.add(W);if(C.cmp(this.m)>=0)C.isub(this.m);return C._forceRed(this)},V.prototype.iadd=function(G,W){this._verify2(G,W);var C=G.iadd(W);if(C.cmp(this.m)>=0)C.isub(this.m);return C},V.prototype.sub=function(G,W){this._verify2(G,W);var C=G.sub(W);if(C.cmpn(0)<0)C.iadd(this.m);return C._forceRed(this)},V.prototype.isub=function(G,W){this._verify2(G,W);var C=G.isub(W);if(C.cmpn(0)<0)C.iadd(this.m);return C},V.prototype.shl=function(G,W){return this._verify1(G),this.imod(G.ushln(W))},V.prototype.imul=function(G,W){return this._verify2(G,W),this.imod(G.imul(W))},V.prototype.mul=function(G,W){return this._verify2(G,W),this.imod(G.mul(W))},V.prototype.isqr=function(G){return this.imul(G,G.clone())},V.prototype.sqr=function(G){return this.mul(G,G)},V.prototype.sqrt=function(G){if(G.isZero())return G.clone();var W=this.m.andln(3);if(K(W%2===1),W===3){var C=this.m.add(new $(1)).iushrn(2);return this.pow(G,C)}var D=this.m.subn(1),F=0;while(!D.isZero()&&D.andln(1)===0)F++,D.iushrn(1);K(!D.isZero());var J=new $(1).toRed(this),O=J.redNeg(),P=this.m.subn(1).iushrn(1),R=this.m.bitLength();R=new $(2*R*R).toRed(this);while(this.pow(R,P).cmp(O)!==0)R.redIAdd(O);var _=this.pow(R,D),f=this.pow(G,D.addn(1).iushrn(1)),c=this.pow(G,D),o=F;while(c.cmp(J)!==0){var K0=c;for(var a=0;K0.cmp(J)!==0;a++)K0=K0.redSqr();K(a<o);var l=this.pow(_,new $(1).iushln(o-a-1));f=f.redMul(l),_=l.redSqr(),c=c.redMul(_),o=a}return f},V.prototype.invm=function(G){var W=G._invmp(this.m);if(W.negative!==0)return W.negative=0,this.imod(W).redNeg();else return this.imod(W)},V.prototype.pow=function(G,W){if(W.isZero())return new $(1).toRed(this);if(W.cmpn(1)===0)return G.clone();var C=4,D=Array(1<<C);D[0]=new $(1).toRed(this),D[1]=G;for(var F=2;F<D.length;F++)D[F]=this.mul(D[F-1],G);var J=D[0],O=0,P=0,R=W.bitLength()%26;if(R===0)R=26;for(F=W.length-1;F>=0;F--){var _=W.words[F];for(var f=R-1;f>=0;f--){var c=_>>f&1;if(J!==D[0])J=this.sqr(J);if(c===0&&O===0){P=0;continue}if(O<<=1,O|=c,P++,P!==C&&(F!==0||f!==0))continue;J=this.mul(J,D[O]),P=0,O=0}R=26}return J},V.prototype.convertTo=function(G){var W=G.umod(this.m);return W===G?W.clone():W},V.prototype.convertFrom=function(G){var W=G.clone();return W.red=null,W},$.mont=function(G){return new I(G)};function I(G){if(V.call(this,G),this.shift=this.m.bitLength(),this.shift%26!==0)this.shift+=26-this.shift%26;this.r=new $(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}H(I,V),I.prototype.convertTo=function(G){return this.imod(G.ushln(this.shift))},I.prototype.convertFrom=function(G){var W=this.imod(G.mul(this.rinv));return W.red=null,W},I.prototype.imul=function(G,W){if(G.isZero()||W.isZero())return G.words[0]=0,G.length=1,G;var C=G.imul(W),D=C.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),F=C.isub(D).iushrn(this.shift),J=F;if(F.cmp(this.m)>=0)J=F.isub(this.m);else if(F.cmpn(0)<0)J=F.iadd(this.m);return J._forceRed(this)},I.prototype.mul=function(G,W){if(G.isZero()||W.isZero())return new $(0)._forceRed(this);var C=G.mul(W),D=C.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),F=C.isub(D).iushrn(this.shift),J=F;if(F.cmp(this.m)>=0)J=F.isub(this.m);else if(F.cmpn(0)<0)J=F.iadd(this.m);return J._forceRed(this)},I.prototype.invm=function(G){var W=this.imod(G._invmp(this.m).mul(this.r2));return W._forceRed(this)}})(typeof Z>"u"||Z,U)}),OV=$0((U,Z)=>{var X=UF(),Q=vX(),K=m1().Buffer;function H(q){var z=q.modulus.byteLength(),T;do T=new X(Q(z));while(T.cmp(q.modulus)>=0||!T.umod(q.prime1)||!T.umod(q.prime2));return T}function $(q){var z=H(q),T=z.toRed(X.mont(q.modulus)).redPow(new X(q.publicExponent)).fromRed();return{blinder:T,unblinder:z.invm(q.modulus)}}function M(q,z){var T=$(z),A=z.modulus.byteLength(),L=new X(q).mul(T.blinder).umod(z.modulus),E=L.toRed(X.mont(z.prime1)),S=L.toRed(X.mont(z.prime2)),j=z.coefficient,k=z.prime1,B=z.prime2,v=E.redPow(z.exponent1).fromRed(),x=S.redPow(z.exponent2).fromRed(),N=v.isub(x).imul(j).umod(k).imul(B);return x.iadd(N).imul(T.unblinder).umod(z.modulus).toArrayLike(K,"be",A)}M.getr=H,Z.exports=M}),ZF=$0((U,Z)=>{var X=WV(),Q=vX(),K=_X(),H=IV(),$=HV(),M=YJ(),q=FV(),z=OV(),T=m1().Buffer;Z.exports=function(S,j,k){var B;if(S.padding)B=S.padding;else if(k)B=1;else B=4;var v=X(S),x;if(B===4)x=A(v,j);else if(B===1)x=L(v,j,k);else if(B===3){if(x=new M(j),x.cmp(v.modulus)>=0)throw Error("data too long for modulus")}else throw Error("unknown padding");if(k)return z(x,v);else return q(x,v)};function A(S,j){var k=S.modulus.byteLength(),B=j.length,v=K("sha1").update(T.alloc(0)).digest(),x=v.length,N=2*x;if(B>k-N-2)throw Error("message too long");var w=T.alloc(k-B-N-2),u=k-x-1,Z0=Q(x),V0=$(T.concat([v,w,T.alloc(1,1),j],u),H(Z0,u)),Y0=$(Z0,H(V0,x));return new M(T.concat([T.alloc(1),Y0,V0],k))}function L(S,j,k){var B=j.length,v=S.modulus.byteLength();if(B>v-11)throw Error("message too long");var x;if(k)x=T.alloc(v-B-3,255);else x=E(v-B-3);return new M(T.concat([T.from([0,k?1:2]),x,T.alloc(1),j],v))}function E(S){var j=T.allocUnsafe(S),k=0,B=Q(S*2),v=0,x;while(k<S){if(v===B.length)B=Q(S*2),v=0;if(x=B[v++],x)j[k++]=x}return j}}),XF=$0((U,Z)=>{var X=WV(),Q=IV(),K=HV(),H=YJ(),$=OV(),M=_X(),q=FV(),z=m1().Buffer;Z.exports=function(E,S,j){var k;if(E.padding)k=E.padding;else if(j)k=1;else k=4;var B=X(E),v=B.modulus.byteLength();if(S.length>v||new H(S).cmp(B.modulus)>=0)throw Error("decryption error");var x;if(j)x=q(new H(S),B);else x=$(S,B);var N=z.alloc(v-x.length);if(x=z.concat([N,x],v),k===4)return T(B,x);else if(k===1)return A(B,x,j);else if(k===3)return x;else throw Error("unknown padding")};function T(E,S){var j=E.modulus.byteLength(),k=M("sha1").update(z.alloc(0)).digest(),B=k.length;if(S[0]!==0)throw Error("decryption error");var v=S.slice(1,B+1),x=S.slice(B+1),N=K(v,Q(x,B)),w=K(x,Q(N,j-B-1));if(L(k,w.slice(0,B)))throw Error("decryption error");var u=B;while(w[u]===0)u++;if(w[u++]!==1)throw Error("decryption error");return w.slice(u)}function A(E,S,j){var k=S.slice(0,2),B=2,v=0;while(S[B++]!==0)if(B>=S.length){v++;break}var x=S.slice(2,B-1);if(k.toString("hex")!=="0002"&&!j||k.toString("hex")!=="0001"&&j)v++;if(x.length<8)v++;if(v)throw Error("decryption error");return S.slice(B)}function L(E,S){E=z.from(E),S=z.from(S);var j=0,k=E.length;if(E.length!==S.length)j++,k=Math.min(E.length,S.length);var B=-1;while(++B<k)j+=E[B]^S[B];return j}}),sY=$0((U)=>{U.publicEncrypt=ZF(),U.privateDecrypt=XF(),U.privateEncrypt=function(Z,X){return U.publicEncrypt(Z,X,!0)},U.publicDecrypt=function(Z,X){return U.privateDecrypt(Z,X,!0)}}),YF=$0((U)=>{var Z=(UU(),m0(e1));if(typeof Z.publicEncrypt!=="function")Z=sY();if(U.publicEncrypt=Z.publicEncrypt,U.privateDecrypt=Z.privateDecrypt,typeof Z.privateEncrypt!=="function")U.privateEncrypt=sY().privateEncrypt;else U.privateEncrypt=Z.privateEncrypt;if(typeof Z.publicDecrypt!=="function")U.publicDecrypt=sY().publicDecrypt;else U.publicDecrypt=Z.publicDecrypt}),JF=$0((U)=>{var Z=m1(),X=vX(),Q=Z.Buffer,K=Z.kMaxLength,H=globalThis.crypto||globalThis.msCrypto,$=Math.pow(2,32)-1;function M(L,E){if(typeof L!=="number"||L!==L)throw TypeError("offset must be a number");if(L>$||L<0)throw TypeError("offset must be a uint32");if(L>K||L>E)throw RangeError("offset out of range")}function q(L,E,S){if(typeof L!=="number"||L!==L)throw TypeError("size must be a number");if(L>$||L<0)throw TypeError("size must be a uint32");if(L+E>S||L>K)throw RangeError("buffer too small")}H&&H.getRandomValues,U.randomFill=z,U.randomFillSync=A;function z(L,E,S,j){if(!Q.isBuffer(L)&&!(L instanceof globalThis.Uint8Array))throw TypeError('"buf" argument must be a Buffer or Uint8Array');if(typeof E==="function")j=E,E=0,S=L.length;else if(typeof S==="function")j=S,S=L.length-E;else if(typeof j!=="function")throw TypeError('"cb" argument must be a function');return M(E,L.length),q(S,E,L.length),T(L,E,S,j)}function T(L,E,S,j){if(!1)var k,B;if(j){X(S,function(x,N){if(x)return j(x);N.copy(L,E),j(null,L)});return}var v=X(S);return v.copy(L,E),L}function A(L,E,S){if(typeof E>"u")E=0;if(!Q.isBuffer(L)&&!(L instanceof globalThis.Uint8Array))throw TypeError('"buf" argument must be a Buffer or Uint8Array');if(M(E,L.length),S===void 0)S=L.length-E;return q(S,E,L.length),T(L,E,S)}}),QF=$0((U,Z)=>{var X=(UU(),m0(e1));if(typeof X.randomFill==="function"&&typeof X.randomFillSync==="function")U.randomFill=X.randomFill,U.randomFillSync=X.randomFillSync;else Z.exports=JF()}),GF=$0((U)=>{U.randomBytes=U.rng=U.pseudoRandomBytes=U.prng=vX(),U.createHash=U.Hash=_X(),U.createHmac=U.Hmac=bG();var Z=_I(),X=Object.keys(Z),Q=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(X);U.getHashes=function(){return Q};var K=eG();U.pbkdf2=K.pbkdf2,U.pbkdf2Sync=K.pbkdf2Sync;var H=HH();U.Cipher=H.Cipher,U.createCipher=H.createCipher,U.Cipheriv=H.Cipheriv,U.createCipheriv=H.createCipheriv,U.Decipher=H.Decipher,U.createDecipher=H.createDecipher,U.Decipheriv=H.Decipheriv,U.createDecipheriv=H.createDecipheriv,U.getCiphers=H.getCiphers,U.listCiphers=H.listCiphers;var $=FH();U.DiffieHellmanGroup=$.DiffieHellmanGroup,U.createDiffieHellmanGroup=$.createDiffieHellmanGroup,U.getDiffieHellman=$.getDiffieHellman,U.createDiffieHellman=$.createDiffieHellman,U.DiffieHellman=$.DiffieHellman;var M=OH();U.createSign=M.createSign,U.Sign=M.Sign,U.createVerify=M.createVerify,U.Verify=M.Verify,U.createECDH=yH();var q=YF();U.publicEncrypt=q.publicEncrypt,U.privateEncrypt=q.privateEncrypt,U.publicDecrypt=q.publicDecrypt,U.privateDecrypt=q.privateDecrypt;var z=QF();U.randomFill=z.randomFill,U.randomFillSync=z.randomFillSync,U.createCredentials=function(){throw Error(`sorry, createCredentials is not implemented yet
|
|
14
|
+
})`)}catch(q){$=function(M){this._initNamed(M)}}return X($,F),$.prototype._initNamed=function(q){F.call(this,q)},new $(this)},K.prototype._getDecoder=function(F){if(F=F||"der",!this.decoders.hasOwnProperty(F))this.decoders[F]=this._createNamed(Z.decoders[F]);return this.decoders[F]},K.prototype.decode=function(F,$,q){return this._getDecoder($).decode(F,q)},K.prototype._getEncoder=function(F){if(F=F||"der",!this.encoders.hasOwnProperty(F))this.encoders[F]=this._createNamed(Z.encoders[F]);return this.encoders[F]},K.prototype.encode=function(F,$,q){return this._getEncoder($).encode(F,q)}}),hF=$0((U)=>{var Z=YU();function X(K){this._reporterState={obj:null,path:[],options:K||{},errors:[]}}U.Reporter=X,X.prototype.isError=function(K){return K instanceof Q},X.prototype.save=function(){var K=this._reporterState;return{obj:K.obj,pathLen:K.path.length}},X.prototype.restore=function(K){var F=this._reporterState;F.obj=K.obj,F.path=F.path.slice(0,K.pathLen)},X.prototype.enterKey=function(K){return this._reporterState.path.push(K)},X.prototype.exitKey=function(K){var F=this._reporterState;F.path=F.path.slice(0,K-1)},X.prototype.leaveKey=function(K,F,$){var q=this._reporterState;if(this.exitKey(K),q.obj!==null)q.obj[F]=$},X.prototype.path=function(){return this._reporterState.path.join("/")},X.prototype.enterObject=function(){var K=this._reporterState,F=K.obj;return K.obj={},F},X.prototype.leaveObject=function(K){var F=this._reporterState,$=F.obj;return F.obj=K,$},X.prototype.error=function(K){var F,$=this._reporterState,q=K instanceof Q;if(q)F=K;else F=new Q($.path.map(function(M){return"["+JSON.stringify(M)+"]"}).join(""),K.message||K,K.stack);if(!$.options.partial)throw F;if(!q)$.errors.push(F);return F},X.prototype.wrapResult=function(K){var F=this._reporterState;if(!F.options.partial)return K;return{result:this.isError(K)?null:K,errors:F.errors}};function Q(K,F){this.path=K,this.rethrow(F)}Z(Q,Error),Q.prototype.rethrow=function(K){if(this.message=K+" at: "+(this.path||"(shallow)"),Error.captureStackTrace)Error.captureStackTrace(this,Q);if(!this.stack)try{throw Error(this.message)}catch(F){this.stack=F.stack}return this}}),uG=$0((U)=>{var Z=YU(),X=wZ().Reporter,Q=(g1(),m0(N1)).Buffer;function K($,q){if(X.call(this,q),!Q.isBuffer($)){this.error("Input not Buffer");return}this.base=$,this.offset=0,this.length=$.length}Z(K,X),U.DecoderBuffer=K,K.prototype.save=function(){return{offset:this.offset,reporter:X.prototype.save.call(this)}},K.prototype.restore=function($){var q=new K(this.base);return q.offset=$.offset,q.length=this.offset,this.offset=$.offset,X.prototype.restore.call(this,$.reporter),q},K.prototype.isEmpty=function(){return this.offset===this.length},K.prototype.readUInt8=function($){if(this.offset+1<=this.length)return this.base.readUInt8(this.offset++,!0);else return this.error($||"DecoderBuffer overrun")},K.prototype.skip=function($,q){if(!(this.offset+$<=this.length))return this.error(q||"DecoderBuffer overrun");var M=new K(this.base);return M._reporterState=this._reporterState,M.offset=this.offset,M.length=this.offset+$,this.offset+=$,M},K.prototype.raw=function($){return this.base.slice($?$.offset:this.offset,this.length)};function F($,q){if(Array.isArray($))this.length=0,this.value=$.map(function(M){if(!(M instanceof F))M=new F(M,q);return this.length+=M.length,M},this);else if(typeof $==="number"){if(!(0<=$&&$<=255))return q.error("non-byte EncoderBuffer value");this.value=$,this.length=1}else if(typeof $==="string")this.value=$,this.length=Q.byteLength($);else if(Q.isBuffer($))this.value=$,this.length=$.length;else return q.error("Unsupported type: "+typeof $)}U.EncoderBuffer=F,F.prototype.join=function($,q){if(!$)$=new Q(this.length);if(!q)q=0;if(this.length===0)return $;if(Array.isArray(this.value))this.value.forEach(function(M){M.join($,q),q+=M.length});else{if(typeof this.value==="number")$[q]=this.value;else if(typeof this.value==="string")$.write(this.value,q);else if(Q.isBuffer(this.value))this.value.copy($,q);q+=this.length}return $}}),uF=$0((U,Z)=>{var X=wZ().Reporter,Q=wZ().EncoderBuffer,K=wZ().DecoderBuffer,F=cU(),$=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],q=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat($),M=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];function z(A,L){var E={};if(this._baseState=E,E.enc=A,E.parent=L||null,E.children=null,E.tag=null,E.args=null,E.reverseArgs=null,E.choice=null,E.optional=!1,E.any=!1,E.obj=!1,E.use=null,E.useDecoder=null,E.key=null,E.default=null,E.explicit=null,E.implicit=null,E.contains=null,!E.parent)E.children=[],this._wrap()}Z.exports=z;var T=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];z.prototype.clone=function(){var A=this._baseState,L={};T.forEach(function(S){L[S]=A[S]});var E=new this.constructor(L.parent);return E._baseState=L,E},z.prototype._wrap=function(){var A=this._baseState;q.forEach(function(L){this[L]=function(){var E=new this.constructor(this);return A.children.push(E),E[L].apply(E,arguments)}},this)},z.prototype._init=function(A){var L=this._baseState;F(L.parent===null),A.call(this),L.children=L.children.filter(function(E){return E._baseState.parent===this},this),F.equal(L.children.length,1,"Root node can have only one child")},z.prototype._useArgs=function(A){var L=this._baseState,E=A.filter(function(S){return S instanceof this.constructor},this);if(A=A.filter(function(S){return!(S instanceof this.constructor)},this),E.length!==0)F(L.children===null),L.children=E,E.forEach(function(S){S._baseState.parent=this},this);if(A.length!==0)F(L.args===null),L.args=A,L.reverseArgs=A.map(function(S){if(typeof S!=="object"||S.constructor!==Object)return S;var j={};return Object.keys(S).forEach(function(k){if(k==(k|0))k|=0;var B=S[k];j[B]=k}),j})},M.forEach(function(A){z.prototype[A]=function(){var L=this._baseState;throw Error(A+" not implemented for encoding: "+L.enc)}}),$.forEach(function(A){z.prototype[A]=function(){var L=this._baseState,E=Array.prototype.slice.call(arguments);return F(L.tag===null),L.tag=A,this._useArgs(E),this}}),z.prototype.use=function(A){F(A);var L=this._baseState;return F(L.use===null),L.use=A,this},z.prototype.optional=function(){var A=this._baseState;return A.optional=!0,this},z.prototype.def=function(A){var L=this._baseState;return F(L.default===null),L.default=A,L.optional=!0,this},z.prototype.explicit=function(A){var L=this._baseState;return F(L.explicit===null&&L.implicit===null),L.explicit=A,this},z.prototype.implicit=function(A){var L=this._baseState;return F(L.explicit===null&&L.implicit===null),L.implicit=A,this},z.prototype.obj=function(){var A=this._baseState,L=Array.prototype.slice.call(arguments);if(A.obj=!0,L.length!==0)this._useArgs(L);return this},z.prototype.key=function(A){var L=this._baseState;return F(L.key===null),L.key=A,this},z.prototype.any=function(){var A=this._baseState;return A.any=!0,this},z.prototype.choice=function(A){var L=this._baseState;return F(L.choice===null),L.choice=A,this._useArgs(Object.keys(A).map(function(E){return A[E]})),this},z.prototype.contains=function(A){var L=this._baseState;return F(L.use===null),L.contains=A,this},z.prototype._decode=function(A,L){var E=this._baseState;if(E.parent===null)return A.wrapResult(E.children[0]._decode(A,L));var S=E.default,j=!0,k=null;if(E.key!==null)k=A.enterKey(E.key);if(E.optional){var B=null;if(E.explicit!==null)B=E.explicit;else if(E.implicit!==null)B=E.implicit;else if(E.tag!==null)B=E.tag;if(B===null&&!E.any){var v=A.save();try{if(E.choice===null)this._decodeGeneric(E.tag,A,L);else this._decodeChoice(A,L);j=!0}catch(V0){j=!1}A.restore(v)}else if(j=this._peekTag(A,B,E.any),A.isError(j))return j}var x;if(E.obj&&j)x=A.enterObject();if(j){if(E.explicit!==null){var N=this._decodeTag(A,E.explicit);if(A.isError(N))return N;A=N}var w=A.offset;if(E.use===null&&E.choice===null){if(E.any)var v=A.save();var u=this._decodeTag(A,E.implicit!==null?E.implicit:E.tag,E.any);if(A.isError(u))return u;if(E.any)S=A.raw(v);else A=u}if(L&&L.track&&E.tag!==null)L.track(A.path(),w,A.length,"tagged");if(L&&L.track&&E.tag!==null)L.track(A.path(),A.offset,A.length,"content");if(E.any)S=S;else if(E.choice===null)S=this._decodeGeneric(E.tag,A,L);else S=this._decodeChoice(A,L);if(A.isError(S))return S;if(!E.any&&E.choice===null&&E.children!==null)E.children.forEach(function(V0){V0._decode(A,L)});if(E.contains&&(E.tag==="octstr"||E.tag==="bitstr")){var Z0=new K(S);S=this._getUse(E.contains,A._reporterState.obj)._decode(Z0,L)}}if(E.obj&&j)S=A.leaveObject(x);if(E.key!==null&&(S!==null||j===!0))A.leaveKey(k,E.key,S);else if(k!==null)A.exitKey(k);return S},z.prototype._decodeGeneric=function(A,L,E){var S=this._baseState;if(A==="seq"||A==="set")return null;if(A==="seqof"||A==="setof")return this._decodeList(L,A,S.args[0],E);else if(/str$/.test(A))return this._decodeStr(L,A,E);else if(A==="objid"&&S.args)return this._decodeObjid(L,S.args[0],S.args[1],E);else if(A==="objid")return this._decodeObjid(L,null,null,E);else if(A==="gentime"||A==="utctime")return this._decodeTime(L,A,E);else if(A==="null_")return this._decodeNull(L,E);else if(A==="bool")return this._decodeBool(L,E);else if(A==="objDesc")return this._decodeStr(L,A,E);else if(A==="int"||A==="enum")return this._decodeInt(L,S.args&&S.args[0],E);if(S.use!==null)return this._getUse(S.use,L._reporterState.obj)._decode(L,E);else return L.error("unknown tag: "+A)},z.prototype._getUse=function(A,L){var E=this._baseState;if(E.useDecoder=this._use(A,L),F(E.useDecoder._baseState.parent===null),E.useDecoder=E.useDecoder._baseState.children[0],E.implicit!==E.useDecoder._baseState.implicit)E.useDecoder=E.useDecoder.clone(),E.useDecoder._baseState.implicit=E.implicit;return E.useDecoder},z.prototype._decodeChoice=function(A,L){var E=this._baseState,S=null,j=!1;if(Object.keys(E.choice).some(function(k){var B=A.save(),v=E.choice[k];try{var x=v._decode(A,L);if(A.isError(x))return!1;S={type:k,value:x},j=!0}catch(N){return A.restore(B),!1}return!0},this),!j)return A.error("Choice not matched");return S},z.prototype._createEncoderBuffer=function(A){return new Q(A,this.reporter)},z.prototype._encode=function(A,L,E){var S=this._baseState;if(S.default!==null&&S.default===A)return;var j=this._encodeValue(A,L,E);if(j===void 0)return;if(this._skipDefault(j,L,E))return;return j},z.prototype._encodeValue=function(A,L,E){var S=this._baseState;if(S.parent===null)return S.children[0]._encode(A,L||new X);var v=null;if(this.reporter=L,S.optional&&A===void 0)if(S.default!==null)A=S.default;else return;var j=null,k=!1;if(S.any)v=this._createEncoderBuffer(A);else if(S.choice)v=this._encodeChoice(A,L);else if(S.contains)j=this._getUse(S.contains,E)._encode(A,L),k=!0;else if(S.children)j=S.children.map(function(w){if(w._baseState.tag==="null_")return w._encode(null,L,A);if(w._baseState.key===null)return L.error("Child should have a key");var u=L.enterKey(w._baseState.key);if(typeof A!=="object")return L.error("Child expected, but input is not object");var Z0=w._encode(A[w._baseState.key],L,A);return L.leaveKey(u),Z0},this).filter(function(w){return w}),j=this._createEncoderBuffer(j);else if(S.tag==="seqof"||S.tag==="setof"){if(!(S.args&&S.args.length===1))return L.error("Too many args for : "+S.tag);if(!Array.isArray(A))return L.error("seqof/setof, but data is not Array");var B=this.clone();B._baseState.implicit=null,j=this._createEncoderBuffer(A.map(function(w){var u=this._baseState;return this._getUse(u.args[0],A)._encode(w,L)},B))}else if(S.use!==null)v=this._getUse(S.use,E)._encode(A,L);else j=this._encodePrimitive(S.tag,A),k=!0;var v;if(!S.any&&S.choice===null){var x=S.implicit!==null?S.implicit:S.tag,N=S.implicit===null?"universal":"context";if(x===null){if(S.use===null)L.error("Tag could be omitted only for .use()")}else if(S.use===null)v=this._encodeComposite(x,k,N,j)}if(S.explicit!==null)v=this._encodeComposite(S.explicit,!1,"context",v);return v},z.prototype._encodeChoice=function(A,L){var E=this._baseState,S=E.choice[A.type];if(!S)F(!1,A.type+" not found in "+JSON.stringify(Object.keys(E.choice)));return S._encode(A.value,L)},z.prototype._encodePrimitive=function(A,L){var E=this._baseState;if(/str$/.test(A))return this._encodeStr(L,A);else if(A==="objid"&&E.args)return this._encodeObjid(L,E.reverseArgs[0],E.args[1]);else if(A==="objid")return this._encodeObjid(L,null,null);else if(A==="gentime"||A==="utctime")return this._encodeTime(L,A);else if(A==="null_")return this._encodeNull();else if(A==="int"||A==="enum")return this._encodeInt(L,E.args&&E.reverseArgs[0]);else if(A==="bool")return this._encodeBool(L);else if(A==="objDesc")return this._encodeStr(L,A);else throw Error("Unsupported tag: "+A)},z.prototype._isNumstr=function(A){return/^[0-9 ]*$/.test(A)},z.prototype._isPrintstr=function(A){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(A)}}),wZ=$0((U)=>{var Z=U;Z.Reporter=hF().Reporter,Z.DecoderBuffer=uG().DecoderBuffer,Z.EncoderBuffer=uG().EncoderBuffer,Z.Node=uF()}),bF=$0((U)=>{var Z=GV();U.tagClass={0:"universal",1:"application",2:"context",3:"private"},U.tagClassByName=Z._reverse(U.tagClass),U.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},U.tagByName=Z._reverse(U.tag)}),GV=$0((U)=>{var Z=U;Z._reverse=function(X){var Q={};return Object.keys(X).forEach(function(K){if((K|0)==K)K=K|0;var F=X[K];Q[F]=K}),Q},Z.der=bF()}),VV=$0((U,Z)=>{var X=YU(),Q=uZ(),K=Q.base,F=Q.bignum,$=Q.constants.der;function q(A){this.enc="der",this.name=A.name,this.entity=A,this.tree=new M,this.tree._init(A.body)}Z.exports=q,q.prototype.decode=function(A,L){if(!(A instanceof K.DecoderBuffer))A=new K.DecoderBuffer(A,L);return this.tree._decode(A,L)};function M(A){K.Node.call(this,"der",A)}X(M,K.Node),M.prototype._peekTag=function(A,L,E){if(A.isEmpty())return!1;var S=A.save(),j=z(A,'Failed to peek tag: "'+L+'"');if(A.isError(j))return j;return A.restore(S),j.tag===L||j.tagStr===L||j.tagStr+"of"===L||E},M.prototype._decodeTag=function(A,L,E){var S=z(A,'Failed to decode tag of "'+L+'"');if(A.isError(S))return S;var j=T(A,S.primitive,'Failed to get length of "'+L+'"');if(A.isError(j))return j;if(!E&&S.tag!==L&&S.tagStr!==L&&S.tagStr+"of"!==L)return A.error('Failed to match tag: "'+L+'"');if(S.primitive||j!==null)return A.skip(j,'Failed to match body of: "'+L+'"');var k=A.save(),B=this._skipUntilEnd(A,'Failed to skip indefinite length body: "'+this.tag+'"');if(A.isError(B))return B;return j=A.offset-k.offset,A.restore(k),A.skip(j,'Failed to match body of: "'+L+'"')},M.prototype._skipUntilEnd=function(A,L){while(!0){var E=z(A,L);if(A.isError(E))return E;var S=T(A,E.primitive,L);if(A.isError(S))return S;var j;if(E.primitive||S!==null)j=A.skip(S);else j=this._skipUntilEnd(A,L);if(A.isError(j))return j;if(E.tagStr==="end")break}},M.prototype._decodeList=function(A,L,E,S){var j=[];while(!A.isEmpty()){var k=this._peekTag(A,"end");if(A.isError(k))return k;var B=E.decode(A,"der",S);if(A.isError(B)&&k)break;j.push(B)}return j},M.prototype._decodeStr=function(A,L){if(L==="bitstr"){var E=A.readUInt8();if(A.isError(E))return E;return{unused:E,data:A.raw()}}else if(L==="bmpstr"){var S=A.raw();if(S.length%2===1)return A.error("Decoding of string type: bmpstr length mismatch");var j="";for(var k=0;k<S.length/2;k++)j+=String.fromCharCode(S.readUInt16BE(k*2));return j}else if(L==="numstr"){var B=A.raw().toString("ascii");if(!this._isNumstr(B))return A.error("Decoding of string type: numstr unsupported characters");return B}else if(L==="octstr")return A.raw();else if(L==="objDesc")return A.raw();else if(L==="printstr"){var v=A.raw().toString("ascii");if(!this._isPrintstr(v))return A.error("Decoding of string type: printstr unsupported characters");return v}else if(/str$/.test(L))return A.raw().toString();else return A.error("Decoding of string type: "+L+" unsupported")},M.prototype._decodeObjid=function(A,L,E){var S,j=[],k=0;while(!A.isEmpty()){var B=A.readUInt8();if(k<<=7,k|=B&127,(B&128)===0)j.push(k),k=0}if(B&128)j.push(k);var v=j[0]/40|0,x=j[0]%40;if(E)S=j;else S=[v,x].concat(j.slice(1));if(L){var N=L[S.join(" ")];if(N===void 0)N=L[S.join(".")];if(N!==void 0)S=N}return S},M.prototype._decodeTime=function(A,L){var E=A.raw().toString();if(L==="gentime")var S=E.slice(0,4)|0,j=E.slice(4,6)|0,k=E.slice(6,8)|0,B=E.slice(8,10)|0,v=E.slice(10,12)|0,x=E.slice(12,14)|0;else if(L==="utctime"){var S=E.slice(0,2)|0,j=E.slice(2,4)|0,k=E.slice(4,6)|0,B=E.slice(6,8)|0,v=E.slice(8,10)|0,x=E.slice(10,12)|0;if(S<70)S=2000+S;else S=1900+S}else return A.error("Decoding "+L+" time is not supported yet");return Date.UTC(S,j-1,k,B,v,x,0)},M.prototype._decodeNull=function(A){return null},M.prototype._decodeBool=function(A){var L=A.readUInt8();if(A.isError(L))return L;else return L!==0},M.prototype._decodeInt=function(A,L){var E=A.raw(),S=new F(E);if(L)S=L[S.toString(10)]||S;return S},M.prototype._use=function(A,L){if(typeof A==="function")A=A(L);return A._getDecoder("der").tree};function z(A,L){var E=A.readUInt8(L);if(A.isError(E))return E;var S=$.tagClass[E>>6],j=(E&32)===0;if((E&31)===31){var k=E;E=0;while((k&128)===128){if(k=A.readUInt8(L),A.isError(k))return k;E<<=7,E|=k&127}}else E&=31;var B=$.tag[E];return{cls:S,primitive:j,tag:E,tagStr:B}}function T(A,L,E){var S=A.readUInt8(E);if(A.isError(S))return S;if(!L&&S===128)return null;if((S&128)===0)return S;var j=S&127;if(j>4)return A.error("length octect is too long");S=0;for(var k=0;k<j;k++){S<<=8;var B=A.readUInt8(E);if(A.isError(B))return B;S|=B}return S}}),dF=$0((U,Z)=>{var X=YU(),Q=(g1(),m0(N1)).Buffer,K=VV();function F($){K.call(this,$),this.enc="pem"}X(F,K),Z.exports=F,F.prototype.decode=function($,q){var M=$.toString().split(/[\r\n]+/g),z=q.label.toUpperCase(),T=/^-----(BEGIN|END) ([^-]+)-----$/,A=-1,L=-1;for(var E=0;E<M.length;E++){var S=M[E].match(T);if(S===null)continue;if(S[2]!==z)continue;if(A===-1){if(S[1]!=="BEGIN")break;A=E}else{if(S[1]!=="END")break;L=E;break}}if(A===-1||L===-1)throw Error("PEM section not found for: "+z);var j=M.slice(A+1,L).join("");j.replace(/[^a-z0-9\+\/=]+/gi,"");var k=new Q(j,"base64");return K.prototype.decode.call(this,k,q)}}),lF=$0((U)=>{var Z=U;Z.der=VV(),Z.pem=dF()}),$V=$0((U,Z)=>{var X=YU(),Q=(g1(),m0(N1)).Buffer,K=uZ(),F=K.base,$=K.constants.der;function q(A){this.enc="der",this.name=A.name,this.entity=A,this.tree=new M,this.tree._init(A.body)}Z.exports=q,q.prototype.encode=function(A,L){return this.tree._encode(A,L).join()};function M(A){F.Node.call(this,"der",A)}X(M,F.Node),M.prototype._encodeComposite=function(A,L,E,S){var j=T(A,L,E,this.reporter);if(S.length<128){var v=new Q(2);return v[0]=j,v[1]=S.length,this._createEncoderBuffer([v,S])}var k=1;for(var B=S.length;B>=256;B>>=8)k++;var v=new Q(2+k);v[0]=j,v[1]=128|k;for(var B=1+k,x=S.length;x>0;B--,x>>=8)v[B]=x&255;return this._createEncoderBuffer([v,S])},M.prototype._encodeStr=function(A,L){if(L==="bitstr")return this._createEncoderBuffer([A.unused|0,A.data]);else if(L==="bmpstr"){var E=new Q(A.length*2);for(var S=0;S<A.length;S++)E.writeUInt16BE(A.charCodeAt(S),S*2);return this._createEncoderBuffer(E)}else if(L==="numstr"){if(!this._isNumstr(A))return this.reporter.error("Encoding of string type: numstr supports only digits and space");return this._createEncoderBuffer(A)}else if(L==="printstr"){if(!this._isPrintstr(A))return this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark");return this._createEncoderBuffer(A)}else if(/str$/.test(L))return this._createEncoderBuffer(A);else if(L==="objDesc")return this._createEncoderBuffer(A);else return this.reporter.error("Encoding of string type: "+L+" unsupported")},M.prototype._encodeObjid=function(A,L,E){if(typeof A==="string"){if(!L)return this.reporter.error("string objid given, but no values map found");if(!L.hasOwnProperty(A))return this.reporter.error("objid not found in values map");A=L[A].split(/[\s\.]+/g);for(var S=0;S<A.length;S++)A[S]|=0}else if(Array.isArray(A)){A=A.slice();for(var S=0;S<A.length;S++)A[S]|=0}if(!Array.isArray(A))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(A));if(!E){if(A[1]>=40)return this.reporter.error("Second objid identifier OOB");A.splice(0,2,A[0]*40+A[1])}var j=0;for(var S=0;S<A.length;S++){var k=A[S];for(j++;k>=128;k>>=7)j++}var B=new Q(j),v=B.length-1;for(var S=A.length-1;S>=0;S--){var k=A[S];B[v--]=k&127;while((k>>=7)>0)B[v--]=128|k&127}return this._createEncoderBuffer(B)};function z(A){if(A<10)return"0"+A;else return A}M.prototype._encodeTime=function(A,L){var E,S=new Date(A);if(L==="gentime")E=[z(S.getFullYear()),z(S.getUTCMonth()+1),z(S.getUTCDate()),z(S.getUTCHours()),z(S.getUTCMinutes()),z(S.getUTCSeconds()),"Z"].join("");else if(L==="utctime")E=[z(S.getFullYear()%100),z(S.getUTCMonth()+1),z(S.getUTCDate()),z(S.getUTCHours()),z(S.getUTCMinutes()),z(S.getUTCSeconds()),"Z"].join("");else this.reporter.error("Encoding "+L+" time is not supported yet");return this._encodeStr(E,"octstr")},M.prototype._encodeNull=function(){return this._createEncoderBuffer("")},M.prototype._encodeInt=function(A,L){if(typeof A==="string"){if(!L)return this.reporter.error("String int or enum given, but no values map");if(!L.hasOwnProperty(A))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(A));A=L[A]}if(typeof A!=="number"&&!Q.isBuffer(A)){var E=A.toArray();if(!A.sign&&E[0]&128)E.unshift(0);A=new Q(E)}if(Q.isBuffer(A)){var S=A.length;if(A.length===0)S++;var k=new Q(S);if(A.copy(k),A.length===0)k[0]=0;return this._createEncoderBuffer(k)}if(A<128)return this._createEncoderBuffer(A);if(A<256)return this._createEncoderBuffer([0,A]);var S=1;for(var j=A;j>=256;j>>=8)S++;var k=Array(S);for(var j=k.length-1;j>=0;j--)k[j]=A&255,A>>=8;if(k[0]&128)k.unshift(0);return this._createEncoderBuffer(new Q(k))},M.prototype._encodeBool=function(A){return this._createEncoderBuffer(A?255:0)},M.prototype._use=function(A,L){if(typeof A==="function")A=A(L);return A._getEncoder("der").tree},M.prototype._skipDefault=function(A,L,E){var S=this._baseState,j;if(S.default===null)return!1;var k=A.join();if(S.defaultBuffer===void 0)S.defaultBuffer=this._encodeValue(S.default,L,E).join();if(k.length!==S.defaultBuffer.length)return!1;for(j=0;j<k.length;j++)if(k[j]!==S.defaultBuffer[j])return!1;return!0};function T(A,L,E,S){var j;if(A==="seqof")A="seq";else if(A==="setof")A="set";if($.tagByName.hasOwnProperty(A))j=$.tagByName[A];else if(typeof A==="number"&&(A|0)===A)j=A;else return S.error("Unknown tag: "+A);if(j>=31)return S.error("Multi-octet tag encoding unsupported");if(!L)j|=32;return j|=$.tagClassByName[E||"universal"]<<6,j}}),oF=$0((U,Z)=>{var X=YU(),Q=$V();function K(F){Q.call(this,F),this.enc="pem"}X(K,Q),Z.exports=K,K.prototype.encode=function(F,$){var q=Q.prototype.encode.call(this,F),M=q.toString("base64"),z=["-----BEGIN "+$.label+"-----"];for(var T=0;T<M.length;T+=64)z.push(M.slice(T,T+64));return z.push("-----END "+$.label+"-----"),z.join(`
|
|
15
|
+
`)}}),nF=$0((U)=>{var Z=U;Z.der=$V(),Z.pem=oF()}),uZ=$0((U)=>{var Z=U;Z.bignum=cF(),Z.define=pF().define,Z.base=wZ(),Z.constants=GV(),Z.decoders=lF(),Z.encoders=nF()}),mF=$0((U,Z)=>{var X=uZ(),Q=X.define("Time",function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})}),K=X.define("AttributeTypeValue",function(){this.seq().obj(this.key("type").objid(),this.key("value").any())}),F=X.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional(),this.key("curve").objid().optional())}),$=X.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(F),this.key("subjectPublicKey").bitstr())}),q=X.define("RelativeDistinguishedName",function(){this.setof(K)}),M=X.define("RDNSequence",function(){this.seqof(q)}),z=X.define("Name",function(){this.choice({rdnSequence:this.use(M)})}),T=X.define("Validity",function(){this.seq().obj(this.key("notBefore").use(Q),this.key("notAfter").use(Q))}),A=X.define("Extension",function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())}),L=X.define("TBSCertificate",function(){this.seq().obj(this.key("version").explicit(0).int().optional(),this.key("serialNumber").int(),this.key("signature").use(F),this.key("issuer").use(z),this.key("validity").use(T),this.key("subject").use(z),this.key("subjectPublicKeyInfo").use($),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(A).optional())}),E=X.define("X509Certificate",function(){this.seq().obj(this.key("tbsCertificate").use(L),this.key("signatureAlgorithm").use(F),this.key("signatureValue").bitstr())});Z.exports=E}),sF=$0((U)=>{var Z=uZ();U.certificate=mF();var X=Z.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())});U.RSAPrivateKey=X;var Q=Z.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});U.RSAPublicKey=Q;var K=Z.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())}),F=Z.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(K),this.key("subjectPublicKey").bitstr())});U.PublicKey=F;var $=Z.define("PrivateKeyInfo",function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(K),this.key("subjectPrivateKey").octstr())});U.PrivateKey=$;var q=Z.define("EncryptedPrivateKeyInfo",function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())});U.EncryptedPrivateKey=q;var M=Z.define("DSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())});U.DSAPrivateKey=M,U.DSAparam=Z.define("DSAparam",function(){this.int()});var z=Z.define("ECParameters",function(){this.choice({namedCurve:this.objid()})}),T=Z.define("ECPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(z),this.key("publicKey").optional().explicit(1).bitstr())});U.ECPrivateKey=T,U.signature=Z.define("signature",function(){this.seq().obj(this.key("r").int(),this.key("s").int())})}),rF=$0((U,Z)=>{Z.exports={"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"}}),aF=$0((U,Z)=>{var X=m1().Buffer,Q=mY().Transform,K=YU();function F(z){Q.call(this),this._block=X.allocUnsafe(z),this._blockSize=z,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}K(F,Q),F.prototype._transform=function(z,T,A){var L=null;try{this.update(z,T)}catch(E){L=E}A(L)},F.prototype._flush=function(z){var T=null;try{this.push(this.digest())}catch(A){T=A}z(T)};var $=typeof Uint8Array<"u",q=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&ArrayBuffer.isView&&(X.prototype instanceof Uint8Array||X.TYPED_ARRAY_SUPPORT);function M(z,T){if(z instanceof X)return z;if(typeof z==="string")return X.from(z,T);if(q&&ArrayBuffer.isView(z)){if(z.byteLength===0)return X.alloc(0);var A=X.from(z.buffer,z.byteOffset,z.byteLength);if(A.byteLength===z.byteLength)return A}if($&&z instanceof Uint8Array)return X.from(z);if(X.isBuffer(z)&&z.constructor&&typeof z.constructor.isBuffer==="function"&&z.constructor.isBuffer(z))return X.from(z);throw TypeError('The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView.')}F.prototype.update=function(z,T){if(this._finalized)throw Error("Digest already called");z=M(z,T);var A=this._block,L=0;while(this._blockOffset+z.length-L>=this._blockSize){for(var E=this._blockOffset;E<this._blockSize;)A[E++]=z[L++];this._update(),this._blockOffset=0}while(L<z.length)A[this._blockOffset++]=z[L++];for(var S=0,j=z.length*8;j>0;++S)if(this._length[S]+=j,j=this._length[S]/4294967296|0,j>0)this._length[S]-=4294967296*j;return this},F.prototype._update=function(){throw Error("_update is not implemented")},F.prototype.digest=function(z){if(this._finalized)throw Error("Digest already called");this._finalized=!0;var T=this._digest();if(z!==void 0)T=T.toString(z);this._block.fill(0),this._blockOffset=0;for(var A=0;A<4;++A)this._length[A]=0;return T},F.prototype._digest=function(){throw Error("_digest is not implemented")},Z.exports=F}),tF=$0((U,Z)=>{var X=YU(),Q=aF(),K=m1().Buffer,F=Array(16);function $(){Q.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}X($,Q),$.prototype._update=function(){var L=F;for(var E=0;E<16;++E)L[E]=this._block.readInt32LE(E*4);var S=this._a,j=this._b,k=this._c,B=this._d;S=M(S,j,k,B,L[0],3614090360,7),B=M(B,S,j,k,L[1],3905402710,12),k=M(k,B,S,j,L[2],606105819,17),j=M(j,k,B,S,L[3],3250441966,22),S=M(S,j,k,B,L[4],4118548399,7),B=M(B,S,j,k,L[5],1200080426,12),k=M(k,B,S,j,L[6],2821735955,17),j=M(j,k,B,S,L[7],4249261313,22),S=M(S,j,k,B,L[8],1770035416,7),B=M(B,S,j,k,L[9],2336552879,12),k=M(k,B,S,j,L[10],4294925233,17),j=M(j,k,B,S,L[11],2304563134,22),S=M(S,j,k,B,L[12],1804603682,7),B=M(B,S,j,k,L[13],4254626195,12),k=M(k,B,S,j,L[14],2792965006,17),j=M(j,k,B,S,L[15],1236535329,22),S=z(S,j,k,B,L[1],4129170786,5),B=z(B,S,j,k,L[6],3225465664,9),k=z(k,B,S,j,L[11],643717713,14),j=z(j,k,B,S,L[0],3921069994,20),S=z(S,j,k,B,L[5],3593408605,5),B=z(B,S,j,k,L[10],38016083,9),k=z(k,B,S,j,L[15],3634488961,14),j=z(j,k,B,S,L[4],3889429448,20),S=z(S,j,k,B,L[9],568446438,5),B=z(B,S,j,k,L[14],3275163606,9),k=z(k,B,S,j,L[3],4107603335,14),j=z(j,k,B,S,L[8],1163531501,20),S=z(S,j,k,B,L[13],2850285829,5),B=z(B,S,j,k,L[2],4243563512,9),k=z(k,B,S,j,L[7],1735328473,14),j=z(j,k,B,S,L[12],2368359562,20),S=T(S,j,k,B,L[5],4294588738,4),B=T(B,S,j,k,L[8],2272392833,11),k=T(k,B,S,j,L[11],1839030562,16),j=T(j,k,B,S,L[14],4259657740,23),S=T(S,j,k,B,L[1],2763975236,4),B=T(B,S,j,k,L[4],1272893353,11),k=T(k,B,S,j,L[7],4139469664,16),j=T(j,k,B,S,L[10],3200236656,23),S=T(S,j,k,B,L[13],681279174,4),B=T(B,S,j,k,L[0],3936430074,11),k=T(k,B,S,j,L[3],3572445317,16),j=T(j,k,B,S,L[6],76029189,23),S=T(S,j,k,B,L[9],3654602809,4),B=T(B,S,j,k,L[12],3873151461,11),k=T(k,B,S,j,L[15],530742520,16),j=T(j,k,B,S,L[2],3299628645,23),S=A(S,j,k,B,L[0],4096336452,6),B=A(B,S,j,k,L[7],1126891415,10),k=A(k,B,S,j,L[14],2878612391,15),j=A(j,k,B,S,L[5],4237533241,21),S=A(S,j,k,B,L[12],1700485571,6),B=A(B,S,j,k,L[3],2399980690,10),k=A(k,B,S,j,L[10],4293915773,15),j=A(j,k,B,S,L[1],2240044497,21),S=A(S,j,k,B,L[8],1873313359,6),B=A(B,S,j,k,L[15],4264355552,10),k=A(k,B,S,j,L[6],2734768916,15),j=A(j,k,B,S,L[13],1309151649,21),S=A(S,j,k,B,L[4],4149444226,6),B=A(B,S,j,k,L[11],3174756917,10),k=A(k,B,S,j,L[2],718787259,15),j=A(j,k,B,S,L[9],3951481745,21),this._a=this._a+S|0,this._b=this._b+j|0,this._c=this._c+k|0,this._d=this._d+B|0},$.prototype._digest=function(){if(this._block[this._blockOffset++]=128,this._blockOffset>56)this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0;this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var L=K.allocUnsafe(16);return L.writeInt32LE(this._a,0),L.writeInt32LE(this._b,4),L.writeInt32LE(this._c,8),L.writeInt32LE(this._d,12),L};function q(L,E){return L<<E|L>>>32-E}function M(L,E,S,j,k,B,v){return q(L+(E&S|~E&j)+k+B|0,v)+E|0}function z(L,E,S,j,k,B,v){return q(L+(E&j|S&~j)+k+B|0,v)+E|0}function T(L,E,S,j,k,B,v){return q(L+(E^S^j)+k+B|0,v)+E|0}function A(L,E,S,j,k,B,v){return q(L+(S^(E|~j))+k+B|0,v)+E|0}Z.exports=$}),iF=$0((U,Z)=>{var X=m1().Buffer,Q=tF();function K(F,$,q,M){if(!X.isBuffer(F))F=X.from(F,"binary");if($){if(!X.isBuffer($))$=X.from($,"binary");if($.length!==8)throw RangeError("salt should be Buffer with 8 byte length")}var z=q/8,T=X.alloc(z),A=X.alloc(M||0),L=X.alloc(0);while(z>0||M>0){var E=new Q;if(E.update(L),E.update(F),$)E.update($);L=E.digest();var S=0;if(z>0){var j=T.length-z;S=Math.min(z,L.length),L.copy(T,j,0,S),z-=S}if(S<L.length&&M>0){var k=A.length-M,B=Math.min(M,L.length-S);L.copy(A,k,S,S+B),M-=B}}return L.fill(0),{key:T,iv:A}}Z.exports=K}),KV=$0((U)=>{var Z=(UU(),m0(e1));U.createCipher=U.Cipher=Z.createCipher,U.createCipheriv=U.Cipheriv=Z.createCipheriv,U.createDecipher=U.Decipher=Z.createDecipher,U.createDecipheriv=U.Decipheriv=Z.createDecipheriv,U.listCiphers=U.getCiphers=Z.getCiphers}),eF=$0((U,Z)=>{var X=/Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r+/=]+)[\n\r]+/m,Q=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,K=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m,F=iF(),$=KV(),q=m1().Buffer;Z.exports=function(M,z){var T=M.toString(),A=T.match(X),L;if(!A){var E=T.match(K);L=q.from(E[2].replace(/[\r\n]/g,""),"base64")}else{var S="aes"+A[1],j=q.from(A[2],"hex"),k=q.from(A[3].replace(/[\r\n]/g,""),"base64"),B=F(z,j.slice(0,8),parseInt(A[1],10)).key,v=[],x=$.createDecipheriv(S,B,j);v.push(x.update(k)),v.push(x.final()),L=q.concat(v)}var N=T.match(Q)[1];return{tag:N,data:L}}}),WV=$0((U,Z)=>{var X=sF(),Q=rF(),K=eF(),F=KV(),$=eG().pbkdf2Sync,q=m1().Buffer;function M(T,A){var L=T.algorithm.decrypt.kde.kdeparams.salt,E=parseInt(T.algorithm.decrypt.kde.kdeparams.iters.toString(),10),S=Q[T.algorithm.decrypt.cipher.algo.join(".")],j=T.algorithm.decrypt.cipher.iv,k=T.subjectPrivateKey,B=parseInt(S.split("-")[1],10)/8,v=$(A,L,E,B,"sha1"),x=F.createDecipheriv(S,v,j),N=[];return N.push(x.update(k)),N.push(x.final()),q.concat(N)}function z(T){var A;if(typeof T==="object"&&!q.isBuffer(T))A=T.passphrase,T=T.key;if(typeof T==="string")T=q.from(T);var L=K(T,A),E=L.tag,S=L.data,j,k;switch(E){case"CERTIFICATE":k=X.certificate.decode(S,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":if(!k)k=X.PublicKey.decode(S,"der");switch(j=k.algorithm.algorithm.join("."),j){case"1.2.840.113549.1.1.1":return X.RSAPublicKey.decode(k.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return k.subjectPrivateKey=k.subjectPublicKey,{type:"ec",data:k};case"1.2.840.10040.4.1":return k.algorithm.params.pub_key=X.DSAparam.decode(k.subjectPublicKey.data,"der"),{type:"dsa",data:k.algorithm.params};default:throw Error("unknown key id "+j)}case"ENCRYPTED PRIVATE KEY":S=X.EncryptedPrivateKey.decode(S,"der"),S=M(S,A);case"PRIVATE KEY":switch(k=X.PrivateKey.decode(S,"der"),j=k.algorithm.algorithm.join("."),j){case"1.2.840.113549.1.1.1":return X.RSAPrivateKey.decode(k.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:k.algorithm.curve,privateKey:X.ECPrivateKey.decode(k.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return k.algorithm.params.priv_key=X.DSAparam.decode(k.subjectPrivateKey,"der"),{type:"dsa",params:k.algorithm.params};default:throw Error("unknown key id "+j)}case"RSA PUBLIC KEY":return X.RSAPublicKey.decode(S,"der");case"RSA PRIVATE KEY":return X.RSAPrivateKey.decode(S,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:X.DSAPrivateKey.decode(S,"der")};case"EC PRIVATE KEY":return S=X.ECPrivateKey.decode(S,"der"),{curve:S.parameters.value,privateKey:S.privateKey};default:throw Error("unknown key type "+E)}}z.signature=X.signature,Z.exports=z}),IV=$0((U,Z)=>{var X=_X(),Q=m1().Buffer;Z.exports=function(F,$){var q=Q.alloc(0),M=0,z;while(q.length<$)z=K(M++),q=Q.concat([q,X("sha1").update(F).update(z).digest()]);return q.slice(0,$)};function K(F){var $=Q.allocUnsafe(4);return $.writeUInt32BE(F,0),$}}),FV=$0((U,Z)=>{Z.exports=function(X,Q){var K=X.length,F=-1;while(++F<K)X[F]^=Q[F];return X}}),YJ=$0((U,Z)=>{(function(X,Q){function K(Y,V){if(!Y)throw Error(V||"Assertion failed")}function F(Y,V){Y.super_=V;var I=function(){};I.prototype=V.prototype,Y.prototype=new I,Y.prototype.constructor=Y}function $(Y,V,I){if($.isBN(Y))return Y;if(this.negative=0,this.words=null,this.length=0,this.red=null,Y!==null){if(V==="le"||V==="be")I=V,V=10;this._init(Y||0,V||10,I||"be")}}if(typeof X==="object")X.exports=$;else Q.BN=$;$.BN=$,$.wordSize=26;var q;try{if(typeof window<"u"&&typeof window.Buffer<"u")q=window.Buffer;else q=(g1(),m0(N1)).Buffer}catch(Y){}$.isBN=function(Y){if(Y instanceof $)return!0;return Y!==null&&typeof Y==="object"&&Y.constructor.wordSize===$.wordSize&&Array.isArray(Y.words)},$.max=function(Y,V){if(Y.cmp(V)>0)return Y;return V},$.min=function(Y,V){if(Y.cmp(V)<0)return Y;return V},$.prototype._init=function(Y,V,I){if(typeof Y==="number")return this._initNumber(Y,V,I);if(typeof Y==="object")return this._initArray(Y,V,I);if(V==="hex")V=16;K(V===(V|0)&&V>=2&&V<=36),Y=Y.toString().replace(/\s+/g,"");var G=0;if(Y[0]==="-")G++,this.negative=1;if(G<Y.length){if(V===16)this._parseHex(Y,G,I);else if(this._parseBase(Y,V,G),I==="le")this._initArray(this.toArray(),V,I)}},$.prototype._initNumber=function(Y,V,I){if(Y<0)this.negative=1,Y=-Y;if(Y<67108864)this.words=[Y&67108863],this.length=1;else if(Y<4503599627370496)this.words=[Y&67108863,Y/67108864&67108863],this.length=2;else K(Y<9007199254740992),this.words=[Y&67108863,Y/67108864&67108863,1],this.length=3;if(I!=="le")return;this._initArray(this.toArray(),V,I)},$.prototype._initArray=function(Y,V,I){if(K(typeof Y.length==="number"),Y.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(Y.length/3),this.words=Array(this.length);for(var G=0;G<this.length;G++)this.words[G]=0;var W,C,D=0;if(I==="be"){for(G=Y.length-1,W=0;G>=0;G-=3)if(C=Y[G]|Y[G-1]<<8|Y[G-2]<<16,this.words[W]|=C<<D&67108863,this.words[W+1]=C>>>26-D&67108863,D+=24,D>=26)D-=26,W++}else if(I==="le"){for(G=0,W=0;G<Y.length;G+=3)if(C=Y[G]|Y[G+1]<<8|Y[G+2]<<16,this.words[W]|=C<<D&67108863,this.words[W+1]=C>>>26-D&67108863,D+=24,D>=26)D-=26,W++}return this.strip()};function M(Y,V){var I=Y.charCodeAt(V);if(I>=65&&I<=70)return I-55;else if(I>=97&&I<=102)return I-87;else return I-48&15}function z(Y,V,I){var G=M(Y,I);if(I-1>=V)G|=M(Y,I-1)<<4;return G}$.prototype._parseHex=function(Y,V,I){this.length=Math.ceil((Y.length-V)/6),this.words=Array(this.length);for(var G=0;G<this.length;G++)this.words[G]=0;var W=0,C=0,D;if(I==="be")for(G=Y.length-1;G>=V;G-=2)if(D=z(Y,V,G)<<W,this.words[C]|=D&67108863,W>=18)W-=18,C+=1,this.words[C]|=D>>>26;else W+=8;else{var H=Y.length-V;for(G=H%2===0?V+1:V;G<Y.length;G+=2)if(D=z(Y,V,G)<<W,this.words[C]|=D&67108863,W>=18)W-=18,C+=1,this.words[C]|=D>>>26;else W+=8}this.strip()};function T(Y,V,I,G){var W=0,C=Math.min(Y.length,I);for(var D=V;D<C;D++){var H=Y.charCodeAt(D)-48;if(W*=G,H>=49)W+=H-49+10;else if(H>=17)W+=H-17+10;else W+=H}return W}$.prototype._parseBase=function(Y,V,I){this.words=[0],this.length=1;for(var G=0,W=1;W<=67108863;W*=V)G++;G--,W=W/V|0;var C=Y.length-I,D=C%G,H=Math.min(C,C-D)+I,J=0;for(var O=I;O<H;O+=G)if(J=T(Y,O,O+G,V),this.imuln(W),this.words[0]+J<67108864)this.words[0]+=J;else this._iaddn(J);if(D!==0){var P=1;J=T(Y,O,Y.length,V);for(O=0;O<D;O++)P*=V;if(this.imuln(P),this.words[0]+J<67108864)this.words[0]+=J;else this._iaddn(J)}this.strip()},$.prototype.copy=function(Y){Y.words=Array(this.length);for(var V=0;V<this.length;V++)Y.words[V]=this.words[V];Y.length=this.length,Y.negative=this.negative,Y.red=this.red},$.prototype.clone=function(){var Y=new $(null);return this.copy(Y),Y},$.prototype._expand=function(Y){while(this.length<Y)this.words[this.length++]=0;return this},$.prototype.strip=function(){while(this.length>1&&this.words[this.length-1]===0)this.length--;return this._normSign()},$.prototype._normSign=function(){if(this.length===1&&this.words[0]===0)this.negative=0;return this},$.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var A=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],L=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],E=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64000000,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,24300000,28629151,33554432,39135393,45435424,52521875,60466176];if($.prototype.toString=function(Y,V){Y=Y||10,V=V|0||1;var I;if(Y===16||Y==="hex"){I="";var G=0,W=0;for(var C=0;C<this.length;C++){var D=this.words[C],H=((D<<G|W)&16777215).toString(16);if(W=D>>>24-G&16777215,G+=2,G>=26)G-=26,C--;if(W!==0||C!==this.length-1)I=A[6-H.length]+H+I;else I=H+I}if(W!==0)I=W.toString(16)+I;while(I.length%V!==0)I="0"+I;if(this.negative!==0)I="-"+I;return I}if(Y===(Y|0)&&Y>=2&&Y<=36){var J=L[Y],O=E[Y];I="";var P=this.clone();P.negative=0;while(!P.isZero()){var R=P.modn(O).toString(Y);if(P=P.idivn(O),!P.isZero())I=A[J-R.length]+R+I;else I=R+I}if(this.isZero())I="0"+I;while(I.length%V!==0)I="0"+I;if(this.negative!==0)I="-"+I;return I}K(!1,"Base should be between 2 and 36")},$.prototype.toNumber=function(){var Y=this.words[0];if(this.length===2)Y+=this.words[1]*67108864;else if(this.length===3&&this.words[2]===1)Y+=4503599627370496+this.words[1]*67108864;else if(this.length>2)K(!1,"Number can only safely store up to 53 bits");return this.negative!==0?-Y:Y},$.prototype.toJSON=function(){return this.toString(16)},$.prototype.toBuffer=function(Y,V){return K(typeof q<"u"),this.toArrayLike(q,Y,V)},$.prototype.toArray=function(Y,V){return this.toArrayLike(Array,Y,V)},$.prototype.toArrayLike=function(Y,V,I){var G=this.byteLength(),W=I||Math.max(1,G);K(G<=W,"byte array longer than desired length"),K(W>0,"Requested array length <= 0"),this.strip();var C=V==="le",D=new Y(W),H,J,O=this.clone();if(!C){for(J=0;J<W-G;J++)D[J]=0;for(J=0;!O.isZero();J++)H=O.andln(255),O.iushrn(8),D[W-J-1]=H}else{for(J=0;!O.isZero();J++)H=O.andln(255),O.iushrn(8),D[J]=H;for(;J<W;J++)D[J]=0}return D},Math.clz32)$.prototype._countBits=function(Y){return 32-Math.clz32(Y)};else $.prototype._countBits=function(Y){var V=Y,I=0;if(V>=4096)I+=13,V>>>=13;if(V>=64)I+=7,V>>>=7;if(V>=8)I+=4,V>>>=4;if(V>=2)I+=2,V>>>=2;return I+V};$.prototype._zeroBits=function(Y){if(Y===0)return 26;var V=Y,I=0;if((V&8191)===0)I+=13,V>>>=13;if((V&127)===0)I+=7,V>>>=7;if((V&15)===0)I+=4,V>>>=4;if((V&3)===0)I+=2,V>>>=2;if((V&1)===0)I++;return I},$.prototype.bitLength=function(){var Y=this.words[this.length-1],V=this._countBits(Y);return(this.length-1)*26+V};function S(Y){var V=Array(Y.bitLength());for(var I=0;I<V.length;I++){var G=I/26|0,W=I%26;V[I]=(Y.words[G]&1<<W)>>>W}return V}$.prototype.zeroBits=function(){if(this.isZero())return 0;var Y=0;for(var V=0;V<this.length;V++){var I=this._zeroBits(this.words[V]);if(Y+=I,I!==26)break}return Y},$.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},$.prototype.toTwos=function(Y){if(this.negative!==0)return this.abs().inotn(Y).iaddn(1);return this.clone()},$.prototype.fromTwos=function(Y){if(this.testn(Y-1))return this.notn(Y).iaddn(1).ineg();return this.clone()},$.prototype.isNeg=function(){return this.negative!==0},$.prototype.neg=function(){return this.clone().ineg()},$.prototype.ineg=function(){if(!this.isZero())this.negative^=1;return this},$.prototype.iuor=function(Y){while(this.length<Y.length)this.words[this.length++]=0;for(var V=0;V<Y.length;V++)this.words[V]=this.words[V]|Y.words[V];return this.strip()},$.prototype.ior=function(Y){return K((this.negative|Y.negative)===0),this.iuor(Y)},$.prototype.or=function(Y){if(this.length>Y.length)return this.clone().ior(Y);return Y.clone().ior(this)},$.prototype.uor=function(Y){if(this.length>Y.length)return this.clone().iuor(Y);return Y.clone().iuor(this)},$.prototype.iuand=function(Y){var V;if(this.length>Y.length)V=Y;else V=this;for(var I=0;I<V.length;I++)this.words[I]=this.words[I]&Y.words[I];return this.length=V.length,this.strip()},$.prototype.iand=function(Y){return K((this.negative|Y.negative)===0),this.iuand(Y)},$.prototype.and=function(Y){if(this.length>Y.length)return this.clone().iand(Y);return Y.clone().iand(this)},$.prototype.uand=function(Y){if(this.length>Y.length)return this.clone().iuand(Y);return Y.clone().iuand(this)},$.prototype.iuxor=function(Y){var V,I;if(this.length>Y.length)V=this,I=Y;else V=Y,I=this;for(var G=0;G<I.length;G++)this.words[G]=V.words[G]^I.words[G];if(this!==V)for(;G<V.length;G++)this.words[G]=V.words[G];return this.length=V.length,this.strip()},$.prototype.ixor=function(Y){return K((this.negative|Y.negative)===0),this.iuxor(Y)},$.prototype.xor=function(Y){if(this.length>Y.length)return this.clone().ixor(Y);return Y.clone().ixor(this)},$.prototype.uxor=function(Y){if(this.length>Y.length)return this.clone().iuxor(Y);return Y.clone().iuxor(this)},$.prototype.inotn=function(Y){K(typeof Y==="number"&&Y>=0);var V=Math.ceil(Y/26)|0,I=Y%26;if(this._expand(V),I>0)V--;for(var G=0;G<V;G++)this.words[G]=~this.words[G]&67108863;if(I>0)this.words[G]=~this.words[G]&67108863>>26-I;return this.strip()},$.prototype.notn=function(Y){return this.clone().inotn(Y)},$.prototype.setn=function(Y,V){K(typeof Y==="number"&&Y>=0);var I=Y/26|0,G=Y%26;if(this._expand(I+1),V)this.words[I]=this.words[I]|1<<G;else this.words[I]=this.words[I]&~(1<<G);return this.strip()},$.prototype.iadd=function(Y){var V;if(this.negative!==0&&Y.negative===0)return this.negative=0,V=this.isub(Y),this.negative^=1,this._normSign();else if(this.negative===0&&Y.negative!==0)return Y.negative=0,V=this.isub(Y),Y.negative=1,V._normSign();var I,G;if(this.length>Y.length)I=this,G=Y;else I=Y,G=this;var W=0;for(var C=0;C<G.length;C++)V=(I.words[C]|0)+(G.words[C]|0)+W,this.words[C]=V&67108863,W=V>>>26;for(;W!==0&&C<I.length;C++)V=(I.words[C]|0)+W,this.words[C]=V&67108863,W=V>>>26;if(this.length=I.length,W!==0)this.words[this.length]=W,this.length++;else if(I!==this)for(;C<I.length;C++)this.words[C]=I.words[C];return this},$.prototype.add=function(Y){var V;if(Y.negative!==0&&this.negative===0)return Y.negative=0,V=this.sub(Y),Y.negative^=1,V;else if(Y.negative===0&&this.negative!==0)return this.negative=0,V=Y.sub(this),this.negative=1,V;if(this.length>Y.length)return this.clone().iadd(Y);return Y.clone().iadd(this)},$.prototype.isub=function(Y){if(Y.negative!==0){Y.negative=0;var V=this.iadd(Y);return Y.negative=1,V._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(Y),this.negative=1,this._normSign();var I=this.cmp(Y);if(I===0)return this.negative=0,this.length=1,this.words[0]=0,this;var G,W;if(I>0)G=this,W=Y;else G=Y,W=this;var C=0;for(var D=0;D<W.length;D++)V=(G.words[D]|0)-(W.words[D]|0)+C,C=V>>26,this.words[D]=V&67108863;for(;C!==0&&D<G.length;D++)V=(G.words[D]|0)+C,C=V>>26,this.words[D]=V&67108863;if(C===0&&D<G.length&&G!==this)for(;D<G.length;D++)this.words[D]=G.words[D];if(this.length=Math.max(this.length,D),G!==this)this.negative=1;return this.strip()},$.prototype.sub=function(Y){return this.clone().isub(Y)};function j(Y,V,I){I.negative=V.negative^Y.negative;var G=Y.length+V.length|0;I.length=G,G=G-1|0;var W=Y.words[0]|0,C=V.words[0]|0,D=W*C,H=D&67108863,J=D/67108864|0;I.words[0]=H;for(var O=1;O<G;O++){var P=J>>>26,R=J&67108863,_=Math.min(O,V.length-1);for(var f=Math.max(0,O-Y.length+1);f<=_;f++){var c=O-f|0;W=Y.words[c]|0,C=V.words[f]|0,D=W*C+R,P+=D/67108864|0,R=D&67108863}I.words[O]=R|0,J=P|0}if(J!==0)I.words[O]=J|0;else I.length--;return I.strip()}var k=function(Y,V,I){var G=Y.words,W=V.words,C=I.words,D=0,H,J,O,P=G[0]|0,R=P&8191,_=P>>>13,f=G[1]|0,c=f&8191,o=f>>>13,K0=G[2]|0,a=K0&8191,l=K0>>>13,Q0=G[3]|0,n=Q0&8191,s=Q0>>>13,f0=G[4]|0,y=f0&8191,h=f0>>>13,G0=G[5]|0,t=G0&8191,U0=G0>>>13,L0=G[6]|0,p=L0&8191,m=L0>>>13,g0=G[7]|0,r=g0&8191,J0=g0>>>13,h0=G[8]|0,H0=h0&8191,O0=h0>>>13,J1=G[9]|0,I0=J1&8191,C0=J1>>>13,K1=W[0]|0,q0=K1&8191,z0=K1>>>13,d1=W[1]|0,T0=d1&8191,j0=d1>>>13,l1=W[2]|0,v0=l1&8191,R0=l1>>>13,h1=W[3]|0,_0=h1&8191,E0=h1>>>13,_1=W[4]|0,B0=_1&8191,x0=_1>>>13,B1=W[5]|0,S0=B1&8191,g=B1>>>13,d=W[6]|0,e=d&8191,X0=d>>>13,y0=W[7]|0,F0=y0&8191,A0=y0>>>13,Q1=W[8]|0,P0=Q1&8191,N0=Q1>>>13,u1=W[9]|0,k0=u1&8191,M0=u1>>>13;I.negative=Y.negative^V.negative,I.length=19,H=Math.imul(R,q0),J=Math.imul(R,z0),J=J+Math.imul(_,q0)|0,O=Math.imul(_,z0);var G1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(G1>>>26)|0,G1&=67108863,H=Math.imul(c,q0),J=Math.imul(c,z0),J=J+Math.imul(o,q0)|0,O=Math.imul(o,z0),H=H+Math.imul(R,T0)|0,J=J+Math.imul(R,j0)|0,J=J+Math.imul(_,T0)|0,O=O+Math.imul(_,j0)|0;var l0=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(l0>>>26)|0,l0&=67108863,H=Math.imul(a,q0),J=Math.imul(a,z0),J=J+Math.imul(l,q0)|0,O=Math.imul(l,z0),H=H+Math.imul(c,T0)|0,J=J+Math.imul(c,j0)|0,J=J+Math.imul(o,T0)|0,O=O+Math.imul(o,j0)|0,H=H+Math.imul(R,v0)|0,J=J+Math.imul(R,R0)|0,J=J+Math.imul(_,v0)|0,O=O+Math.imul(_,R0)|0;var b0=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(b0>>>26)|0,b0&=67108863,H=Math.imul(n,q0),J=Math.imul(n,z0),J=J+Math.imul(s,q0)|0,O=Math.imul(s,z0),H=H+Math.imul(a,T0)|0,J=J+Math.imul(a,j0)|0,J=J+Math.imul(l,T0)|0,O=O+Math.imul(l,j0)|0,H=H+Math.imul(c,v0)|0,J=J+Math.imul(c,R0)|0,J=J+Math.imul(o,v0)|0,O=O+Math.imul(o,R0)|0,H=H+Math.imul(R,_0)|0,J=J+Math.imul(R,E0)|0,J=J+Math.imul(_,_0)|0,O=O+Math.imul(_,E0)|0;var t0=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(t0>>>26)|0,t0&=67108863,H=Math.imul(y,q0),J=Math.imul(y,z0),J=J+Math.imul(h,q0)|0,O=Math.imul(h,z0),H=H+Math.imul(n,T0)|0,J=J+Math.imul(n,j0)|0,J=J+Math.imul(s,T0)|0,O=O+Math.imul(s,j0)|0,H=H+Math.imul(a,v0)|0,J=J+Math.imul(a,R0)|0,J=J+Math.imul(l,v0)|0,O=O+Math.imul(l,R0)|0,H=H+Math.imul(c,_0)|0,J=J+Math.imul(c,E0)|0,J=J+Math.imul(o,_0)|0,O=O+Math.imul(o,E0)|0,H=H+Math.imul(R,B0)|0,J=J+Math.imul(R,x0)|0,J=J+Math.imul(_,B0)|0,O=O+Math.imul(_,x0)|0;var r0=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(r0>>>26)|0,r0&=67108863,H=Math.imul(t,q0),J=Math.imul(t,z0),J=J+Math.imul(U0,q0)|0,O=Math.imul(U0,z0),H=H+Math.imul(y,T0)|0,J=J+Math.imul(y,j0)|0,J=J+Math.imul(h,T0)|0,O=O+Math.imul(h,j0)|0,H=H+Math.imul(n,v0)|0,J=J+Math.imul(n,R0)|0,J=J+Math.imul(s,v0)|0,O=O+Math.imul(s,R0)|0,H=H+Math.imul(a,_0)|0,J=J+Math.imul(a,E0)|0,J=J+Math.imul(l,_0)|0,O=O+Math.imul(l,E0)|0,H=H+Math.imul(c,B0)|0,J=J+Math.imul(c,x0)|0,J=J+Math.imul(o,B0)|0,O=O+Math.imul(o,x0)|0,H=H+Math.imul(R,S0)|0,J=J+Math.imul(R,g)|0,J=J+Math.imul(_,S0)|0,O=O+Math.imul(_,g)|0;var H1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(H1>>>26)|0,H1&=67108863,H=Math.imul(p,q0),J=Math.imul(p,z0),J=J+Math.imul(m,q0)|0,O=Math.imul(m,z0),H=H+Math.imul(t,T0)|0,J=J+Math.imul(t,j0)|0,J=J+Math.imul(U0,T0)|0,O=O+Math.imul(U0,j0)|0,H=H+Math.imul(y,v0)|0,J=J+Math.imul(y,R0)|0,J=J+Math.imul(h,v0)|0,O=O+Math.imul(h,R0)|0,H=H+Math.imul(n,_0)|0,J=J+Math.imul(n,E0)|0,J=J+Math.imul(s,_0)|0,O=O+Math.imul(s,E0)|0,H=H+Math.imul(a,B0)|0,J=J+Math.imul(a,x0)|0,J=J+Math.imul(l,B0)|0,O=O+Math.imul(l,x0)|0,H=H+Math.imul(c,S0)|0,J=J+Math.imul(c,g)|0,J=J+Math.imul(o,S0)|0,O=O+Math.imul(o,g)|0,H=H+Math.imul(R,e)|0,J=J+Math.imul(R,X0)|0,J=J+Math.imul(_,e)|0,O=O+Math.imul(_,X0)|0;var O1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(O1>>>26)|0,O1&=67108863,H=Math.imul(r,q0),J=Math.imul(r,z0),J=J+Math.imul(J0,q0)|0,O=Math.imul(J0,z0),H=H+Math.imul(p,T0)|0,J=J+Math.imul(p,j0)|0,J=J+Math.imul(m,T0)|0,O=O+Math.imul(m,j0)|0,H=H+Math.imul(t,v0)|0,J=J+Math.imul(t,R0)|0,J=J+Math.imul(U0,v0)|0,O=O+Math.imul(U0,R0)|0,H=H+Math.imul(y,_0)|0,J=J+Math.imul(y,E0)|0,J=J+Math.imul(h,_0)|0,O=O+Math.imul(h,E0)|0,H=H+Math.imul(n,B0)|0,J=J+Math.imul(n,x0)|0,J=J+Math.imul(s,B0)|0,O=O+Math.imul(s,x0)|0,H=H+Math.imul(a,S0)|0,J=J+Math.imul(a,g)|0,J=J+Math.imul(l,S0)|0,O=O+Math.imul(l,g)|0,H=H+Math.imul(c,e)|0,J=J+Math.imul(c,X0)|0,J=J+Math.imul(o,e)|0,O=O+Math.imul(o,X0)|0,H=H+Math.imul(R,F0)|0,J=J+Math.imul(R,A0)|0,J=J+Math.imul(_,F0)|0,O=O+Math.imul(_,A0)|0;var C1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(C1>>>26)|0,C1&=67108863,H=Math.imul(H0,q0),J=Math.imul(H0,z0),J=J+Math.imul(O0,q0)|0,O=Math.imul(O0,z0),H=H+Math.imul(r,T0)|0,J=J+Math.imul(r,j0)|0,J=J+Math.imul(J0,T0)|0,O=O+Math.imul(J0,j0)|0,H=H+Math.imul(p,v0)|0,J=J+Math.imul(p,R0)|0,J=J+Math.imul(m,v0)|0,O=O+Math.imul(m,R0)|0,H=H+Math.imul(t,_0)|0,J=J+Math.imul(t,E0)|0,J=J+Math.imul(U0,_0)|0,O=O+Math.imul(U0,E0)|0,H=H+Math.imul(y,B0)|0,J=J+Math.imul(y,x0)|0,J=J+Math.imul(h,B0)|0,O=O+Math.imul(h,x0)|0,H=H+Math.imul(n,S0)|0,J=J+Math.imul(n,g)|0,J=J+Math.imul(s,S0)|0,O=O+Math.imul(s,g)|0,H=H+Math.imul(a,e)|0,J=J+Math.imul(a,X0)|0,J=J+Math.imul(l,e)|0,O=O+Math.imul(l,X0)|0,H=H+Math.imul(c,F0)|0,J=J+Math.imul(c,A0)|0,J=J+Math.imul(o,F0)|0,O=O+Math.imul(o,A0)|0,H=H+Math.imul(R,P0)|0,J=J+Math.imul(R,N0)|0,J=J+Math.imul(_,P0)|0,O=O+Math.imul(_,N0)|0;var A1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(A1>>>26)|0,A1&=67108863,H=Math.imul(I0,q0),J=Math.imul(I0,z0),J=J+Math.imul(C0,q0)|0,O=Math.imul(C0,z0),H=H+Math.imul(H0,T0)|0,J=J+Math.imul(H0,j0)|0,J=J+Math.imul(O0,T0)|0,O=O+Math.imul(O0,j0)|0,H=H+Math.imul(r,v0)|0,J=J+Math.imul(r,R0)|0,J=J+Math.imul(J0,v0)|0,O=O+Math.imul(J0,R0)|0,H=H+Math.imul(p,_0)|0,J=J+Math.imul(p,E0)|0,J=J+Math.imul(m,_0)|0,O=O+Math.imul(m,E0)|0,H=H+Math.imul(t,B0)|0,J=J+Math.imul(t,x0)|0,J=J+Math.imul(U0,B0)|0,O=O+Math.imul(U0,x0)|0,H=H+Math.imul(y,S0)|0,J=J+Math.imul(y,g)|0,J=J+Math.imul(h,S0)|0,O=O+Math.imul(h,g)|0,H=H+Math.imul(n,e)|0,J=J+Math.imul(n,X0)|0,J=J+Math.imul(s,e)|0,O=O+Math.imul(s,X0)|0,H=H+Math.imul(a,F0)|0,J=J+Math.imul(a,A0)|0,J=J+Math.imul(l,F0)|0,O=O+Math.imul(l,A0)|0,H=H+Math.imul(c,P0)|0,J=J+Math.imul(c,N0)|0,J=J+Math.imul(o,P0)|0,O=O+Math.imul(o,N0)|0,H=H+Math.imul(R,k0)|0,J=J+Math.imul(R,M0)|0,J=J+Math.imul(_,k0)|0,O=O+Math.imul(_,M0)|0;var z1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(z1>>>26)|0,z1&=67108863,H=Math.imul(I0,T0),J=Math.imul(I0,j0),J=J+Math.imul(C0,T0)|0,O=Math.imul(C0,j0),H=H+Math.imul(H0,v0)|0,J=J+Math.imul(H0,R0)|0,J=J+Math.imul(O0,v0)|0,O=O+Math.imul(O0,R0)|0,H=H+Math.imul(r,_0)|0,J=J+Math.imul(r,E0)|0,J=J+Math.imul(J0,_0)|0,O=O+Math.imul(J0,E0)|0,H=H+Math.imul(p,B0)|0,J=J+Math.imul(p,x0)|0,J=J+Math.imul(m,B0)|0,O=O+Math.imul(m,x0)|0,H=H+Math.imul(t,S0)|0,J=J+Math.imul(t,g)|0,J=J+Math.imul(U0,S0)|0,O=O+Math.imul(U0,g)|0,H=H+Math.imul(y,e)|0,J=J+Math.imul(y,X0)|0,J=J+Math.imul(h,e)|0,O=O+Math.imul(h,X0)|0,H=H+Math.imul(n,F0)|0,J=J+Math.imul(n,A0)|0,J=J+Math.imul(s,F0)|0,O=O+Math.imul(s,A0)|0,H=H+Math.imul(a,P0)|0,J=J+Math.imul(a,N0)|0,J=J+Math.imul(l,P0)|0,O=O+Math.imul(l,N0)|0,H=H+Math.imul(c,k0)|0,J=J+Math.imul(c,M0)|0,J=J+Math.imul(o,k0)|0,O=O+Math.imul(o,M0)|0;var D1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(D1>>>26)|0,D1&=67108863,H=Math.imul(I0,v0),J=Math.imul(I0,R0),J=J+Math.imul(C0,v0)|0,O=Math.imul(C0,R0),H=H+Math.imul(H0,_0)|0,J=J+Math.imul(H0,E0)|0,J=J+Math.imul(O0,_0)|0,O=O+Math.imul(O0,E0)|0,H=H+Math.imul(r,B0)|0,J=J+Math.imul(r,x0)|0,J=J+Math.imul(J0,B0)|0,O=O+Math.imul(J0,x0)|0,H=H+Math.imul(p,S0)|0,J=J+Math.imul(p,g)|0,J=J+Math.imul(m,S0)|0,O=O+Math.imul(m,g)|0,H=H+Math.imul(t,e)|0,J=J+Math.imul(t,X0)|0,J=J+Math.imul(U0,e)|0,O=O+Math.imul(U0,X0)|0,H=H+Math.imul(y,F0)|0,J=J+Math.imul(y,A0)|0,J=J+Math.imul(h,F0)|0,O=O+Math.imul(h,A0)|0,H=H+Math.imul(n,P0)|0,J=J+Math.imul(n,N0)|0,J=J+Math.imul(s,P0)|0,O=O+Math.imul(s,N0)|0,H=H+Math.imul(a,k0)|0,J=J+Math.imul(a,M0)|0,J=J+Math.imul(l,k0)|0,O=O+Math.imul(l,M0)|0;var q1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(q1>>>26)|0,q1&=67108863,H=Math.imul(I0,_0),J=Math.imul(I0,E0),J=J+Math.imul(C0,_0)|0,O=Math.imul(C0,E0),H=H+Math.imul(H0,B0)|0,J=J+Math.imul(H0,x0)|0,J=J+Math.imul(O0,B0)|0,O=O+Math.imul(O0,x0)|0,H=H+Math.imul(r,S0)|0,J=J+Math.imul(r,g)|0,J=J+Math.imul(J0,S0)|0,O=O+Math.imul(J0,g)|0,H=H+Math.imul(p,e)|0,J=J+Math.imul(p,X0)|0,J=J+Math.imul(m,e)|0,O=O+Math.imul(m,X0)|0,H=H+Math.imul(t,F0)|0,J=J+Math.imul(t,A0)|0,J=J+Math.imul(U0,F0)|0,O=O+Math.imul(U0,A0)|0,H=H+Math.imul(y,P0)|0,J=J+Math.imul(y,N0)|0,J=J+Math.imul(h,P0)|0,O=O+Math.imul(h,N0)|0,H=H+Math.imul(n,k0)|0,J=J+Math.imul(n,M0)|0,J=J+Math.imul(s,k0)|0,O=O+Math.imul(s,M0)|0;var M1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(M1>>>26)|0,M1&=67108863,H=Math.imul(I0,B0),J=Math.imul(I0,x0),J=J+Math.imul(C0,B0)|0,O=Math.imul(C0,x0),H=H+Math.imul(H0,S0)|0,J=J+Math.imul(H0,g)|0,J=J+Math.imul(O0,S0)|0,O=O+Math.imul(O0,g)|0,H=H+Math.imul(r,e)|0,J=J+Math.imul(r,X0)|0,J=J+Math.imul(J0,e)|0,O=O+Math.imul(J0,X0)|0,H=H+Math.imul(p,F0)|0,J=J+Math.imul(p,A0)|0,J=J+Math.imul(m,F0)|0,O=O+Math.imul(m,A0)|0,H=H+Math.imul(t,P0)|0,J=J+Math.imul(t,N0)|0,J=J+Math.imul(U0,P0)|0,O=O+Math.imul(U0,N0)|0,H=H+Math.imul(y,k0)|0,J=J+Math.imul(y,M0)|0,J=J+Math.imul(h,k0)|0,O=O+Math.imul(h,M0)|0;var L1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(L1>>>26)|0,L1&=67108863,H=Math.imul(I0,S0),J=Math.imul(I0,g),J=J+Math.imul(C0,S0)|0,O=Math.imul(C0,g),H=H+Math.imul(H0,e)|0,J=J+Math.imul(H0,X0)|0,J=J+Math.imul(O0,e)|0,O=O+Math.imul(O0,X0)|0,H=H+Math.imul(r,F0)|0,J=J+Math.imul(r,A0)|0,J=J+Math.imul(J0,F0)|0,O=O+Math.imul(J0,A0)|0,H=H+Math.imul(p,P0)|0,J=J+Math.imul(p,N0)|0,J=J+Math.imul(m,P0)|0,O=O+Math.imul(m,N0)|0,H=H+Math.imul(t,k0)|0,J=J+Math.imul(t,M0)|0,J=J+Math.imul(U0,k0)|0,O=O+Math.imul(U0,M0)|0;var T1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(T1>>>26)|0,T1&=67108863,H=Math.imul(I0,e),J=Math.imul(I0,X0),J=J+Math.imul(C0,e)|0,O=Math.imul(C0,X0),H=H+Math.imul(H0,F0)|0,J=J+Math.imul(H0,A0)|0,J=J+Math.imul(O0,F0)|0,O=O+Math.imul(O0,A0)|0,H=H+Math.imul(r,P0)|0,J=J+Math.imul(r,N0)|0,J=J+Math.imul(J0,P0)|0,O=O+Math.imul(J0,N0)|0,H=H+Math.imul(p,k0)|0,J=J+Math.imul(p,M0)|0,J=J+Math.imul(m,k0)|0,O=O+Math.imul(m,M0)|0;var R1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(R1>>>26)|0,R1&=67108863,H=Math.imul(I0,F0),J=Math.imul(I0,A0),J=J+Math.imul(C0,F0)|0,O=Math.imul(C0,A0),H=H+Math.imul(H0,P0)|0,J=J+Math.imul(H0,N0)|0,J=J+Math.imul(O0,P0)|0,O=O+Math.imul(O0,N0)|0,H=H+Math.imul(r,k0)|0,J=J+Math.imul(r,M0)|0,J=J+Math.imul(J0,k0)|0,O=O+Math.imul(J0,M0)|0;var E1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(E1>>>26)|0,E1&=67108863,H=Math.imul(I0,P0),J=Math.imul(I0,N0),J=J+Math.imul(C0,P0)|0,O=Math.imul(C0,N0),H=H+Math.imul(H0,k0)|0,J=J+Math.imul(H0,M0)|0,J=J+Math.imul(O0,k0)|0,O=O+Math.imul(O0,M0)|0;var S1=(D+H|0)+((J&8191)<<13)|0;D=(O+(J>>>13)|0)+(S1>>>26)|0,S1&=67108863,H=Math.imul(I0,k0),J=Math.imul(I0,M0),J=J+Math.imul(C0,k0)|0,O=Math.imul(C0,M0);var P1=(D+H|0)+((J&8191)<<13)|0;if(D=(O+(J>>>13)|0)+(P1>>>26)|0,P1&=67108863,C[0]=G1,C[1]=l0,C[2]=b0,C[3]=t0,C[4]=r0,C[5]=H1,C[6]=O1,C[7]=C1,C[8]=A1,C[9]=z1,C[10]=D1,C[11]=q1,C[12]=M1,C[13]=L1,C[14]=T1,C[15]=R1,C[16]=E1,C[17]=S1,C[18]=P1,D!==0)C[19]=D,I.length++;return I};if(!Math.imul)k=j;function B(Y,V,I){I.negative=V.negative^Y.negative,I.length=Y.length+V.length;var G=0,W=0;for(var C=0;C<I.length-1;C++){var D=W;W=0;var H=G&67108863,J=Math.min(C,V.length-1);for(var O=Math.max(0,C-Y.length+1);O<=J;O++){var P=C-O,R=Y.words[P]|0,_=V.words[O]|0,f=R*_,c=f&67108863;D=D+(f/67108864|0)|0,c=c+H|0,H=c&67108863,D=D+(c>>>26)|0,W+=D>>>26,D&=67108863}I.words[C]=H,G=D,D=W}if(G!==0)I.words[C]=G;else I.length--;return I.strip()}function v(Y,V,I){var G=new x;return G.mulp(Y,V,I)}$.prototype.mulTo=function(Y,V){var I,G=this.length+Y.length;if(this.length===10&&Y.length===10)I=k(this,Y,V);else if(G<63)I=j(this,Y,V);else if(G<1024)I=B(this,Y,V);else I=v(this,Y,V);return I};function x(Y,V){this.x=Y,this.y=V}x.prototype.makeRBT=function(Y){var V=Array(Y),I=$.prototype._countBits(Y)-1;for(var G=0;G<Y;G++)V[G]=this.revBin(G,I,Y);return V},x.prototype.revBin=function(Y,V,I){if(Y===0||Y===I-1)return Y;var G=0;for(var W=0;W<V;W++)G|=(Y&1)<<V-W-1,Y>>=1;return G},x.prototype.permute=function(Y,V,I,G,W,C){for(var D=0;D<C;D++)G[D]=V[Y[D]],W[D]=I[Y[D]]},x.prototype.transform=function(Y,V,I,G,W,C){this.permute(C,Y,V,I,G,W);for(var D=1;D<W;D<<=1){var H=D<<1,J=Math.cos(2*Math.PI/H),O=Math.sin(2*Math.PI/H);for(var P=0;P<W;P+=H){var R=J,_=O;for(var f=0;f<D;f++){var c=I[P+f],o=G[P+f],K0=I[P+f+D],a=G[P+f+D],l=R*K0-_*a;if(a=R*a+_*K0,K0=l,I[P+f]=c+K0,G[P+f]=o+a,I[P+f+D]=c-K0,G[P+f+D]=o-a,f!==H)l=J*R-O*_,_=J*_+O*R,R=l}}}},x.prototype.guessLen13b=function(Y,V){var I=Math.max(V,Y)|1,G=I&1,W=0;for(I=I/2|0;I;I=I>>>1)W++;return 1<<W+1+G},x.prototype.conjugate=function(Y,V,I){if(I<=1)return;for(var G=0;G<I/2;G++){var W=Y[G];Y[G]=Y[I-G-1],Y[I-G-1]=W,W=V[G],V[G]=-V[I-G-1],V[I-G-1]=-W}},x.prototype.normalize13b=function(Y,V){var I=0;for(var G=0;G<V/2;G++){var W=Math.round(Y[2*G+1]/V)*8192+Math.round(Y[2*G]/V)+I;if(Y[G]=W&67108863,W<67108864)I=0;else I=W/67108864|0}return Y},x.prototype.convert13b=function(Y,V,I,G){var W=0;for(var C=0;C<V;C++)W=W+(Y[C]|0),I[2*C]=W&8191,W=W>>>13,I[2*C+1]=W&8191,W=W>>>13;for(C=2*V;C<G;++C)I[C]=0;K(W===0),K((W&-8192)===0)},x.prototype.stub=function(Y){var V=Array(Y);for(var I=0;I<Y;I++)V[I]=0;return V},x.prototype.mulp=function(Y,V,I){var G=2*this.guessLen13b(Y.length,V.length),W=this.makeRBT(G),C=this.stub(G),D=Array(G),H=Array(G),J=Array(G),O=Array(G),P=Array(G),R=Array(G),_=I.words;_.length=G,this.convert13b(Y.words,Y.length,D,G),this.convert13b(V.words,V.length,O,G),this.transform(D,C,H,J,G,W),this.transform(O,C,P,R,G,W);for(var f=0;f<G;f++){var c=H[f]*P[f]-J[f]*R[f];J[f]=H[f]*R[f]+J[f]*P[f],H[f]=c}return this.conjugate(H,J,G),this.transform(H,J,_,C,G,W),this.conjugate(_,C,G),this.normalize13b(_,G),I.negative=Y.negative^V.negative,I.length=Y.length+V.length,I.strip()},$.prototype.mul=function(Y){var V=new $(null);return V.words=Array(this.length+Y.length),this.mulTo(Y,V)},$.prototype.mulf=function(Y){var V=new $(null);return V.words=Array(this.length+Y.length),v(this,Y,V)},$.prototype.imul=function(Y){return this.clone().mulTo(Y,this)},$.prototype.imuln=function(Y){K(typeof Y==="number"),K(Y<67108864);var V=0;for(var I=0;I<this.length;I++){var G=(this.words[I]|0)*Y,W=(G&67108863)+(V&67108863);V>>=26,V+=G/67108864|0,V+=W>>>26,this.words[I]=W&67108863}if(V!==0)this.words[I]=V,this.length++;return this.length=Y===0?1:this.length,this},$.prototype.muln=function(Y){return this.clone().imuln(Y)},$.prototype.sqr=function(){return this.mul(this)},$.prototype.isqr=function(){return this.imul(this.clone())},$.prototype.pow=function(Y){var V=S(Y);if(V.length===0)return new $(1);var I=this;for(var G=0;G<V.length;G++,I=I.sqr())if(V[G]!==0)break;if(++G<V.length)for(var W=I.sqr();G<V.length;G++,W=W.sqr()){if(V[G]===0)continue;I=I.mul(W)}return I},$.prototype.iushln=function(Y){K(typeof Y==="number"&&Y>=0);var V=Y%26,I=(Y-V)/26,G=67108863>>>26-V<<26-V,W;if(V!==0){var C=0;for(W=0;W<this.length;W++){var D=this.words[W]&G,H=(this.words[W]|0)-D<<V;this.words[W]=H|C,C=D>>>26-V}if(C)this.words[W]=C,this.length++}if(I!==0){for(W=this.length-1;W>=0;W--)this.words[W+I]=this.words[W];for(W=0;W<I;W++)this.words[W]=0;this.length+=I}return this.strip()},$.prototype.ishln=function(Y){return K(this.negative===0),this.iushln(Y)},$.prototype.iushrn=function(Y,V,I){K(typeof Y==="number"&&Y>=0);var G;if(V)G=(V-V%26)/26;else G=0;var W=Y%26,C=Math.min((Y-W)/26,this.length),D=67108863^67108863>>>W<<W,H=I;if(G-=C,G=Math.max(0,G),H){for(var J=0;J<C;J++)H.words[J]=this.words[J];H.length=C}if(C===0);else if(this.length>C){this.length-=C;for(J=0;J<this.length;J++)this.words[J]=this.words[J+C]}else this.words[0]=0,this.length=1;var O=0;for(J=this.length-1;J>=0&&(O!==0||J>=G);J--){var P=this.words[J]|0;this.words[J]=O<<26-W|P>>>W,O=P&D}if(H&&O!==0)H.words[H.length++]=O;if(this.length===0)this.words[0]=0,this.length=1;return this.strip()},$.prototype.ishrn=function(Y,V,I){return K(this.negative===0),this.iushrn(Y,V,I)},$.prototype.shln=function(Y){return this.clone().ishln(Y)},$.prototype.ushln=function(Y){return this.clone().iushln(Y)},$.prototype.shrn=function(Y){return this.clone().ishrn(Y)},$.prototype.ushrn=function(Y){return this.clone().iushrn(Y)},$.prototype.testn=function(Y){K(typeof Y==="number"&&Y>=0);var V=Y%26,I=(Y-V)/26,G=1<<V;if(this.length<=I)return!1;var W=this.words[I];return!!(W&G)},$.prototype.imaskn=function(Y){K(typeof Y==="number"&&Y>=0);var V=Y%26,I=(Y-V)/26;if(K(this.negative===0,"imaskn works only with positive numbers"),this.length<=I)return this;if(V!==0)I++;if(this.length=Math.min(I,this.length),V!==0){var G=67108863^67108863>>>V<<V;this.words[this.length-1]&=G}return this.strip()},$.prototype.maskn=function(Y){return this.clone().imaskn(Y)},$.prototype.iaddn=function(Y){if(K(typeof Y==="number"),K(Y<67108864),Y<0)return this.isubn(-Y);if(this.negative!==0){if(this.length===1&&(this.words[0]|0)<Y)return this.words[0]=Y-(this.words[0]|0),this.negative=0,this;return this.negative=0,this.isubn(Y),this.negative=1,this}return this._iaddn(Y)},$.prototype._iaddn=function(Y){this.words[0]+=Y;for(var V=0;V<this.length&&this.words[V]>=67108864;V++)if(this.words[V]-=67108864,V===this.length-1)this.words[V+1]=1;else this.words[V+1]++;return this.length=Math.max(this.length,V+1),this},$.prototype.isubn=function(Y){if(K(typeof Y==="number"),K(Y<67108864),Y<0)return this.iaddn(-Y);if(this.negative!==0)return this.negative=0,this.iaddn(Y),this.negative=1,this;if(this.words[0]-=Y,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var V=0;V<this.length&&this.words[V]<0;V++)this.words[V]+=67108864,this.words[V+1]-=1;return this.strip()},$.prototype.addn=function(Y){return this.clone().iaddn(Y)},$.prototype.subn=function(Y){return this.clone().isubn(Y)},$.prototype.iabs=function(){return this.negative=0,this},$.prototype.abs=function(){return this.clone().iabs()},$.prototype._ishlnsubmul=function(Y,V,I){var G=Y.length+I,W;this._expand(G);var C,D=0;for(W=0;W<Y.length;W++){C=(this.words[W+I]|0)+D;var H=(Y.words[W]|0)*V;C-=H&67108863,D=(C>>26)-(H/67108864|0),this.words[W+I]=C&67108863}for(;W<this.length-I;W++)C=(this.words[W+I]|0)+D,D=C>>26,this.words[W+I]=C&67108863;if(D===0)return this.strip();K(D===-1),D=0;for(W=0;W<this.length;W++)C=-(this.words[W]|0)+D,D=C>>26,this.words[W]=C&67108863;return this.negative=1,this.strip()},$.prototype._wordDiv=function(Y,V){var I=this.length-Y.length,G=this.clone(),W=Y,C=W.words[W.length-1]|0,D=this._countBits(C);if(I=26-D,I!==0)W=W.ushln(I),G.iushln(I),C=W.words[W.length-1]|0;var H=G.length-W.length,J;if(V!=="mod"){J=new $(null),J.length=H+1,J.words=Array(J.length);for(var O=0;O<J.length;O++)J.words[O]=0}var P=G.clone()._ishlnsubmul(W,1,H);if(P.negative===0){if(G=P,J)J.words[H]=1}for(var R=H-1;R>=0;R--){var _=(G.words[W.length+R]|0)*67108864+(G.words[W.length+R-1]|0);_=Math.min(_/C|0,67108863),G._ishlnsubmul(W,_,R);while(G.negative!==0)if(_--,G.negative=0,G._ishlnsubmul(W,1,R),!G.isZero())G.negative^=1;if(J)J.words[R]=_}if(J)J.strip();if(G.strip(),V!=="div"&&I!==0)G.iushrn(I);return{div:J||null,mod:G}},$.prototype.divmod=function(Y,V,I){if(K(!Y.isZero()),this.isZero())return{div:new $(0),mod:new $(0)};var G,W,C;if(this.negative!==0&&Y.negative===0){if(C=this.neg().divmod(Y,V),V!=="mod")G=C.div.neg();if(V!=="div"){if(W=C.mod.neg(),I&&W.negative!==0)W.iadd(Y)}return{div:G,mod:W}}if(this.negative===0&&Y.negative!==0){if(C=this.divmod(Y.neg(),V),V!=="mod")G=C.div.neg();return{div:G,mod:C.mod}}if((this.negative&Y.negative)!==0){if(C=this.neg().divmod(Y.neg(),V),V!=="div"){if(W=C.mod.neg(),I&&W.negative!==0)W.isub(Y)}return{div:C.div,mod:W}}if(Y.length>this.length||this.cmp(Y)<0)return{div:new $(0),mod:this};if(Y.length===1){if(V==="div")return{div:this.divn(Y.words[0]),mod:null};if(V==="mod")return{div:null,mod:new $(this.modn(Y.words[0]))};return{div:this.divn(Y.words[0]),mod:new $(this.modn(Y.words[0]))}}return this._wordDiv(Y,V)},$.prototype.div=function(Y){return this.divmod(Y,"div",!1).div},$.prototype.mod=function(Y){return this.divmod(Y,"mod",!1).mod},$.prototype.umod=function(Y){return this.divmod(Y,"mod",!0).mod},$.prototype.divRound=function(Y){var V=this.divmod(Y);if(V.mod.isZero())return V.div;var I=V.div.negative!==0?V.mod.isub(Y):V.mod,G=Y.ushrn(1),W=Y.andln(1),C=I.cmp(G);if(C<0||W===1&&C===0)return V.div;return V.div.negative!==0?V.div.isubn(1):V.div.iaddn(1)},$.prototype.modn=function(Y){K(Y<=67108863);var V=67108864%Y,I=0;for(var G=this.length-1;G>=0;G--)I=(V*I+(this.words[G]|0))%Y;return I},$.prototype.idivn=function(Y){K(Y<=67108863);var V=0;for(var I=this.length-1;I>=0;I--){var G=(this.words[I]|0)+V*67108864;this.words[I]=G/Y|0,V=G%Y}return this.strip()},$.prototype.divn=function(Y){return this.clone().idivn(Y)},$.prototype.egcd=function(Y){K(Y.negative===0),K(!Y.isZero());var V=this,I=Y.clone();if(V.negative!==0)V=V.umod(Y);else V=V.clone();var G=new $(1),W=new $(0),C=new $(0),D=new $(1),H=0;while(V.isEven()&&I.isEven())V.iushrn(1),I.iushrn(1),++H;var J=I.clone(),O=V.clone();while(!V.isZero()){for(var P=0,R=1;(V.words[0]&R)===0&&P<26;++P,R<<=1);if(P>0){V.iushrn(P);while(P-- >0){if(G.isOdd()||W.isOdd())G.iadd(J),W.isub(O);G.iushrn(1),W.iushrn(1)}}for(var _=0,f=1;(I.words[0]&f)===0&&_<26;++_,f<<=1);if(_>0){I.iushrn(_);while(_-- >0){if(C.isOdd()||D.isOdd())C.iadd(J),D.isub(O);C.iushrn(1),D.iushrn(1)}}if(V.cmp(I)>=0)V.isub(I),G.isub(C),W.isub(D);else I.isub(V),C.isub(G),D.isub(W)}return{a:C,b:D,gcd:I.iushln(H)}},$.prototype._invmp=function(Y){K(Y.negative===0),K(!Y.isZero());var V=this,I=Y.clone();if(V.negative!==0)V=V.umod(Y);else V=V.clone();var G=new $(1),W=new $(0),C=I.clone();while(V.cmpn(1)>0&&I.cmpn(1)>0){for(var D=0,H=1;(V.words[0]&H)===0&&D<26;++D,H<<=1);if(D>0){V.iushrn(D);while(D-- >0){if(G.isOdd())G.iadd(C);G.iushrn(1)}}for(var J=0,O=1;(I.words[0]&O)===0&&J<26;++J,O<<=1);if(J>0){I.iushrn(J);while(J-- >0){if(W.isOdd())W.iadd(C);W.iushrn(1)}}if(V.cmp(I)>=0)V.isub(I),G.isub(W);else I.isub(V),W.isub(G)}var P;if(V.cmpn(1)===0)P=G;else P=W;if(P.cmpn(0)<0)P.iadd(Y);return P},$.prototype.gcd=function(Y){if(this.isZero())return Y.abs();if(Y.isZero())return this.abs();var V=this.clone(),I=Y.clone();V.negative=0,I.negative=0;for(var G=0;V.isEven()&&I.isEven();G++)V.iushrn(1),I.iushrn(1);do{while(V.isEven())V.iushrn(1);while(I.isEven())I.iushrn(1);var W=V.cmp(I);if(W<0){var C=V;V=I,I=C}else if(W===0||I.cmpn(1)===0)break;V.isub(I)}while(!0);return I.iushln(G)},$.prototype.invm=function(Y){return this.egcd(Y).a.umod(Y)},$.prototype.isEven=function(){return(this.words[0]&1)===0},$.prototype.isOdd=function(){return(this.words[0]&1)===1},$.prototype.andln=function(Y){return this.words[0]&Y},$.prototype.bincn=function(Y){K(typeof Y==="number");var V=Y%26,I=(Y-V)/26,G=1<<V;if(this.length<=I)return this._expand(I+1),this.words[I]|=G,this;var W=G;for(var C=I;W!==0&&C<this.length;C++){var D=this.words[C]|0;D+=W,W=D>>>26,D&=67108863,this.words[C]=D}if(W!==0)this.words[C]=W,this.length++;return this},$.prototype.isZero=function(){return this.length===1&&this.words[0]===0},$.prototype.cmpn=function(Y){var V=Y<0;if(this.negative!==0&&!V)return-1;if(this.negative===0&&V)return 1;this.strip();var I;if(this.length>1)I=1;else{if(V)Y=-Y;K(Y<=67108863,"Number is too big");var G=this.words[0]|0;I=G===Y?0:G<Y?-1:1}if(this.negative!==0)return-I|0;return I},$.prototype.cmp=function(Y){if(this.negative!==0&&Y.negative===0)return-1;if(this.negative===0&&Y.negative!==0)return 1;var V=this.ucmp(Y);if(this.negative!==0)return-V|0;return V},$.prototype.ucmp=function(Y){if(this.length>Y.length)return 1;if(this.length<Y.length)return-1;var V=0;for(var I=this.length-1;I>=0;I--){var G=this.words[I]|0,W=Y.words[I]|0;if(G===W)continue;if(G<W)V=-1;else if(G>W)V=1;break}return V},$.prototype.gtn=function(Y){return this.cmpn(Y)===1},$.prototype.gt=function(Y){return this.cmp(Y)===1},$.prototype.gten=function(Y){return this.cmpn(Y)>=0},$.prototype.gte=function(Y){return this.cmp(Y)>=0},$.prototype.ltn=function(Y){return this.cmpn(Y)===-1},$.prototype.lt=function(Y){return this.cmp(Y)===-1},$.prototype.lten=function(Y){return this.cmpn(Y)<=0},$.prototype.lte=function(Y){return this.cmp(Y)<=0},$.prototype.eqn=function(Y){return this.cmpn(Y)===0},$.prototype.eq=function(Y){return this.cmp(Y)===0},$.red=function(Y){return new b(Y)},$.prototype.toRed=function(Y){return K(!this.red,"Already a number in reduction context"),K(this.negative===0,"red works only with positives"),Y.convertTo(this)._forceRed(Y)},$.prototype.fromRed=function(){return K(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},$.prototype._forceRed=function(Y){return this.red=Y,this},$.prototype.forceRed=function(Y){return K(!this.red,"Already a number in reduction context"),this._forceRed(Y)},$.prototype.redAdd=function(Y){return K(this.red,"redAdd works only with red numbers"),this.red.add(this,Y)},$.prototype.redIAdd=function(Y){return K(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,Y)},$.prototype.redSub=function(Y){return K(this.red,"redSub works only with red numbers"),this.red.sub(this,Y)},$.prototype.redISub=function(Y){return K(this.red,"redISub works only with red numbers"),this.red.isub(this,Y)},$.prototype.redShl=function(Y){return K(this.red,"redShl works only with red numbers"),this.red.shl(this,Y)},$.prototype.redMul=function(Y){return K(this.red,"redMul works only with red numbers"),this.red._verify2(this,Y),this.red.mul(this,Y)},$.prototype.redIMul=function(Y){return K(this.red,"redMul works only with red numbers"),this.red._verify2(this,Y),this.red.imul(this,Y)},$.prototype.redSqr=function(){return K(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},$.prototype.redISqr=function(){return K(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},$.prototype.redSqrt=function(){return K(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},$.prototype.redInvm=function(){return K(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},$.prototype.redNeg=function(){return K(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},$.prototype.redPow=function(Y){return K(this.red&&!Y.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,Y)};var N={k256:null,p224:null,p192:null,p25519:null};function w(Y,V){this.name=Y,this.p=new $(V,16),this.n=this.p.bitLength(),this.k=new $(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}w.prototype._tmp=function(){var Y=new $(null);return Y.words=Array(Math.ceil(this.n/13)),Y},w.prototype.ireduce=function(Y){var V=Y,I;do this.split(V,this.tmp),V=this.imulK(V),V=V.iadd(this.tmp),I=V.bitLength();while(I>this.n);var G=I<this.n?-1:V.ucmp(this.p);if(G===0)V.words[0]=0,V.length=1;else if(G>0)V.isub(this.p);else if(V.strip!==void 0)V.strip();else V._strip();return V},w.prototype.split=function(Y,V){Y.iushrn(this.n,0,V)},w.prototype.imulK=function(Y){return Y.imul(this.k)};function u(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}F(u,w),u.prototype.split=function(Y,V){var I=4194303,G=Math.min(Y.length,9);for(var W=0;W<G;W++)V.words[W]=Y.words[W];if(V.length=G,Y.length<=9){Y.words[0]=0,Y.length=1;return}var C=Y.words[9];V.words[V.length++]=C&I;for(W=10;W<Y.length;W++){var D=Y.words[W]|0;Y.words[W-10]=(D&I)<<4|C>>>22,C=D}if(C>>>=22,Y.words[W-10]=C,C===0&&Y.length>10)Y.length-=10;else Y.length-=9},u.prototype.imulK=function(Y){Y.words[Y.length]=0,Y.words[Y.length+1]=0,Y.length+=2;var V=0;for(var I=0;I<Y.length;I++){var G=Y.words[I]|0;V+=G*977,Y.words[I]=V&67108863,V=G*64+(V/67108864|0)}if(Y.words[Y.length-1]===0){if(Y.length--,Y.words[Y.length-1]===0)Y.length--}return Y};function Z0(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}F(Z0,w);function V0(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}F(V0,w);function Y0(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}F(Y0,w),Y0.prototype.imulK=function(Y){var V=0;for(var I=0;I<Y.length;I++){var G=(Y.words[I]|0)*19+V,W=G&67108863;G>>>=26,Y.words[I]=W,V=G}if(V!==0)Y.words[Y.length++]=V;return Y},$._prime=function(Y){if(N[Y])return N[Y];var V;if(Y==="k256")V=new u;else if(Y==="p224")V=new Z0;else if(Y==="p192")V=new V0;else if(Y==="p25519")V=new Y0;else throw Error("Unknown prime "+Y);return N[Y]=V,V};function b(Y){if(typeof Y==="string"){var V=$._prime(Y);this.m=V.p,this.prime=V}else K(Y.gtn(1),"modulus must be greater than 1"),this.m=Y,this.prime=null}b.prototype._verify1=function(Y){K(Y.negative===0,"red works only with positives"),K(Y.red,"red works only with red numbers")},b.prototype._verify2=function(Y,V){K((Y.negative|V.negative)===0,"red works only with positives"),K(Y.red&&Y.red===V.red,"red works only with red numbers")},b.prototype.imod=function(Y){if(this.prime)return this.prime.ireduce(Y)._forceRed(this);return Y.umod(this.m)._forceRed(this)},b.prototype.neg=function(Y){if(Y.isZero())return Y.clone();return this.m.sub(Y)._forceRed(this)},b.prototype.add=function(Y,V){this._verify2(Y,V);var I=Y.add(V);if(I.cmp(this.m)>=0)I.isub(this.m);return I._forceRed(this)},b.prototype.iadd=function(Y,V){this._verify2(Y,V);var I=Y.iadd(V);if(I.cmp(this.m)>=0)I.isub(this.m);return I},b.prototype.sub=function(Y,V){this._verify2(Y,V);var I=Y.sub(V);if(I.cmpn(0)<0)I.iadd(this.m);return I._forceRed(this)},b.prototype.isub=function(Y,V){this._verify2(Y,V);var I=Y.isub(V);if(I.cmpn(0)<0)I.iadd(this.m);return I},b.prototype.shl=function(Y,V){return this._verify1(Y),this.imod(Y.ushln(V))},b.prototype.imul=function(Y,V){return this._verify2(Y,V),this.imod(Y.imul(V))},b.prototype.mul=function(Y,V){return this._verify2(Y,V),this.imod(Y.mul(V))},b.prototype.isqr=function(Y){return this.imul(Y,Y.clone())},b.prototype.sqr=function(Y){return this.mul(Y,Y)},b.prototype.sqrt=function(Y){if(Y.isZero())return Y.clone();var V=this.m.andln(3);if(K(V%2===1),V===3){var I=this.m.add(new $(1)).iushrn(2);return this.pow(Y,I)}var G=this.m.subn(1),W=0;while(!G.isZero()&&G.andln(1)===0)W++,G.iushrn(1);K(!G.isZero());var C=new $(1).toRed(this),D=C.redNeg(),H=this.m.subn(1).iushrn(1),J=this.m.bitLength();J=new $(2*J*J).toRed(this);while(this.pow(J,H).cmp(D)!==0)J.redIAdd(D);var O=this.pow(J,G),P=this.pow(Y,G.addn(1).iushrn(1)),R=this.pow(Y,G),_=W;while(R.cmp(C)!==0){var f=R;for(var c=0;f.cmp(C)!==0;c++)f=f.redSqr();K(c<_);var o=this.pow(O,new $(1).iushln(_-c-1));P=P.redMul(o),O=o.redSqr(),R=R.redMul(O),_=c}return P},b.prototype.invm=function(Y){var V=Y._invmp(this.m);if(V.negative!==0)return V.negative=0,this.imod(V).redNeg();else return this.imod(V)},b.prototype.pow=function(Y,V){if(V.isZero())return new $(1).toRed(this);if(V.cmpn(1)===0)return Y.clone();var I=4,G=Array(1<<I);G[0]=new $(1).toRed(this),G[1]=Y;for(var W=2;W<G.length;W++)G[W]=this.mul(G[W-1],Y);var C=G[0],D=0,H=0,J=V.bitLength()%26;if(J===0)J=26;for(W=V.length-1;W>=0;W--){var O=V.words[W];for(var P=J-1;P>=0;P--){var R=O>>P&1;if(C!==G[0])C=this.sqr(C);if(R===0&&D===0){H=0;continue}if(D<<=1,D|=R,H++,H!==I&&(W!==0||P!==0))continue;C=this.mul(C,G[D]),H=0,D=0}J=26}return C},b.prototype.convertTo=function(Y){var V=Y.umod(this.m);return V===Y?V.clone():V},b.prototype.convertFrom=function(Y){var V=Y.clone();return V.red=null,V},$.mont=function(Y){return new i(Y)};function i(Y){if(b.call(this,Y),this.shift=this.m.bitLength(),this.shift%26!==0)this.shift+=26-this.shift%26;this.r=new $(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}F(i,b),i.prototype.convertTo=function(Y){return this.imod(Y.ushln(this.shift))},i.prototype.convertFrom=function(Y){var V=this.imod(Y.mul(this.rinv));return V.red=null,V},i.prototype.imul=function(Y,V){if(Y.isZero()||V.isZero())return Y.words[0]=0,Y.length=1,Y;var I=Y.imul(V),G=I.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),W=I.isub(G).iushrn(this.shift),C=W;if(W.cmp(this.m)>=0)C=W.isub(this.m);else if(W.cmpn(0)<0)C=W.iadd(this.m);return C._forceRed(this)},i.prototype.mul=function(Y,V){if(Y.isZero()||V.isZero())return new $(0)._forceRed(this);var I=Y.mul(V),G=I.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),W=I.isub(G).iushrn(this.shift),C=W;if(W.cmp(this.m)>=0)C=W.isub(this.m);else if(W.cmpn(0)<0)C=W.iadd(this.m);return C._forceRed(this)},i.prototype.invm=function(Y){var V=this.imod(Y._invmp(this.m).mul(this.r2));return V._forceRed(this)}})(typeof Z>"u"||Z,U)}),HV=$0((U,Z)=>{var X=YJ(),Q=m1().Buffer;function K(F,$){return Q.from(F.toRed(X.mont($.modulus)).redPow(new X($.publicExponent)).fromRed().toArray())}Z.exports=K}),UH=$0((U,Z)=>{(function(X,Q){function K(G,W){if(!G)throw Error(W||"Assertion failed")}function F(G,W){G.super_=W;var C=function(){};C.prototype=W.prototype,G.prototype=new C,G.prototype.constructor=G}function $(G,W,C){if($.isBN(G))return G;if(this.negative=0,this.words=null,this.length=0,this.red=null,G!==null){if(W==="le"||W==="be")C=W,W=10;this._init(G||0,W||10,C||"be")}}if(typeof X==="object")X.exports=$;else Q.BN=$;$.BN=$,$.wordSize=26;var q;try{if(typeof window<"u"&&typeof window.Buffer<"u")q=window.Buffer;else q=(g1(),m0(N1)).Buffer}catch(G){}$.isBN=function(G){if(G instanceof $)return!0;return G!==null&&typeof G==="object"&&G.constructor.wordSize===$.wordSize&&Array.isArray(G.words)},$.max=function(G,W){if(G.cmp(W)>0)return G;return W},$.min=function(G,W){if(G.cmp(W)<0)return G;return W},$.prototype._init=function(G,W,C){if(typeof G==="number")return this._initNumber(G,W,C);if(typeof G==="object")return this._initArray(G,W,C);if(W==="hex")W=16;K(W===(W|0)&&W>=2&&W<=36),G=G.toString().replace(/\s+/g,"");var D=0;if(G[0]==="-")D++,this.negative=1;if(D<G.length){if(W===16)this._parseHex(G,D,C);else if(this._parseBase(G,W,D),C==="le")this._initArray(this.toArray(),W,C)}},$.prototype._initNumber=function(G,W,C){if(G<0)this.negative=1,G=-G;if(G<67108864)this.words=[G&67108863],this.length=1;else if(G<4503599627370496)this.words=[G&67108863,G/67108864&67108863],this.length=2;else K(G<9007199254740992),this.words=[G&67108863,G/67108864&67108863,1],this.length=3;if(C!=="le")return;this._initArray(this.toArray(),W,C)},$.prototype._initArray=function(G,W,C){if(K(typeof G.length==="number"),G.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(G.length/3),this.words=Array(this.length);for(var D=0;D<this.length;D++)this.words[D]=0;var H,J,O=0;if(C==="be"){for(D=G.length-1,H=0;D>=0;D-=3)if(J=G[D]|G[D-1]<<8|G[D-2]<<16,this.words[H]|=J<<O&67108863,this.words[H+1]=J>>>26-O&67108863,O+=24,O>=26)O-=26,H++}else if(C==="le"){for(D=0,H=0;D<G.length;D+=3)if(J=G[D]|G[D+1]<<8|G[D+2]<<16,this.words[H]|=J<<O&67108863,this.words[H+1]=J>>>26-O&67108863,O+=24,O>=26)O-=26,H++}return this._strip()};function M(G,W){var C=G.charCodeAt(W);if(C>=48&&C<=57)return C-48;else if(C>=65&&C<=70)return C-55;else if(C>=97&&C<=102)return C-87;else K(!1,"Invalid character in "+G)}function z(G,W,C){var D=M(G,C);if(C-1>=W)D|=M(G,C-1)<<4;return D}$.prototype._parseHex=function(G,W,C){this.length=Math.ceil((G.length-W)/6),this.words=Array(this.length);for(var D=0;D<this.length;D++)this.words[D]=0;var H=0,J=0,O;if(C==="be")for(D=G.length-1;D>=W;D-=2)if(O=z(G,W,D)<<H,this.words[J]|=O&67108863,H>=18)H-=18,J+=1,this.words[J]|=O>>>26;else H+=8;else{var P=G.length-W;for(D=P%2===0?W+1:W;D<G.length;D+=2)if(O=z(G,W,D)<<H,this.words[J]|=O&67108863,H>=18)H-=18,J+=1,this.words[J]|=O>>>26;else H+=8}this._strip()};function T(G,W,C,D){var H=0,J=0,O=Math.min(G.length,C);for(var P=W;P<O;P++){var R=G.charCodeAt(P)-48;if(H*=D,R>=49)J=R-49+10;else if(R>=17)J=R-17+10;else J=R;K(R>=0&&J<D,"Invalid character"),H+=J}return H}$.prototype._parseBase=function(G,W,C){this.words=[0],this.length=1;for(var D=0,H=1;H<=67108863;H*=W)D++;D--,H=H/W|0;var J=G.length-C,O=J%D,P=Math.min(J,J-O)+C,R=0;for(var _=C;_<P;_+=D)if(R=T(G,_,_+D,W),this.imuln(H),this.words[0]+R<67108864)this.words[0]+=R;else this._iaddn(R);if(O!==0){var f=1;R=T(G,_,G.length,W);for(_=0;_<O;_++)f*=W;if(this.imuln(f),this.words[0]+R<67108864)this.words[0]+=R;else this._iaddn(R)}this._strip()},$.prototype.copy=function(G){G.words=Array(this.length);for(var W=0;W<this.length;W++)G.words[W]=this.words[W];G.length=this.length,G.negative=this.negative,G.red=this.red};function A(G,W){G.words=W.words,G.length=W.length,G.negative=W.negative,G.red=W.red}if($.prototype._move=function(G){A(G,this)},$.prototype.clone=function(){var G=new $(null);return this.copy(G),G},$.prototype._expand=function(G){while(this.length<G)this.words[this.length++]=0;return this},$.prototype._strip=function(){while(this.length>1&&this.words[this.length-1]===0)this.length--;return this._normSign()},$.prototype._normSign=function(){if(this.length===1&&this.words[0]===0)this.negative=0;return this},typeof Symbol<"u"&&typeof Symbol.for==="function")try{$.prototype[Symbol.for("nodejs.util.inspect.custom")]=L}catch(G){$.prototype.inspect=L}else $.prototype.inspect=L;function L(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var E=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],S=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],j=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64000000,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,24300000,28629151,33554432,39135393,45435424,52521875,60466176];if($.prototype.toString=function(G,W){G=G||10,W=W|0||1;var C;if(G===16||G==="hex"){C="";var D=0,H=0;for(var J=0;J<this.length;J++){var O=this.words[J],P=((O<<D|H)&16777215).toString(16);if(H=O>>>24-D&16777215,D+=2,D>=26)D-=26,J--;if(H!==0||J!==this.length-1)C=E[6-P.length]+P+C;else C=P+C}if(H!==0)C=H.toString(16)+C;while(C.length%W!==0)C="0"+C;if(this.negative!==0)C="-"+C;return C}if(G===(G|0)&&G>=2&&G<=36){var R=S[G],_=j[G];C="";var f=this.clone();f.negative=0;while(!f.isZero()){var c=f.modrn(_).toString(G);if(f=f.idivn(_),!f.isZero())C=E[R-c.length]+c+C;else C=c+C}if(this.isZero())C="0"+C;while(C.length%W!==0)C="0"+C;if(this.negative!==0)C="-"+C;return C}K(!1,"Base should be between 2 and 36")},$.prototype.toNumber=function(){var G=this.words[0];if(this.length===2)G+=this.words[1]*67108864;else if(this.length===3&&this.words[2]===1)G+=4503599627370496+this.words[1]*67108864;else if(this.length>2)K(!1,"Number can only safely store up to 53 bits");return this.negative!==0?-G:G},$.prototype.toJSON=function(){return this.toString(16,2)},q)$.prototype.toBuffer=function(G,W){return this.toArrayLike(q,G,W)};$.prototype.toArray=function(G,W){return this.toArrayLike(Array,G,W)};var k=function(G,W){if(G.allocUnsafe)return G.allocUnsafe(W);return new G(W)};if($.prototype.toArrayLike=function(G,W,C){this._strip();var D=this.byteLength(),H=C||Math.max(1,D);K(D<=H,"byte array longer than desired length"),K(H>0,"Requested array length <= 0");var J=k(G,H),O=W==="le"?"LE":"BE";return this["_toArrayLike"+O](J,D),J},$.prototype._toArrayLikeLE=function(G,W){var C=0,D=0;for(var H=0,J=0;H<this.length;H++){var O=this.words[H]<<J|D;if(G[C++]=O&255,C<G.length)G[C++]=O>>8&255;if(C<G.length)G[C++]=O>>16&255;if(J===6){if(C<G.length)G[C++]=O>>24&255;D=0,J=0}else D=O>>>24,J+=2}if(C<G.length){G[C++]=D;while(C<G.length)G[C++]=0}},$.prototype._toArrayLikeBE=function(G,W){var C=G.length-1,D=0;for(var H=0,J=0;H<this.length;H++){var O=this.words[H]<<J|D;if(G[C--]=O&255,C>=0)G[C--]=O>>8&255;if(C>=0)G[C--]=O>>16&255;if(J===6){if(C>=0)G[C--]=O>>24&255;D=0,J=0}else D=O>>>24,J+=2}if(C>=0){G[C--]=D;while(C>=0)G[C--]=0}},Math.clz32)$.prototype._countBits=function(G){return 32-Math.clz32(G)};else $.prototype._countBits=function(G){var W=G,C=0;if(W>=4096)C+=13,W>>>=13;if(W>=64)C+=7,W>>>=7;if(W>=8)C+=4,W>>>=4;if(W>=2)C+=2,W>>>=2;return C+W};$.prototype._zeroBits=function(G){if(G===0)return 26;var W=G,C=0;if((W&8191)===0)C+=13,W>>>=13;if((W&127)===0)C+=7,W>>>=7;if((W&15)===0)C+=4,W>>>=4;if((W&3)===0)C+=2,W>>>=2;if((W&1)===0)C++;return C},$.prototype.bitLength=function(){var G=this.words[this.length-1],W=this._countBits(G);return(this.length-1)*26+W};function B(G){var W=Array(G.bitLength());for(var C=0;C<W.length;C++){var D=C/26|0,H=C%26;W[C]=G.words[D]>>>H&1}return W}$.prototype.zeroBits=function(){if(this.isZero())return 0;var G=0;for(var W=0;W<this.length;W++){var C=this._zeroBits(this.words[W]);if(G+=C,C!==26)break}return G},$.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},$.prototype.toTwos=function(G){if(this.negative!==0)return this.abs().inotn(G).iaddn(1);return this.clone()},$.prototype.fromTwos=function(G){if(this.testn(G-1))return this.notn(G).iaddn(1).ineg();return this.clone()},$.prototype.isNeg=function(){return this.negative!==0},$.prototype.neg=function(){return this.clone().ineg()},$.prototype.ineg=function(){if(!this.isZero())this.negative^=1;return this},$.prototype.iuor=function(G){while(this.length<G.length)this.words[this.length++]=0;for(var W=0;W<G.length;W++)this.words[W]=this.words[W]|G.words[W];return this._strip()},$.prototype.ior=function(G){return K((this.negative|G.negative)===0),this.iuor(G)},$.prototype.or=function(G){if(this.length>G.length)return this.clone().ior(G);return G.clone().ior(this)},$.prototype.uor=function(G){if(this.length>G.length)return this.clone().iuor(G);return G.clone().iuor(this)},$.prototype.iuand=function(G){var W;if(this.length>G.length)W=G;else W=this;for(var C=0;C<W.length;C++)this.words[C]=this.words[C]&G.words[C];return this.length=W.length,this._strip()},$.prototype.iand=function(G){return K((this.negative|G.negative)===0),this.iuand(G)},$.prototype.and=function(G){if(this.length>G.length)return this.clone().iand(G);return G.clone().iand(this)},$.prototype.uand=function(G){if(this.length>G.length)return this.clone().iuand(G);return G.clone().iuand(this)},$.prototype.iuxor=function(G){var W,C;if(this.length>G.length)W=this,C=G;else W=G,C=this;for(var D=0;D<C.length;D++)this.words[D]=W.words[D]^C.words[D];if(this!==W)for(;D<W.length;D++)this.words[D]=W.words[D];return this.length=W.length,this._strip()},$.prototype.ixor=function(G){return K((this.negative|G.negative)===0),this.iuxor(G)},$.prototype.xor=function(G){if(this.length>G.length)return this.clone().ixor(G);return G.clone().ixor(this)},$.prototype.uxor=function(G){if(this.length>G.length)return this.clone().iuxor(G);return G.clone().iuxor(this)},$.prototype.inotn=function(G){K(typeof G==="number"&&G>=0);var W=Math.ceil(G/26)|0,C=G%26;if(this._expand(W),C>0)W--;for(var D=0;D<W;D++)this.words[D]=~this.words[D]&67108863;if(C>0)this.words[D]=~this.words[D]&67108863>>26-C;return this._strip()},$.prototype.notn=function(G){return this.clone().inotn(G)},$.prototype.setn=function(G,W){K(typeof G==="number"&&G>=0);var C=G/26|0,D=G%26;if(this._expand(C+1),W)this.words[C]=this.words[C]|1<<D;else this.words[C]=this.words[C]&~(1<<D);return this._strip()},$.prototype.iadd=function(G){var W;if(this.negative!==0&&G.negative===0)return this.negative=0,W=this.isub(G),this.negative^=1,this._normSign();else if(this.negative===0&&G.negative!==0)return G.negative=0,W=this.isub(G),G.negative=1,W._normSign();var C,D;if(this.length>G.length)C=this,D=G;else C=G,D=this;var H=0;for(var J=0;J<D.length;J++)W=(C.words[J]|0)+(D.words[J]|0)+H,this.words[J]=W&67108863,H=W>>>26;for(;H!==0&&J<C.length;J++)W=(C.words[J]|0)+H,this.words[J]=W&67108863,H=W>>>26;if(this.length=C.length,H!==0)this.words[this.length]=H,this.length++;else if(C!==this)for(;J<C.length;J++)this.words[J]=C.words[J];return this},$.prototype.add=function(G){var W;if(G.negative!==0&&this.negative===0)return G.negative=0,W=this.sub(G),G.negative^=1,W;else if(G.negative===0&&this.negative!==0)return this.negative=0,W=G.sub(this),this.negative=1,W;if(this.length>G.length)return this.clone().iadd(G);return G.clone().iadd(this)},$.prototype.isub=function(G){if(G.negative!==0){G.negative=0;var W=this.iadd(G);return G.negative=1,W._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(G),this.negative=1,this._normSign();var C=this.cmp(G);if(C===0)return this.negative=0,this.length=1,this.words[0]=0,this;var D,H;if(C>0)D=this,H=G;else D=G,H=this;var J=0;for(var O=0;O<H.length;O++)W=(D.words[O]|0)-(H.words[O]|0)+J,J=W>>26,this.words[O]=W&67108863;for(;J!==0&&O<D.length;O++)W=(D.words[O]|0)+J,J=W>>26,this.words[O]=W&67108863;if(J===0&&O<D.length&&D!==this)for(;O<D.length;O++)this.words[O]=D.words[O];if(this.length=Math.max(this.length,O),D!==this)this.negative=1;return this._strip()},$.prototype.sub=function(G){return this.clone().isub(G)};function v(G,W,C){C.negative=W.negative^G.negative;var D=G.length+W.length|0;C.length=D,D=D-1|0;var H=G.words[0]|0,J=W.words[0]|0,O=H*J,P=O&67108863,R=O/67108864|0;C.words[0]=P;for(var _=1;_<D;_++){var f=R>>>26,c=R&67108863,o=Math.min(_,W.length-1);for(var K0=Math.max(0,_-G.length+1);K0<=o;K0++){var a=_-K0|0;H=G.words[a]|0,J=W.words[K0]|0,O=H*J+c,f+=O/67108864|0,c=O&67108863}C.words[_]=c|0,R=f|0}if(R!==0)C.words[_]=R|0;else C.length--;return C._strip()}var x=function(G,W,C){var D=G.words,H=W.words,J=C.words,O=0,P,R,_,f=D[0]|0,c=f&8191,o=f>>>13,K0=D[1]|0,a=K0&8191,l=K0>>>13,Q0=D[2]|0,n=Q0&8191,s=Q0>>>13,f0=D[3]|0,y=f0&8191,h=f0>>>13,G0=D[4]|0,t=G0&8191,U0=G0>>>13,L0=D[5]|0,p=L0&8191,m=L0>>>13,g0=D[6]|0,r=g0&8191,J0=g0>>>13,h0=D[7]|0,H0=h0&8191,O0=h0>>>13,J1=D[8]|0,I0=J1&8191,C0=J1>>>13,K1=D[9]|0,q0=K1&8191,z0=K1>>>13,d1=H[0]|0,T0=d1&8191,j0=d1>>>13,l1=H[1]|0,v0=l1&8191,R0=l1>>>13,h1=H[2]|0,_0=h1&8191,E0=h1>>>13,_1=H[3]|0,B0=_1&8191,x0=_1>>>13,B1=H[4]|0,S0=B1&8191,g=B1>>>13,d=H[5]|0,e=d&8191,X0=d>>>13,y0=H[6]|0,F0=y0&8191,A0=y0>>>13,Q1=H[7]|0,P0=Q1&8191,N0=Q1>>>13,u1=H[8]|0,k0=u1&8191,M0=u1>>>13,G1=H[9]|0,l0=G1&8191,b0=G1>>>13;C.negative=G.negative^W.negative,C.length=19,P=Math.imul(c,T0),R=Math.imul(c,j0),R=R+Math.imul(o,T0)|0,_=Math.imul(o,j0);var t0=(O+P|0)+((R&8191)<<13)|0;O=(_+(R>>>13)|0)+(t0>>>26)|0,t0&=67108863,P=Math.imul(a,T0),R=Math.imul(a,j0),R=R+Math.imul(l,T0)|0,_=Math.imul(l,j0),P=P+Math.imul(c,v0)|0,R=R+Math.imul(c,R0)|0,R=R+Math.imul(o,v0)|0,_=_+Math.imul(o,R0)|0;var r0=(O+P|0)+((R&8191)<<13)|0;O=(_+(R>>>13)|0)+(r0>>>26)|0,r0&=67108863,P=Math.imul(n,T0),R=Math.imul(n,j0),R=R+Math.imul(s,T0)|0,_=Math.imul(s,j0),P=P+Math.imul(a,v0)|0,R=R+Math.imul(a,R0)|0,R=R+Math.imul(l,v0)|0,_=_+Math.imul(l,R0)|0,P=P+Math.imul(c,_0)|0,R=R+Math.imul(c,E0)|0,R=R+Math.imul(o,_0)|0,_=_+Math.imul(o,E0)|0;var H1=(O+P|0)+((R&8191)<<13)|0;O=(_+(R>>>13)|0)+(H1>>>26)|0,H1&=67108863,P=Math.imul(y,T0),R=Math.imul(y,j0),R=R+Math.imul(h,T0)|0,_=Math.imul(h,j0),P=P+Math.imul(n,v0)|0,R=R+Math.imul(n,R0)|0,R=R+Math.imul(s,v0)|0,_=_+Math.imul(s,R0)|0,P=P+Math.imul(a,_0)|0,R=R+Math.imul(a,E0)|0,R=R+Math.imul(l,_0)|0,_=_+Math.imul(l,E0)|0,P=P+Math.imul(c,B0)|0,R=R+Math.imul(c,x0)|0,R=R+Math.imul(o,B0)|0,_=_+Math.imul(o,x0)|0;var O1=(O+P|0)+((R&8191)<<13)|0;O=(_+(R>>>13)|0)+(O1>>>26)|0,O1&=67108863,P=Math.imul(t,T0),R=Math.imul(t,j0),R=R+Math.imul(U0,T0)|0,_=Math.imul(U0,j0),P=P+Math.imul(y,v0)|0,R=R+Math.imul(y,R0)|0,R=R+Math.imul(h,v0)|0,_=_+Math.imul(h,R0)|0,P=P+Math.imul(n,_0)|0,R=R+Math.imul(n,E0)|0,R=R+Math.imul(s,_0)|0,_=_+Math.imul(s,E0)|0,P=P+Math.imul(a,B0)|0,R=R+Math.imul(a,x0)|0,R=R+Math.imul(l,B0)|0,_=_+Math.imul(l,x0)|0,P=P+Math.imul(c,S0)|0,R=R+Math.imul(c,g)|0,R=R+Math.imul(o,S0)|0,_=_+Math.imul(o,g)|0;var C1=(O+P|0)+((R&8191)<<13)|0;O=(_+(R>>>13)|0)+(C1>>>26)|0,C1&=67108863,P=Math.imul(p,T0),R=Math.imul(p,j0),R=R+Math.imul(m,T0)|0,_=Math.imul(m,j0),P=P+Math.imul(t,v0)|0,R=R+Math.imul(t,R0)|0,R=R+Math.imul(U0,v0)|0,_=_+Math.imul(U0,R0)|0,P=P+Math.imul(y,_0)|0,R=R+Math.imul(y,E0)|0,R=R+Math.imul(h,_0)|0,_=_+Math.imul(h,E0)|0,P=P+Math.imul(n,B0)|0,R=R+Math.imul(n,x0)|0,R=R+Math.imul(s,B0)|0,_=_+Math.imul(s,x0)|0,P=P+Math.imul(a,S0)|0,R=R+Math.imul(a,g)|0,R=R+Math.imul(l,S0)|0,_=_+Math.imul(l,g)|0,P=P+Math.imul(c,e)|0,R=R+Math.imul(c,X0)|0,R=R+Math.imul(o,e)|0,_=_+Math.imul(o,X0)|0;var A1=(O+P|0)+((R&8191)<<13)|0;O=(_+(R>>>13)|0)+(A1>>>26)|0,A1&=67108863,P=Math.imul(r,T0),R=Math.imul(r,j0),R=R+Math.imul(J0,T0)|0,_=Math.imul(J0,j0),P=P+Math.imul(p,v0)|0,R=R+Math.imul(p,R0)|0,R=R+Math.imul(m,v0)|0,_=_+Math.imul(m,R0)|0,P=P+Math.imul(t,_0)|0,R=R+Math.imul(t,E0)|0,R=R+Math.imul(U0,_0)|0,_=_+Math.imul(U0,E0)|0,P=P+Math.imul(y,B0)|0,R=R+Math.imul(y,x0)|0,R=R+Math.imul(h,B0)|0,_=_+Math.imul(h,x0)|0,P=P+Math.imul(n,S0)|0,R=R+Math.imul(n,g)|0,R=R+Math.imul(s,S0)|0,_=_+Math.imul(s,g)|0,P=P+Math.imul(a,e)|0,R=R+Math.imul(a,X0)|0,R=R+Math.imul(l,e)|0,_=_+Math.imul(l,X0)|0,P=P+Math.imul(c,F0)|0,R=R+Math.imul(c,A0)|0,R=R+Math.imul(o,F0)|0,_=_+Math.imul(o,A0)|0;var z1=(O+P|0)+((R&8191)<<13)|0;O=(_+(R>>>13)|0)+(z1>>>26)|0,z1&=67108863,P=Math.imul(H0,T0),R=Math.imul(H0,j0),R=R+Math.imul(O0,T0)|0,_=Math.imul(O0,j0),P=P+Math.imul(r,v0)|0,R=R+Math.imul(r,R0)|0,R=R+Math.imul(J0,v0)|0,_=_+Math.imul(J0,R0)|0,P=P+Math.imul(p,_0)|0,R=R+Math.imul(p,E0)|0,R=R+Math.imul(m,_0)|0,_=_+Math.imul(m,E0)|0,P=P+Math.imul(t,B0)|0,R=R+Math.imul(t,x0)|0,R=R+Math.imul(U0,B0)|0,_=_+Math.imul(U0,x0)|0,P=P+Math.imul(y,S0)|0,R=R+Math.imul(y,g)|0,R=R+Math.imul(h,S0)|0,_=_+Math.imul(h,g)|0,P=P+Math.imul(n,e)|0,R=R+Math.imul(n,X0)|0,R=R+Math.imul(s,e)|0,_=_+Math.imul(s,X0)|0,P=P+Math.imul(a,F0)|0,R=R+Math.imul(a,A0)|0,R=R+Math.imul(l,F0)|0,_=_+Math.imul(l,A0)|0,P=P+Math.imul(c,P0)|0,R=R+Math.imul(c,N0)|0,R=R+Math.imul(o,P0)|0,_=_+Math.imul(o,N0)|0;var D1=(O+P|0)+((R&8191)<<13)|0;O=(_+(R>>>13)|0)+(D1>>>26)|0,D1&=67108863,P=Math.imul(I0,T0),R=Math.imul(I0,j0),R=R+Math.imul(C0,T0)|0,_=Math.imul(C0,j0),P=P+Math.imul(H0,v0)|0,R=R+Math.imul(H0,R0)|0,R=R+Math.imul(O0,v0)|0,_=_+Math.imul(O0,R0)|0,P=P+Math.imul(r,_0)|0,R=R+Math.imul(r,E0)|0,R=R+Math.imul(J0,_0)|0,_=_+Math.imul(J0,E0)|0,P=P+Math.imul(p,B0)|0,R=R+Math.imul(p,x0)|0,R=R+Math.imul(m,B0)|0,_=_+Math.imul(m,x0)|0,P=P+Math.imul(t,S0)|0,R=R+Math.imul(t,g)|0,R=R+Math.imul(U0,S0)|0,_=_+Math.imul(U0,g)|0,P=P+Math.imul(y,e)|0,R=R+Math.imul(y,X0)|0,R=R+Math.imul(h,e)|0,_=_+Math.imul(h,X0)|0,P=P+Math.imul(n,F0)|0,R=R+Math.imul(n,A0)|0,R=R+Math.imul(s,F0)|0,_=_+Math.imul(s,A0)|0,P=P+Math.imul(a,P0)|0,R=R+Math.imul(a,N0)|0,R=R+Math.imul(l,P0)|0,_=_+Math.imul(l,N0)|0,P=P+Math.imul(c,k0)|0,R=R+Math.imul(c,M0)|0,R=R+Math.imul(o,k0)|0,_=_+Math.imul(o,M0)|0;var q1=(O+P|0)+((R&8191)<<13)|0;O=(_+(R>>>13)|0)+(q1>>>26)|0,q1&=67108863,P=Math.imul(q0,T0),R=Math.imul(q0,j0),R=R+Math.imul(z0,T0)|0,_=Math.imul(z0,j0),P=P+Math.imul(I0,v0)|0,R=R+Math.imul(I0,R0)|0,R=R+Math.imul(C0,v0)|0,_=_+Math.imul(C0,R0)|0,P=P+Math.imul(H0,_0)|0,R=R+Math.imul(H0,E0)|0,R=R+Math.imul(O0,_0)|0,_=_+Math.imul(O0,E0)|0,P=P+Math.imul(r,B0)|0,R=R+Math.imul(r,x0)|0,R=R+Math.imul(J0,B0)|0,_=_+Math.imul(J0,x0)|0,P=P+Math.imul(p,S0)|0,R=R+Math.imul(p,g)|0,R=R+Math.imul(m,S0)|0,_=_+Math.imul(m,g)|0,P=P+Math.imul(t,e)|0,R=R+Math.imul(t,X0)|0,R=R+Math.imul(U0,e)|0,_=_+Math.imul(U0,X0)|0,P=P+Math.imul(y,F0)|0,R=R+Math.imul(y,A0)|0,R=R+Math.imul(h,F0)|0,_=_+Math.imul(h,A0)|0,P=P+Math.imul(n,P0)|0,R=R+Math.imul(n,N0)|0,R=R+Math.imul(s,P0)|0,_=_+Math.imul(s,N0)|0,P=P+Math.imul(a,k0)|0,R=R+Math.imul(a,M0)|0,R=R+Math.imul(l,k0)|0,_=_+Math.imul(l,M0)|0,P=P+Math.imul(c,l0)|0,R=R+Math.imul(c,b0)|0,R=R+Math.imul(o,l0)|0,_=_+Math.imul(o,b0)|0;var M1=(O+P|0)+((R&8191)<<13)|0;O=(_+(R>>>13)|0)+(M1>>>26)|0,M1&=67108863,P=Math.imul(q0,v0),R=Math.imul(q0,R0),R=R+Math.imul(z0,v0)|0,_=Math.imul(z0,R0),P=P+Math.imul(I0,_0)|0,R=R+Math.imul(I0,E0)|0,R=R+Math.imul(C0,_0)|0,_=_+Math.imul(C0,E0)|0,P=P+Math.imul(H0,B0)|0,R=R+Math.imul(H0,x0)|0,R=R+Math.imul(O0,B0)|0,_=_+Math.imul(O0,x0)|0,P=P+Math.imul(r,S0)|0,R=R+Math.imul(r,g)|0,R=R+Math.imul(J0,S0)|0,_=_+Math.imul(J0,g)|0,P=P+Math.imul(p,e)|0,R=R+Math.imul(p,X0)|0,R=R+Math.imul(m,e)|0,_=_+Math.imul(m,X0)|0,P=P+Math.imul(t,F0)|0,R=R+Math.imul(t,A0)|0,R=R+Math.imul(U0,F0)|0,_=_+Math.imul(U0,A0)|0,P=P+Math.imul(y,P0)|0,R=R+Math.imul(y,N0)|0,R=R+Math.imul(h,P0)|0,_=_+Math.imul(h,N0)|0,P=P+Math.imul(n,k0)|0,R=R+Math.imul(n,M0)|0,R=R+Math.imul(s,k0)|0,_=_+Math.imul(s,M0)|0,P=P+Math.imul(a,l0)|0,R=R+Math.imul(a,b0)|0,R=R+Math.imul(l,l0)|0,_=_+Math.imul(l,b0)|0;var L1=(O+P|0)+((R&8191)<<13)|0;O=(_+(R>>>13)|0)+(L1>>>26)|0,L1&=67108863,P=Math.imul(q0,_0),R=Math.imul(q0,E0),R=R+Math.imul(z0,_0)|0,_=Math.imul(z0,E0),P=P+Math.imul(I0,B0)|0,R=R+Math.imul(I0,x0)|0,R=R+Math.imul(C0,B0)|0,_=_+Math.imul(C0,x0)|0,P=P+Math.imul(H0,S0)|0,R=R+Math.imul(H0,g)|0,R=R+Math.imul(O0,S0)|0,_=_+Math.imul(O0,g)|0,P=P+Math.imul(r,e)|0,R=R+Math.imul(r,X0)|0,R=R+Math.imul(J0,e)|0,_=_+Math.imul(J0,X0)|0,P=P+Math.imul(p,F0)|0,R=R+Math.imul(p,A0)|0,R=R+Math.imul(m,F0)|0,_=_+Math.imul(m,A0)|0,P=P+Math.imul(t,P0)|0,R=R+Math.imul(t,N0)|0,R=R+Math.imul(U0,P0)|0,_=_+Math.imul(U0,N0)|0,P=P+Math.imul(y,k0)|0,R=R+Math.imul(y,M0)|0,R=R+Math.imul(h,k0)|0,_=_+Math.imul(h,M0)|0,P=P+Math.imul(n,l0)|0,R=R+Math.imul(n,b0)|0,R=R+Math.imul(s,l0)|0,_=_+Math.imul(s,b0)|0;var T1=(O+P|0)+((R&8191)<<13)|0;O=(_+(R>>>13)|0)+(T1>>>26)|0,T1&=67108863,P=Math.imul(q0,B0),R=Math.imul(q0,x0),R=R+Math.imul(z0,B0)|0,_=Math.imul(z0,x0),P=P+Math.imul(I0,S0)|0,R=R+Math.imul(I0,g)|0,R=R+Math.imul(C0,S0)|0,_=_+Math.imul(C0,g)|0,P=P+Math.imul(H0,e)|0,R=R+Math.imul(H0,X0)|0,R=R+Math.imul(O0,e)|0,_=_+Math.imul(O0,X0)|0,P=P+Math.imul(r,F0)|0,R=R+Math.imul(r,A0)|0,R=R+Math.imul(J0,F0)|0,_=_+Math.imul(J0,A0)|0,P=P+Math.imul(p,P0)|0,R=R+Math.imul(p,N0)|0,R=R+Math.imul(m,P0)|0,_=_+Math.imul(m,N0)|0,P=P+Math.imul(t,k0)|0,R=R+Math.imul(t,M0)|0,R=R+Math.imul(U0,k0)|0,_=_+Math.imul(U0,M0)|0,P=P+Math.imul(y,l0)|0,R=R+Math.imul(y,b0)|0,R=R+Math.imul(h,l0)|0,_=_+Math.imul(h,b0)|0;var R1=(O+P|0)+((R&8191)<<13)|0;O=(_+(R>>>13)|0)+(R1>>>26)|0,R1&=67108863,P=Math.imul(q0,S0),R=Math.imul(q0,g),R=R+Math.imul(z0,S0)|0,_=Math.imul(z0,g),P=P+Math.imul(I0,e)|0,R=R+Math.imul(I0,X0)|0,R=R+Math.imul(C0,e)|0,_=_+Math.imul(C0,X0)|0,P=P+Math.imul(H0,F0)|0,R=R+Math.imul(H0,A0)|0,R=R+Math.imul(O0,F0)|0,_=_+Math.imul(O0,A0)|0,P=P+Math.imul(r,P0)|0,R=R+Math.imul(r,N0)|0,R=R+Math.imul(J0,P0)|0,_=_+Math.imul(J0,N0)|0,P=P+Math.imul(p,k0)|0,R=R+Math.imul(p,M0)|0,R=R+Math.imul(m,k0)|0,_=_+Math.imul(m,M0)|0,P=P+Math.imul(t,l0)|0,R=R+Math.imul(t,b0)|0,R=R+Math.imul(U0,l0)|0,_=_+Math.imul(U0,b0)|0;var E1=(O+P|0)+((R&8191)<<13)|0;O=(_+(R>>>13)|0)+(E1>>>26)|0,E1&=67108863,P=Math.imul(q0,e),R=Math.imul(q0,X0),R=R+Math.imul(z0,e)|0,_=Math.imul(z0,X0),P=P+Math.imul(I0,F0)|0,R=R+Math.imul(I0,A0)|0,R=R+Math.imul(C0,F0)|0,_=_+Math.imul(C0,A0)|0,P=P+Math.imul(H0,P0)|0,R=R+Math.imul(H0,N0)|0,R=R+Math.imul(O0,P0)|0,_=_+Math.imul(O0,N0)|0,P=P+Math.imul(r,k0)|0,R=R+Math.imul(r,M0)|0,R=R+Math.imul(J0,k0)|0,_=_+Math.imul(J0,M0)|0,P=P+Math.imul(p,l0)|0,R=R+Math.imul(p,b0)|0,R=R+Math.imul(m,l0)|0,_=_+Math.imul(m,b0)|0;var S1=(O+P|0)+((R&8191)<<13)|0;O=(_+(R>>>13)|0)+(S1>>>26)|0,S1&=67108863,P=Math.imul(q0,F0),R=Math.imul(q0,A0),R=R+Math.imul(z0,F0)|0,_=Math.imul(z0,A0),P=P+Math.imul(I0,P0)|0,R=R+Math.imul(I0,N0)|0,R=R+Math.imul(C0,P0)|0,_=_+Math.imul(C0,N0)|0,P=P+Math.imul(H0,k0)|0,R=R+Math.imul(H0,M0)|0,R=R+Math.imul(O0,k0)|0,_=_+Math.imul(O0,M0)|0,P=P+Math.imul(r,l0)|0,R=R+Math.imul(r,b0)|0,R=R+Math.imul(J0,l0)|0,_=_+Math.imul(J0,b0)|0;var P1=(O+P|0)+((R&8191)<<13)|0;O=(_+(R>>>13)|0)+(P1>>>26)|0,P1&=67108863,P=Math.imul(q0,P0),R=Math.imul(q0,N0),R=R+Math.imul(z0,P0)|0,_=Math.imul(z0,N0),P=P+Math.imul(I0,k0)|0,R=R+Math.imul(I0,M0)|0,R=R+Math.imul(C0,k0)|0,_=_+Math.imul(C0,M0)|0,P=P+Math.imul(H0,l0)|0,R=R+Math.imul(H0,b0)|0,R=R+Math.imul(O0,l0)|0,_=_+Math.imul(O0,b0)|0;var WY=(O+P|0)+((R&8191)<<13)|0;O=(_+(R>>>13)|0)+(WY>>>26)|0,WY&=67108863,P=Math.imul(q0,k0),R=Math.imul(q0,M0),R=R+Math.imul(z0,k0)|0,_=Math.imul(z0,M0),P=P+Math.imul(I0,l0)|0,R=R+Math.imul(I0,b0)|0,R=R+Math.imul(C0,l0)|0,_=_+Math.imul(C0,b0)|0;var IY=(O+P|0)+((R&8191)<<13)|0;O=(_+(R>>>13)|0)+(IY>>>26)|0,IY&=67108863,P=Math.imul(q0,l0),R=Math.imul(q0,b0),R=R+Math.imul(z0,l0)|0,_=Math.imul(z0,b0);var FY=(O+P|0)+((R&8191)<<13)|0;if(O=(_+(R>>>13)|0)+(FY>>>26)|0,FY&=67108863,J[0]=t0,J[1]=r0,J[2]=H1,J[3]=O1,J[4]=C1,J[5]=A1,J[6]=z1,J[7]=D1,J[8]=q1,J[9]=M1,J[10]=L1,J[11]=T1,J[12]=R1,J[13]=E1,J[14]=S1,J[15]=P1,J[16]=WY,J[17]=IY,J[18]=FY,O!==0)J[19]=O,C.length++;return C};if(!Math.imul)x=v;function N(G,W,C){C.negative=W.negative^G.negative,C.length=G.length+W.length;var D=0,H=0;for(var J=0;J<C.length-1;J++){var O=H;H=0;var P=D&67108863,R=Math.min(J,W.length-1);for(var _=Math.max(0,J-G.length+1);_<=R;_++){var f=J-_,c=G.words[f]|0,o=W.words[_]|0,K0=c*o,a=K0&67108863;O=O+(K0/67108864|0)|0,a=a+P|0,P=a&67108863,O=O+(a>>>26)|0,H+=O>>>26,O&=67108863}C.words[J]=P,D=O,O=H}if(D!==0)C.words[J]=D;else C.length--;return C._strip()}function w(G,W,C){return N(G,W,C)}$.prototype.mulTo=function(G,W){var C,D=this.length+G.length;if(this.length===10&&G.length===10)C=x(this,G,W);else if(D<63)C=v(this,G,W);else if(D<1024)C=N(this,G,W);else C=w(this,G,W);return C};function u(G,W){this.x=G,this.y=W}u.prototype.makeRBT=function(G){var W=Array(G),C=$.prototype._countBits(G)-1;for(var D=0;D<G;D++)W[D]=this.revBin(D,C,G);return W},u.prototype.revBin=function(G,W,C){if(G===0||G===C-1)return G;var D=0;for(var H=0;H<W;H++)D|=(G&1)<<W-H-1,G>>=1;return D},u.prototype.permute=function(G,W,C,D,H,J){for(var O=0;O<J;O++)D[O]=W[G[O]],H[O]=C[G[O]]},u.prototype.transform=function(G,W,C,D,H,J){this.permute(J,G,W,C,D,H);for(var O=1;O<H;O<<=1){var P=O<<1,R=Math.cos(2*Math.PI/P),_=Math.sin(2*Math.PI/P);for(var f=0;f<H;f+=P){var c=R,o=_;for(var K0=0;K0<O;K0++){var a=C[f+K0],l=D[f+K0],Q0=C[f+K0+O],n=D[f+K0+O],s=c*Q0-o*n;if(n=c*n+o*Q0,Q0=s,C[f+K0]=a+Q0,D[f+K0]=l+n,C[f+K0+O]=a-Q0,D[f+K0+O]=l-n,K0!==P)s=R*c-_*o,o=R*o+_*c,c=s}}}},u.prototype.guessLen13b=function(G,W){var C=Math.max(W,G)|1,D=C&1,H=0;for(C=C/2|0;C;C=C>>>1)H++;return 1<<H+1+D},u.prototype.conjugate=function(G,W,C){if(C<=1)return;for(var D=0;D<C/2;D++){var H=G[D];G[D]=G[C-D-1],G[C-D-1]=H,H=W[D],W[D]=-W[C-D-1],W[C-D-1]=-H}},u.prototype.normalize13b=function(G,W){var C=0;for(var D=0;D<W/2;D++){var H=Math.round(G[2*D+1]/W)*8192+Math.round(G[2*D]/W)+C;if(G[D]=H&67108863,H<67108864)C=0;else C=H/67108864|0}return G},u.prototype.convert13b=function(G,W,C,D){var H=0;for(var J=0;J<W;J++)H=H+(G[J]|0),C[2*J]=H&8191,H=H>>>13,C[2*J+1]=H&8191,H=H>>>13;for(J=2*W;J<D;++J)C[J]=0;K(H===0),K((H&-8192)===0)},u.prototype.stub=function(G){var W=Array(G);for(var C=0;C<G;C++)W[C]=0;return W},u.prototype.mulp=function(G,W,C){var D=2*this.guessLen13b(G.length,W.length),H=this.makeRBT(D),J=this.stub(D),O=Array(D),P=Array(D),R=Array(D),_=Array(D),f=Array(D),c=Array(D),o=C.words;o.length=D,this.convert13b(G.words,G.length,O,D),this.convert13b(W.words,W.length,_,D),this.transform(O,J,P,R,D,H),this.transform(_,J,f,c,D,H);for(var K0=0;K0<D;K0++){var a=P[K0]*f[K0]-R[K0]*c[K0];R[K0]=P[K0]*c[K0]+R[K0]*f[K0],P[K0]=a}return this.conjugate(P,R,D),this.transform(P,R,o,J,D,H),this.conjugate(o,J,D),this.normalize13b(o,D),C.negative=G.negative^W.negative,C.length=G.length+W.length,C._strip()},$.prototype.mul=function(G){var W=new $(null);return W.words=Array(this.length+G.length),this.mulTo(G,W)},$.prototype.mulf=function(G){var W=new $(null);return W.words=Array(this.length+G.length),w(this,G,W)},$.prototype.imul=function(G){return this.clone().mulTo(G,this)},$.prototype.imuln=function(G){var W=G<0;if(W)G=-G;K(typeof G==="number"),K(G<67108864);var C=0;for(var D=0;D<this.length;D++){var H=(this.words[D]|0)*G,J=(H&67108863)+(C&67108863);C>>=26,C+=H/67108864|0,C+=J>>>26,this.words[D]=J&67108863}if(C!==0)this.words[D]=C,this.length++;return this.length=G===0?1:this.length,W?this.ineg():this},$.prototype.muln=function(G){return this.clone().imuln(G)},$.prototype.sqr=function(){return this.mul(this)},$.prototype.isqr=function(){return this.imul(this.clone())},$.prototype.pow=function(G){var W=B(G);if(W.length===0)return new $(1);var C=this;for(var D=0;D<W.length;D++,C=C.sqr())if(W[D]!==0)break;if(++D<W.length)for(var H=C.sqr();D<W.length;D++,H=H.sqr()){if(W[D]===0)continue;C=C.mul(H)}return C},$.prototype.iushln=function(G){K(typeof G==="number"&&G>=0);var W=G%26,C=(G-W)/26,D=67108863>>>26-W<<26-W,H;if(W!==0){var J=0;for(H=0;H<this.length;H++){var O=this.words[H]&D,P=(this.words[H]|0)-O<<W;this.words[H]=P|J,J=O>>>26-W}if(J)this.words[H]=J,this.length++}if(C!==0){for(H=this.length-1;H>=0;H--)this.words[H+C]=this.words[H];for(H=0;H<C;H++)this.words[H]=0;this.length+=C}return this._strip()},$.prototype.ishln=function(G){return K(this.negative===0),this.iushln(G)},$.prototype.iushrn=function(G,W,C){K(typeof G==="number"&&G>=0);var D;if(W)D=(W-W%26)/26;else D=0;var H=G%26,J=Math.min((G-H)/26,this.length),O=67108863^67108863>>>H<<H,P=C;if(D-=J,D=Math.max(0,D),P){for(var R=0;R<J;R++)P.words[R]=this.words[R];P.length=J}if(J===0);else if(this.length>J){this.length-=J;for(R=0;R<this.length;R++)this.words[R]=this.words[R+J]}else this.words[0]=0,this.length=1;var _=0;for(R=this.length-1;R>=0&&(_!==0||R>=D);R--){var f=this.words[R]|0;this.words[R]=_<<26-H|f>>>H,_=f&O}if(P&&_!==0)P.words[P.length++]=_;if(this.length===0)this.words[0]=0,this.length=1;return this._strip()},$.prototype.ishrn=function(G,W,C){return K(this.negative===0),this.iushrn(G,W,C)},$.prototype.shln=function(G){return this.clone().ishln(G)},$.prototype.ushln=function(G){return this.clone().iushln(G)},$.prototype.shrn=function(G){return this.clone().ishrn(G)},$.prototype.ushrn=function(G){return this.clone().iushrn(G)},$.prototype.testn=function(G){K(typeof G==="number"&&G>=0);var W=G%26,C=(G-W)/26,D=1<<W;if(this.length<=C)return!1;var H=this.words[C];return!!(H&D)},$.prototype.imaskn=function(G){K(typeof G==="number"&&G>=0);var W=G%26,C=(G-W)/26;if(K(this.negative===0,"imaskn works only with positive numbers"),this.length<=C)return this;if(W!==0)C++;if(this.length=Math.min(C,this.length),W!==0){var D=67108863^67108863>>>W<<W;this.words[this.length-1]&=D}return this._strip()},$.prototype.maskn=function(G){return this.clone().imaskn(G)},$.prototype.iaddn=function(G){if(K(typeof G==="number"),K(G<67108864),G<0)return this.isubn(-G);if(this.negative!==0){if(this.length===1&&(this.words[0]|0)<=G)return this.words[0]=G-(this.words[0]|0),this.negative=0,this;return this.negative=0,this.isubn(G),this.negative=1,this}return this._iaddn(G)},$.prototype._iaddn=function(G){this.words[0]+=G;for(var W=0;W<this.length&&this.words[W]>=67108864;W++)if(this.words[W]-=67108864,W===this.length-1)this.words[W+1]=1;else this.words[W+1]++;return this.length=Math.max(this.length,W+1),this},$.prototype.isubn=function(G){if(K(typeof G==="number"),K(G<67108864),G<0)return this.iaddn(-G);if(this.negative!==0)return this.negative=0,this.iaddn(G),this.negative=1,this;if(this.words[0]-=G,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var W=0;W<this.length&&this.words[W]<0;W++)this.words[W]+=67108864,this.words[W+1]-=1;return this._strip()},$.prototype.addn=function(G){return this.clone().iaddn(G)},$.prototype.subn=function(G){return this.clone().isubn(G)},$.prototype.iabs=function(){return this.negative=0,this},$.prototype.abs=function(){return this.clone().iabs()},$.prototype._ishlnsubmul=function(G,W,C){var D=G.length+C,H;this._expand(D);var J,O=0;for(H=0;H<G.length;H++){J=(this.words[H+C]|0)+O;var P=(G.words[H]|0)*W;J-=P&67108863,O=(J>>26)-(P/67108864|0),this.words[H+C]=J&67108863}for(;H<this.length-C;H++)J=(this.words[H+C]|0)+O,O=J>>26,this.words[H+C]=J&67108863;if(O===0)return this._strip();K(O===-1),O=0;for(H=0;H<this.length;H++)J=-(this.words[H]|0)+O,O=J>>26,this.words[H]=J&67108863;return this.negative=1,this._strip()},$.prototype._wordDiv=function(G,W){var C=this.length-G.length,D=this.clone(),H=G,J=H.words[H.length-1]|0,O=this._countBits(J);if(C=26-O,C!==0)H=H.ushln(C),D.iushln(C),J=H.words[H.length-1]|0;var P=D.length-H.length,R;if(W!=="mod"){R=new $(null),R.length=P+1,R.words=Array(R.length);for(var _=0;_<R.length;_++)R.words[_]=0}var f=D.clone()._ishlnsubmul(H,1,P);if(f.negative===0){if(D=f,R)R.words[P]=1}for(var c=P-1;c>=0;c--){var o=(D.words[H.length+c]|0)*67108864+(D.words[H.length+c-1]|0);o=Math.min(o/J|0,67108863),D._ishlnsubmul(H,o,c);while(D.negative!==0)if(o--,D.negative=0,D._ishlnsubmul(H,1,c),!D.isZero())D.negative^=1;if(R)R.words[c]=o}if(R)R._strip();if(D._strip(),W!=="div"&&C!==0)D.iushrn(C);return{div:R||null,mod:D}},$.prototype.divmod=function(G,W,C){if(K(!G.isZero()),this.isZero())return{div:new $(0),mod:new $(0)};var D,H,J;if(this.negative!==0&&G.negative===0){if(J=this.neg().divmod(G,W),W!=="mod")D=J.div.neg();if(W!=="div"){if(H=J.mod.neg(),C&&H.negative!==0)H.iadd(G)}return{div:D,mod:H}}if(this.negative===0&&G.negative!==0){if(J=this.divmod(G.neg(),W),W!=="mod")D=J.div.neg();return{div:D,mod:J.mod}}if((this.negative&G.negative)!==0){if(J=this.neg().divmod(G.neg(),W),W!=="div"){if(H=J.mod.neg(),C&&H.negative!==0)H.isub(G)}return{div:J.div,mod:H}}if(G.length>this.length||this.cmp(G)<0)return{div:new $(0),mod:this};if(G.length===1){if(W==="div")return{div:this.divn(G.words[0]),mod:null};if(W==="mod")return{div:null,mod:new $(this.modrn(G.words[0]))};return{div:this.divn(G.words[0]),mod:new $(this.modrn(G.words[0]))}}return this._wordDiv(G,W)},$.prototype.div=function(G){return this.divmod(G,"div",!1).div},$.prototype.mod=function(G){return this.divmod(G,"mod",!1).mod},$.prototype.umod=function(G){return this.divmod(G,"mod",!0).mod},$.prototype.divRound=function(G){var W=this.divmod(G);if(W.mod.isZero())return W.div;var C=W.div.negative!==0?W.mod.isub(G):W.mod,D=G.ushrn(1),H=G.andln(1),J=C.cmp(D);if(J<0||H===1&&J===0)return W.div;return W.div.negative!==0?W.div.isubn(1):W.div.iaddn(1)},$.prototype.modrn=function(G){var W=G<0;if(W)G=-G;K(G<=67108863);var C=67108864%G,D=0;for(var H=this.length-1;H>=0;H--)D=(C*D+(this.words[H]|0))%G;return W?-D:D},$.prototype.modn=function(G){return this.modrn(G)},$.prototype.idivn=function(G){var W=G<0;if(W)G=-G;K(G<=67108863);var C=0;for(var D=this.length-1;D>=0;D--){var H=(this.words[D]|0)+C*67108864;this.words[D]=H/G|0,C=H%G}return this._strip(),W?this.ineg():this},$.prototype.divn=function(G){return this.clone().idivn(G)},$.prototype.egcd=function(G){K(G.negative===0),K(!G.isZero());var W=this,C=G.clone();if(W.negative!==0)W=W.umod(G);else W=W.clone();var D=new $(1),H=new $(0),J=new $(0),O=new $(1),P=0;while(W.isEven()&&C.isEven())W.iushrn(1),C.iushrn(1),++P;var R=C.clone(),_=W.clone();while(!W.isZero()){for(var f=0,c=1;(W.words[0]&c)===0&&f<26;++f,c<<=1);if(f>0){W.iushrn(f);while(f-- >0){if(D.isOdd()||H.isOdd())D.iadd(R),H.isub(_);D.iushrn(1),H.iushrn(1)}}for(var o=0,K0=1;(C.words[0]&K0)===0&&o<26;++o,K0<<=1);if(o>0){C.iushrn(o);while(o-- >0){if(J.isOdd()||O.isOdd())J.iadd(R),O.isub(_);J.iushrn(1),O.iushrn(1)}}if(W.cmp(C)>=0)W.isub(C),D.isub(J),H.isub(O);else C.isub(W),J.isub(D),O.isub(H)}return{a:J,b:O,gcd:C.iushln(P)}},$.prototype._invmp=function(G){K(G.negative===0),K(!G.isZero());var W=this,C=G.clone();if(W.negative!==0)W=W.umod(G);else W=W.clone();var D=new $(1),H=new $(0),J=C.clone();while(W.cmpn(1)>0&&C.cmpn(1)>0){for(var O=0,P=1;(W.words[0]&P)===0&&O<26;++O,P<<=1);if(O>0){W.iushrn(O);while(O-- >0){if(D.isOdd())D.iadd(J);D.iushrn(1)}}for(var R=0,_=1;(C.words[0]&_)===0&&R<26;++R,_<<=1);if(R>0){C.iushrn(R);while(R-- >0){if(H.isOdd())H.iadd(J);H.iushrn(1)}}if(W.cmp(C)>=0)W.isub(C),D.isub(H);else C.isub(W),H.isub(D)}var f;if(W.cmpn(1)===0)f=D;else f=H;if(f.cmpn(0)<0)f.iadd(G);return f},$.prototype.gcd=function(G){if(this.isZero())return G.abs();if(G.isZero())return this.abs();var W=this.clone(),C=G.clone();W.negative=0,C.negative=0;for(var D=0;W.isEven()&&C.isEven();D++)W.iushrn(1),C.iushrn(1);do{while(W.isEven())W.iushrn(1);while(C.isEven())C.iushrn(1);var H=W.cmp(C);if(H<0){var J=W;W=C,C=J}else if(H===0||C.cmpn(1)===0)break;W.isub(C)}while(!0);return C.iushln(D)},$.prototype.invm=function(G){return this.egcd(G).a.umod(G)},$.prototype.isEven=function(){return(this.words[0]&1)===0},$.prototype.isOdd=function(){return(this.words[0]&1)===1},$.prototype.andln=function(G){return this.words[0]&G},$.prototype.bincn=function(G){K(typeof G==="number");var W=G%26,C=(G-W)/26,D=1<<W;if(this.length<=C)return this._expand(C+1),this.words[C]|=D,this;var H=D;for(var J=C;H!==0&&J<this.length;J++){var O=this.words[J]|0;O+=H,H=O>>>26,O&=67108863,this.words[J]=O}if(H!==0)this.words[J]=H,this.length++;return this},$.prototype.isZero=function(){return this.length===1&&this.words[0]===0},$.prototype.cmpn=function(G){var W=G<0;if(this.negative!==0&&!W)return-1;if(this.negative===0&&W)return 1;this._strip();var C;if(this.length>1)C=1;else{if(W)G=-G;K(G<=67108863,"Number is too big");var D=this.words[0]|0;C=D===G?0:D<G?-1:1}if(this.negative!==0)return-C|0;return C},$.prototype.cmp=function(G){if(this.negative!==0&&G.negative===0)return-1;if(this.negative===0&&G.negative!==0)return 1;var W=this.ucmp(G);if(this.negative!==0)return-W|0;return W},$.prototype.ucmp=function(G){if(this.length>G.length)return 1;if(this.length<G.length)return-1;var W=0;for(var C=this.length-1;C>=0;C--){var D=this.words[C]|0,H=G.words[C]|0;if(D===H)continue;if(D<H)W=-1;else if(D>H)W=1;break}return W},$.prototype.gtn=function(G){return this.cmpn(G)===1},$.prototype.gt=function(G){return this.cmp(G)===1},$.prototype.gten=function(G){return this.cmpn(G)>=0},$.prototype.gte=function(G){return this.cmp(G)>=0},$.prototype.ltn=function(G){return this.cmpn(G)===-1},$.prototype.lt=function(G){return this.cmp(G)===-1},$.prototype.lten=function(G){return this.cmpn(G)<=0},$.prototype.lte=function(G){return this.cmp(G)<=0},$.prototype.eqn=function(G){return this.cmpn(G)===0},$.prototype.eq=function(G){return this.cmp(G)===0},$.red=function(G){return new V(G)},$.prototype.toRed=function(G){return K(!this.red,"Already a number in reduction context"),K(this.negative===0,"red works only with positives"),G.convertTo(this)._forceRed(G)},$.prototype.fromRed=function(){return K(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},$.prototype._forceRed=function(G){return this.red=G,this},$.prototype.forceRed=function(G){return K(!this.red,"Already a number in reduction context"),this._forceRed(G)},$.prototype.redAdd=function(G){return K(this.red,"redAdd works only with red numbers"),this.red.add(this,G)},$.prototype.redIAdd=function(G){return K(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,G)},$.prototype.redSub=function(G){return K(this.red,"redSub works only with red numbers"),this.red.sub(this,G)},$.prototype.redISub=function(G){return K(this.red,"redISub works only with red numbers"),this.red.isub(this,G)},$.prototype.redShl=function(G){return K(this.red,"redShl works only with red numbers"),this.red.shl(this,G)},$.prototype.redMul=function(G){return K(this.red,"redMul works only with red numbers"),this.red._verify2(this,G),this.red.mul(this,G)},$.prototype.redIMul=function(G){return K(this.red,"redMul works only with red numbers"),this.red._verify2(this,G),this.red.imul(this,G)},$.prototype.redSqr=function(){return K(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},$.prototype.redISqr=function(){return K(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},$.prototype.redSqrt=function(){return K(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},$.prototype.redInvm=function(){return K(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},$.prototype.redNeg=function(){return K(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},$.prototype.redPow=function(G){return K(this.red&&!G.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,G)};var Z0={k256:null,p224:null,p192:null,p25519:null};function V0(G,W){this.name=G,this.p=new $(W,16),this.n=this.p.bitLength(),this.k=new $(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}V0.prototype._tmp=function(){var G=new $(null);return G.words=Array(Math.ceil(this.n/13)),G},V0.prototype.ireduce=function(G){var W=G,C;do this.split(W,this.tmp),W=this.imulK(W),W=W.iadd(this.tmp),C=W.bitLength();while(C>this.n);var D=C<this.n?-1:W.ucmp(this.p);if(D===0)W.words[0]=0,W.length=1;else if(D>0)W.isub(this.p);else if(W.strip!==void 0)W.strip();else W._strip();return W},V0.prototype.split=function(G,W){G.iushrn(this.n,0,W)},V0.prototype.imulK=function(G){return G.imul(this.k)};function Y0(){V0.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}F(Y0,V0),Y0.prototype.split=function(G,W){var C=4194303,D=Math.min(G.length,9);for(var H=0;H<D;H++)W.words[H]=G.words[H];if(W.length=D,G.length<=9){G.words[0]=0,G.length=1;return}var J=G.words[9];W.words[W.length++]=J&C;for(H=10;H<G.length;H++){var O=G.words[H]|0;G.words[H-10]=(O&C)<<4|J>>>22,J=O}if(J>>>=22,G.words[H-10]=J,J===0&&G.length>10)G.length-=10;else G.length-=9},Y0.prototype.imulK=function(G){G.words[G.length]=0,G.words[G.length+1]=0,G.length+=2;var W=0;for(var C=0;C<G.length;C++){var D=G.words[C]|0;W+=D*977,G.words[C]=W&67108863,W=D*64+(W/67108864|0)}if(G.words[G.length-1]===0){if(G.length--,G.words[G.length-1]===0)G.length--}return G};function b(){V0.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}F(b,V0);function i(){V0.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}F(i,V0);function Y(){V0.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}F(Y,V0),Y.prototype.imulK=function(G){var W=0;for(var C=0;C<G.length;C++){var D=(G.words[C]|0)*19+W,H=D&67108863;D>>>=26,G.words[C]=H,W=D}if(W!==0)G.words[G.length++]=W;return G},$._prime=function(G){if(Z0[G])return Z0[G];var W;if(G==="k256")W=new Y0;else if(G==="p224")W=new b;else if(G==="p192")W=new i;else if(G==="p25519")W=new Y;else throw Error("Unknown prime "+G);return Z0[G]=W,W};function V(G){if(typeof G==="string"){var W=$._prime(G);this.m=W.p,this.prime=W}else K(G.gtn(1),"modulus must be greater than 1"),this.m=G,this.prime=null}V.prototype._verify1=function(G){K(G.negative===0,"red works only with positives"),K(G.red,"red works only with red numbers")},V.prototype._verify2=function(G,W){K((G.negative|W.negative)===0,"red works only with positives"),K(G.red&&G.red===W.red,"red works only with red numbers")},V.prototype.imod=function(G){if(this.prime)return this.prime.ireduce(G)._forceRed(this);return A(G,G.umod(this.m)._forceRed(this)),G},V.prototype.neg=function(G){if(G.isZero())return G.clone();return this.m.sub(G)._forceRed(this)},V.prototype.add=function(G,W){this._verify2(G,W);var C=G.add(W);if(C.cmp(this.m)>=0)C.isub(this.m);return C._forceRed(this)},V.prototype.iadd=function(G,W){this._verify2(G,W);var C=G.iadd(W);if(C.cmp(this.m)>=0)C.isub(this.m);return C},V.prototype.sub=function(G,W){this._verify2(G,W);var C=G.sub(W);if(C.cmpn(0)<0)C.iadd(this.m);return C._forceRed(this)},V.prototype.isub=function(G,W){this._verify2(G,W);var C=G.isub(W);if(C.cmpn(0)<0)C.iadd(this.m);return C},V.prototype.shl=function(G,W){return this._verify1(G),this.imod(G.ushln(W))},V.prototype.imul=function(G,W){return this._verify2(G,W),this.imod(G.imul(W))},V.prototype.mul=function(G,W){return this._verify2(G,W),this.imod(G.mul(W))},V.prototype.isqr=function(G){return this.imul(G,G.clone())},V.prototype.sqr=function(G){return this.mul(G,G)},V.prototype.sqrt=function(G){if(G.isZero())return G.clone();var W=this.m.andln(3);if(K(W%2===1),W===3){var C=this.m.add(new $(1)).iushrn(2);return this.pow(G,C)}var D=this.m.subn(1),H=0;while(!D.isZero()&&D.andln(1)===0)H++,D.iushrn(1);K(!D.isZero());var J=new $(1).toRed(this),O=J.redNeg(),P=this.m.subn(1).iushrn(1),R=this.m.bitLength();R=new $(2*R*R).toRed(this);while(this.pow(R,P).cmp(O)!==0)R.redIAdd(O);var _=this.pow(R,D),f=this.pow(G,D.addn(1).iushrn(1)),c=this.pow(G,D),o=H;while(c.cmp(J)!==0){var K0=c;for(var a=0;K0.cmp(J)!==0;a++)K0=K0.redSqr();K(a<o);var l=this.pow(_,new $(1).iushln(o-a-1));f=f.redMul(l),_=l.redSqr(),c=c.redMul(_),o=a}return f},V.prototype.invm=function(G){var W=G._invmp(this.m);if(W.negative!==0)return W.negative=0,this.imod(W).redNeg();else return this.imod(W)},V.prototype.pow=function(G,W){if(W.isZero())return new $(1).toRed(this);if(W.cmpn(1)===0)return G.clone();var C=4,D=Array(1<<C);D[0]=new $(1).toRed(this),D[1]=G;for(var H=2;H<D.length;H++)D[H]=this.mul(D[H-1],G);var J=D[0],O=0,P=0,R=W.bitLength()%26;if(R===0)R=26;for(H=W.length-1;H>=0;H--){var _=W.words[H];for(var f=R-1;f>=0;f--){var c=_>>f&1;if(J!==D[0])J=this.sqr(J);if(c===0&&O===0){P=0;continue}if(O<<=1,O|=c,P++,P!==C&&(H!==0||f!==0))continue;J=this.mul(J,D[O]),P=0,O=0}R=26}return J},V.prototype.convertTo=function(G){var W=G.umod(this.m);return W===G?W.clone():W},V.prototype.convertFrom=function(G){var W=G.clone();return W.red=null,W},$.mont=function(G){return new I(G)};function I(G){if(V.call(this,G),this.shift=this.m.bitLength(),this.shift%26!==0)this.shift+=26-this.shift%26;this.r=new $(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}F(I,V),I.prototype.convertTo=function(G){return this.imod(G.ushln(this.shift))},I.prototype.convertFrom=function(G){var W=this.imod(G.mul(this.rinv));return W.red=null,W},I.prototype.imul=function(G,W){if(G.isZero()||W.isZero())return G.words[0]=0,G.length=1,G;var C=G.imul(W),D=C.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),H=C.isub(D).iushrn(this.shift),J=H;if(H.cmp(this.m)>=0)J=H.isub(this.m);else if(H.cmpn(0)<0)J=H.iadd(this.m);return J._forceRed(this)},I.prototype.mul=function(G,W){if(G.isZero()||W.isZero())return new $(0)._forceRed(this);var C=G.mul(W),D=C.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),H=C.isub(D).iushrn(this.shift),J=H;if(H.cmp(this.m)>=0)J=H.isub(this.m);else if(H.cmpn(0)<0)J=H.iadd(this.m);return J._forceRed(this)},I.prototype.invm=function(G){var W=this.imod(G._invmp(this.m).mul(this.r2));return W._forceRed(this)}})(typeof Z>"u"||Z,U)}),OV=$0((U,Z)=>{var X=UH(),Q=vX(),K=m1().Buffer;function F(M){var z=M.modulus.byteLength(),T;do T=new X(Q(z));while(T.cmp(M.modulus)>=0||!T.umod(M.prime1)||!T.umod(M.prime2));return T}function $(M){var z=F(M),T=z.toRed(X.mont(M.modulus)).redPow(new X(M.publicExponent)).fromRed();return{blinder:T,unblinder:z.invm(M.modulus)}}function q(M,z){var T=$(z),A=z.modulus.byteLength(),L=new X(M).mul(T.blinder).umod(z.modulus),E=L.toRed(X.mont(z.prime1)),S=L.toRed(X.mont(z.prime2)),j=z.coefficient,k=z.prime1,B=z.prime2,v=E.redPow(z.exponent1).fromRed(),x=S.redPow(z.exponent2).fromRed(),N=v.isub(x).imul(j).umod(k).imul(B);return x.iadd(N).imul(T.unblinder).umod(z.modulus).toArrayLike(K,"be",A)}q.getr=F,Z.exports=q}),ZH=$0((U,Z)=>{var X=WV(),Q=vX(),K=_X(),F=IV(),$=FV(),q=YJ(),M=HV(),z=OV(),T=m1().Buffer;Z.exports=function(S,j,k){var B;if(S.padding)B=S.padding;else if(k)B=1;else B=4;var v=X(S),x;if(B===4)x=A(v,j);else if(B===1)x=L(v,j,k);else if(B===3){if(x=new q(j),x.cmp(v.modulus)>=0)throw Error("data too long for modulus")}else throw Error("unknown padding");if(k)return z(x,v);else return M(x,v)};function A(S,j){var k=S.modulus.byteLength(),B=j.length,v=K("sha1").update(T.alloc(0)).digest(),x=v.length,N=2*x;if(B>k-N-2)throw Error("message too long");var w=T.alloc(k-B-N-2),u=k-x-1,Z0=Q(x),V0=$(T.concat([v,w,T.alloc(1,1),j],u),F(Z0,u)),Y0=$(Z0,F(V0,x));return new q(T.concat([T.alloc(1),Y0,V0],k))}function L(S,j,k){var B=j.length,v=S.modulus.byteLength();if(B>v-11)throw Error("message too long");var x;if(k)x=T.alloc(v-B-3,255);else x=E(v-B-3);return new q(T.concat([T.from([0,k?1:2]),x,T.alloc(1),j],v))}function E(S){var j=T.allocUnsafe(S),k=0,B=Q(S*2),v=0,x;while(k<S){if(v===B.length)B=Q(S*2),v=0;if(x=B[v++],x)j[k++]=x}return j}}),XH=$0((U,Z)=>{var X=WV(),Q=IV(),K=FV(),F=YJ(),$=OV(),q=_X(),M=HV(),z=m1().Buffer;Z.exports=function(E,S,j){var k;if(E.padding)k=E.padding;else if(j)k=1;else k=4;var B=X(E),v=B.modulus.byteLength();if(S.length>v||new F(S).cmp(B.modulus)>=0)throw Error("decryption error");var x;if(j)x=M(new F(S),B);else x=$(S,B);var N=z.alloc(v-x.length);if(x=z.concat([N,x],v),k===4)return T(B,x);else if(k===1)return A(B,x,j);else if(k===3)return x;else throw Error("unknown padding")};function T(E,S){var j=E.modulus.byteLength(),k=q("sha1").update(z.alloc(0)).digest(),B=k.length;if(S[0]!==0)throw Error("decryption error");var v=S.slice(1,B+1),x=S.slice(B+1),N=K(v,Q(x,B)),w=K(x,Q(N,j-B-1));if(L(k,w.slice(0,B)))throw Error("decryption error");var u=B;while(w[u]===0)u++;if(w[u++]!==1)throw Error("decryption error");return w.slice(u)}function A(E,S,j){var k=S.slice(0,2),B=2,v=0;while(S[B++]!==0)if(B>=S.length){v++;break}var x=S.slice(2,B-1);if(k.toString("hex")!=="0002"&&!j||k.toString("hex")!=="0001"&&j)v++;if(x.length<8)v++;if(v)throw Error("decryption error");return S.slice(B)}function L(E,S){E=z.from(E),S=z.from(S);var j=0,k=E.length;if(E.length!==S.length)j++,k=Math.min(E.length,S.length);var B=-1;while(++B<k)j+=E[B]^S[B];return j}}),sY=$0((U)=>{U.publicEncrypt=ZH(),U.privateDecrypt=XH(),U.privateEncrypt=function(Z,X){return U.publicEncrypt(Z,X,!0)},U.publicDecrypt=function(Z,X){return U.privateDecrypt(Z,X,!0)}}),YH=$0((U)=>{var Z=(UU(),m0(e1));if(typeof Z.publicEncrypt!=="function")Z=sY();if(U.publicEncrypt=Z.publicEncrypt,U.privateDecrypt=Z.privateDecrypt,typeof Z.privateEncrypt!=="function")U.privateEncrypt=sY().privateEncrypt;else U.privateEncrypt=Z.privateEncrypt;if(typeof Z.publicDecrypt!=="function")U.publicDecrypt=sY().publicDecrypt;else U.publicDecrypt=Z.publicDecrypt}),JH=$0((U)=>{var Z=m1(),X=vX(),Q=Z.Buffer,K=Z.kMaxLength,F=globalThis.crypto||globalThis.msCrypto,$=Math.pow(2,32)-1;function q(L,E){if(typeof L!=="number"||L!==L)throw TypeError("offset must be a number");if(L>$||L<0)throw TypeError("offset must be a uint32");if(L>K||L>E)throw RangeError("offset out of range")}function M(L,E,S){if(typeof L!=="number"||L!==L)throw TypeError("size must be a number");if(L>$||L<0)throw TypeError("size must be a uint32");if(L+E>S||L>K)throw RangeError("buffer too small")}F&&F.getRandomValues,U.randomFill=z,U.randomFillSync=A;function z(L,E,S,j){if(!Q.isBuffer(L)&&!(L instanceof globalThis.Uint8Array))throw TypeError('"buf" argument must be a Buffer or Uint8Array');if(typeof E==="function")j=E,E=0,S=L.length;else if(typeof S==="function")j=S,S=L.length-E;else if(typeof j!=="function")throw TypeError('"cb" argument must be a function');return q(E,L.length),M(S,E,L.length),T(L,E,S,j)}function T(L,E,S,j){if(!1)var k,B;if(j){X(S,function(x,N){if(x)return j(x);N.copy(L,E),j(null,L)});return}var v=X(S);return v.copy(L,E),L}function A(L,E,S){if(typeof E>"u")E=0;if(!Q.isBuffer(L)&&!(L instanceof globalThis.Uint8Array))throw TypeError('"buf" argument must be a Buffer or Uint8Array');if(q(E,L.length),S===void 0)S=L.length-E;return M(S,E,L.length),T(L,E,S)}}),QH=$0((U,Z)=>{var X=(UU(),m0(e1));if(typeof X.randomFill==="function"&&typeof X.randomFillSync==="function")U.randomFill=X.randomFill,U.randomFillSync=X.randomFillSync;else Z.exports=JH()}),GH=$0((U)=>{U.randomBytes=U.rng=U.pseudoRandomBytes=U.prng=vX(),U.createHash=U.Hash=_X(),U.createHmac=U.Hmac=bG();var Z=_I(),X=Object.keys(Z),Q=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(X);U.getHashes=function(){return Q};var K=eG();U.pbkdf2=K.pbkdf2,U.pbkdf2Sync=K.pbkdf2Sync;var F=FF();U.Cipher=F.Cipher,U.createCipher=F.createCipher,U.Cipheriv=F.Cipheriv,U.createCipheriv=F.createCipheriv,U.Decipher=F.Decipher,U.createDecipher=F.createDecipher,U.Decipheriv=F.Decipheriv,U.createDecipheriv=F.createDecipheriv,U.getCiphers=F.getCiphers,U.listCiphers=F.listCiphers;var $=HF();U.DiffieHellmanGroup=$.DiffieHellmanGroup,U.createDiffieHellmanGroup=$.createDiffieHellmanGroup,U.getDiffieHellman=$.getDiffieHellman,U.createDiffieHellman=$.createDiffieHellman,U.DiffieHellman=$.DiffieHellman;var q=OF();U.createSign=q.createSign,U.Sign=q.Sign,U.createVerify=q.createVerify,U.Verify=q.Verify,U.createECDH=yF();var M=YH();U.publicEncrypt=M.publicEncrypt,U.privateEncrypt=M.privateEncrypt,U.publicDecrypt=M.publicDecrypt,U.privateDecrypt=M.privateDecrypt;var z=QH();U.randomFill=z.randomFill,U.randomFillSync=z.randomFillSync,U.createCredentials=function(){throw Error(`sorry, createCredentials is not implemented yet
|
|
16
16
|
we accept pull requests
|
|
17
|
-
https://github.com/browserify/crypto-browserify`)},U.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6}}),o0=vI(
|
|
17
|
+
https://github.com/browserify/crypto-browserify`)},U.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6}}),o0=vI(GH(),1),VH=o0.prng,$H=o0.pseudoRandomBytes,KH=o0.rng,WH=o0.randomBytes,IH=o0.Hash,FH=o0.createHash,HH=o0.Hmac,OH=o0.createHmac,CH=o0.getHashes,AH=o0.pbkdf2,zH=o0.pbkdf2Sync,DH=o0.Cipher,qH=o0.createCipher,MH=o0.Cipheriv,LH=o0.createCipheriv,TH=o0.Decipher,RH=o0.createDecipher,EH=o0.Decipheriv,SH=o0.createDecipheriv,PH=o0.getCiphers,kH=o0.listCiphers,jH=o0.DiffieHellmanGroup,vH=o0.createDiffieHellmanGroup,_H=o0.getDiffieHellman,BH=o0.createDiffieHellman,xH=o0.DiffieHellman,NH=o0.createSign,gH=o0.Sign,fH=o0.createVerify,wH=o0.Verify,yH=o0.createECDH,cH=o0.publicEncrypt,pH=o0.privateEncrypt,hH=o0.publicDecrypt,uH=o0.privateDecrypt,bH=o0.randomFill,dH=o0.randomFillSync,lH=o0.createCredentials,oH=o0.constants,rH=["p192","p224","p256","p384","p521","curve25519","ed25519","secp256k1","secp224r1","prime256v1","prime192v1","ed25519","secp384r1","secp521r1"];tH=crypto,iH=crypto});var zQ=`from codeop import compile_command
|
|
18
18
|
import sys
|
|
19
19
|
from _pyrepl.console import Console, Event
|
|
20
20
|
from _pyrepl.reader import Reader
|
|
@@ -164,7 +164,18 @@ async def start_repl():
|
|
|
164
164
|
|
|
165
165
|
sys.displayhook = displayhook
|
|
166
166
|
|
|
167
|
-
|
|
167
|
+
def clear():
|
|
168
|
+
browser_console.clear()
|
|
169
|
+
info = getattr(js, "pyreplInfo", "Python 3.13 (Pyodide)")
|
|
170
|
+
browser_console.term.write(f"\\x1b[90m{info}\\x1b[0m\\r\\n")
|
|
171
|
+
|
|
172
|
+
class Exit:
|
|
173
|
+
def __repr__(self):
|
|
174
|
+
return "exit is not available in the browser"
|
|
175
|
+
def __call__(self):
|
|
176
|
+
browser_console.term.write("exit is not available in the browser\\r\\n")
|
|
177
|
+
|
|
178
|
+
repl_globals = {"__builtins__": __builtins__, "clear": clear, "exit": Exit(), "quit": Exit()}
|
|
168
179
|
completer = rlcompleter.Completer(repl_globals)
|
|
169
180
|
|
|
170
181
|
def get_completions(text):
|
|
@@ -209,8 +220,10 @@ async def start_repl():
|
|
|
209
220
|
history_index = max(0, history_index - 1)
|
|
210
221
|
# Clear current line
|
|
211
222
|
browser_console.term.write('\\r\\x1b[K')
|
|
212
|
-
|
|
213
|
-
|
|
223
|
+
hist_entry = history[history_index]
|
|
224
|
+
# For multiline entries, only show first line
|
|
225
|
+
current_line = hist_entry.split('\\n')[0] if '\\n' in hist_entry else hist_entry
|
|
226
|
+
browser_console.term.write("\\x1b[32m>>> \\x1b[0m" + syntax_highlight(current_line))
|
|
214
227
|
elif event3.data == 'B':
|
|
215
228
|
# Down arrow
|
|
216
229
|
if history:
|
|
@@ -218,10 +231,12 @@ async def start_repl():
|
|
|
218
231
|
# Clear current line
|
|
219
232
|
browser_console.term.write('\\r\\x1b[K')
|
|
220
233
|
if history_index < len(history):
|
|
221
|
-
|
|
234
|
+
hist_entry = history[history_index]
|
|
235
|
+
# For multiline entries, only show first line
|
|
236
|
+
current_line = hist_entry.split('\\n')[0] if '\\n' in hist_entry else hist_entry
|
|
222
237
|
else:
|
|
223
238
|
current_line = ""
|
|
224
|
-
browser_console.term.write("\\x1b[32m>>> \\x1b[0m" + current_line)
|
|
239
|
+
browser_console.term.write("\\x1b[32m>>> \\x1b[0m" + syntax_highlight(current_line))
|
|
225
240
|
# Left and Right arrows can be implemented similarly
|
|
226
241
|
continue
|
|
227
242
|
|
|
@@ -248,6 +263,8 @@ async def start_repl():
|
|
|
248
263
|
exec(code, repl_globals)
|
|
249
264
|
history.append(source)
|
|
250
265
|
history_index = len(history)
|
|
266
|
+
except SystemExit:
|
|
267
|
+
pass
|
|
251
268
|
except Exception as e:
|
|
252
269
|
browser_console.term.write(f"\\x1b[31m{type(e).__name__}: {e}\\x1b[0m\\r\\n")
|
|
253
270
|
lines = []
|
|
@@ -272,6 +289,8 @@ async def start_repl():
|
|
|
272
289
|
history_index = len(history)
|
|
273
290
|
try:
|
|
274
291
|
exec(code, repl_globals)
|
|
292
|
+
except SystemExit:
|
|
293
|
+
pass
|
|
275
294
|
except Exception as e:
|
|
276
295
|
browser_console.term.write(f"\\x1b[31m{type(e).__name__}: {e}\\x1b[0m\\r\\n")
|
|
277
296
|
lines = []
|
|
@@ -324,22 +343,22 @@ async def start_repl():
|
|
|
324
343
|
browser_console.term.write('\\r\\x1b[K') # Go to start, clear line
|
|
325
344
|
prompt = "\\x1b[32m>>> \\x1b[0m" if len(lines) == 0 else "\\x1b[32m... \\x1b[0m"
|
|
326
345
|
browser_console.term.write(prompt + syntax_highlight(current_line))
|
|
327
|
-
`;var __dirname="/
|
|
328
|
-
`).filter(function(K){return!!K.match(U)},this);return Q.map(function(K){K.indexOf("(eval ")>-1&&(K=K.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(,.*$)/g,""));var
|
|
329
|
-
`).filter(function(K){return!K.match(Z)},this);return Q.map(function(K){if(K.indexOf(" > eval")>-1&&(K=K.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),K.indexOf("@")===-1&&K.indexOf(":")===-1)return new JJ({functionName:K});var H=/((.*".+"[^@]*)?[^@]*)(?:@)/,$=K.match(H),M=$&&$[1]?$[1]:void 0,q=this.extractLocation(K.replace(H,""));return new JJ({functionName:M,fileName:q[0],lineNumber:q[1],columnNumber:q[2],source:K})},this)},"ErrorStackParser$$parseFFOrSafari")}}p0(MV,"ErrorStackParser");var YO=new MV,JO=YO;function qV(){if(typeof API<"u"&&API!==globalThis.API)return API.runtimeEnv;let U=typeof Bun<"u",Z=typeof Deno<"u",X=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&!1,Q=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent.indexOf("Chrome")===-1&&navigator.userAgent.indexOf("Safari")>-1;return LV({IN_BUN:U,IN_DENO:Z,IN_NODE:X,IN_SAFARI:Q,IN_SHELL:typeof read=="function"&&typeof load=="function"})}p0(qV,"getGlobalRuntimeEnv");var o1=qV();function LV(U){let Z=U.IN_NODE&&typeof AV<"u"&&UA&&typeof zV=="function"&&typeof __dirname=="string",X=U.IN_NODE&&!Z,Q=!U.IN_NODE&&!U.IN_DENO&&!U.IN_BUN,K=Q&&typeof window<"u"&&typeof window.document<"u"&&typeof document.createElement=="function"&&"sessionStorage"in window&&typeof globalThis.importScripts!="function",H=Q&&typeof globalThis.WorkerGlobalScope<"u"&&typeof globalThis.self<"u"&&globalThis.self instanceof globalThis.WorkerGlobalScope;return{...U,IN_BROWSER:Q,IN_BROWSER_MAIN_THREAD:K,IN_BROWSER_WEB_WORKER:H,IN_NODE_COMMONJS:Z,IN_NODE_ESM:X}}p0(LV,"calculateDerivedFlags");var TV,QJ,RV,CV,VJ;async function $J(){if(!o1.IN_NODE||(TV=(await Promise.resolve().then(() => (MY(),DY))).default,CV=await import("node:fs"),VJ=await import("node:fs/promises"),RV=(await import("node:vm")).default,QJ=await Promise.resolve().then(() => (TY(),LY)),KJ=QJ.sep,typeof zV<"u"))return;let U=CV,Z=await Promise.resolve().then(() => (UU(),e1)),X=await import("ws"),Q=await import("node:child_process"),K={fs:U,crypto:Z,ws:X,child_process:Q};globalThis.require=function(H){return K[H]}}p0($J,"initNodeModules");function EV(U,Z){return QJ.resolve(Z||".",U)}p0(EV,"node_resolvePath");function SV(U,Z){return Z===void 0&&(Z=location),new URL(U,Z).toString()}p0(SV,"browser_resolvePath");var lZ;o1.IN_NODE?lZ=EV:o1.IN_SHELL?lZ=p0((U)=>U,"resolvePath"):lZ=SV;var KJ;o1.IN_NODE||(KJ="/");function PV(U,Z){return U.startsWith("file://")&&(U=U.slice(7)),U.includes("://")?{response:fetch(U)}:{binary:VJ.readFile(U).then((X)=>new Uint8Array(X.buffer,X.byteOffset,X.byteLength))}}p0(PV,"node_getBinaryResponse");function kV(U,Z){if(U.startsWith("file://")&&(U=U.slice(7)),U.includes("://"))throw Error("Shell cannot fetch urls");return{binary:Promise.resolve(new Uint8Array(readbuffer(U)))}}p0(kV,"shell_getBinaryResponse");function jV(U,Z){let X=new URL(U,location);return{response:fetch(X,Z?{integrity:Z}:{})}}p0(jV,"browser_getBinaryResponse");var oZ;o1.IN_NODE?oZ=PV:o1.IN_SHELL?oZ=kV:oZ=jV;async function vV(U,Z){let{response:X,binary:Q}=oZ(U,Z);if(Q)return Q;let K=await X;if(!K.ok)throw Error(`Failed to load '${U}': request failed.`);return new Uint8Array(await K.arrayBuffer())}p0(vV,"loadBinaryFile");var bZ;if(o1.IN_BROWSER_MAIN_THREAD)bZ=p0(async(U)=>await import(U),"loadScript");else if(o1.IN_BROWSER_WEB_WORKER)bZ=p0(async(U)=>{try{globalThis.importScripts(U)}catch(Z){if(Z instanceof TypeError)await import(U);else throw Z}},"loadScript");else if(o1.IN_NODE)bZ=_V;else if(o1.IN_SHELL)bZ=load;else throw Error("Cannot determine runtime environment");async function _V(U){U.startsWith("file://")&&(U=U.slice(7)),U.includes("://")?RV.runInThisContext(await(await fetch(U)).text()):await import(TV.pathToFileURL(U).href)}p0(_V,"nodeLoadScript");async function BV(U){if(o1.IN_NODE){await $J();let Z=await VJ.readFile(U,{encoding:"utf8"});return JSON.parse(Z)}else if(o1.IN_SHELL){let Z=read(U);return JSON.parse(Z)}else return await(await fetch(U)).json()}p0(BV,"loadLockFile");async function xV(){if(o1.IN_NODE_COMMONJS)return __dirname;let U;try{throw Error()}catch(Q){U=Q}let Z=JO.parse(U)[0].fileName;if(o1.IN_NODE&&!Z.startsWith("file://")&&(Z=`file://${Z}`),o1.IN_NODE_ESM){let Q=await Promise.resolve().then(() => (TY(),LY));return(await Promise.resolve().then(() => (MY(),DY))).fileURLToPath(Q.dirname(Z))}let X=Z.lastIndexOf(KJ);if(X===-1)throw Error("Could not extract indexURL path from pyodide module location. Please pass the indexURL explicitly to loadPyodide.");return Z.slice(0,X)}p0(xV,"calculateDirname");function NV(U){return U.substring(0,U.lastIndexOf("/")+1)||globalThis.location?.toString()||"."}p0(NV,"calculateInstallBaseUrl");function gV(U){let Z=U.FS,X=U.FS.filesystems.MEMFS,Q=U.PATH,K={DIR_MODE:16895,FILE_MODE:33279,mount:p0(function(H){if(!H.opts.fileSystemHandle)throw Error("opts.fileSystemHandle is required");return X.mount.apply(null,arguments)},"mount"),syncfs:p0(async(H,$,M)=>{try{let q=K.getLocalSet(H),z=await K.getRemoteSet(H),T=$?z:q,A=$?q:z;await K.reconcile(H,T,A),M(null)}catch(q){M(q)}},"syncfs"),getLocalSet:p0((H)=>{let $=Object.create(null);function M(T){return T!=="."&&T!==".."}p0(M,"isRealDir");function q(T){return(A)=>Q.join2(T,A)}p0(q,"toAbsolute");let z=Z.readdir(H.mountpoint).filter(M).map(q(H.mountpoint));for(;z.length;){let T=z.pop(),A=Z.stat(T);Z.isDir(A.mode)&&z.push.apply(z,Z.readdir(T).filter(M).map(q(T))),$[T]={timestamp:A.mtime,mode:A.mode}}return{type:"local",entries:$}},"getLocalSet"),getRemoteSet:p0(async(H)=>{let $=Object.create(null),M=await QO(H.opts.fileSystemHandle);for(let[q,z]of M)q!=="."&&($[Q.join2(H.mountpoint,q)]={timestamp:z.kind==="file"?new Date((await z.getFile()).lastModified):new Date,mode:z.kind==="file"?K.FILE_MODE:K.DIR_MODE});return{type:"remote",entries:$,handles:M}},"getRemoteSet"),loadLocalEntry:p0((H)=>{let $=Z.lookupPath(H,{}).node,M=Z.stat(H);if(Z.isDir(M.mode))return{timestamp:M.mtime,mode:M.mode};if(Z.isFile(M.mode))return $.contents=X.getFileDataAsTypedArray($),{timestamp:M.mtime,mode:M.mode,contents:$.contents};throw Error("node type not supported")},"loadLocalEntry"),storeLocalEntry:p0((H,$)=>{if(Z.isDir($.mode))Z.mkdirTree(H,$.mode);else if(Z.isFile($.mode))Z.writeFile(H,$.contents,{canOwn:!0});else throw Error("node type not supported");Z.chmod(H,$.mode),Z.utime(H,$.timestamp,$.timestamp)},"storeLocalEntry"),removeLocalEntry:p0((H)=>{var $=Z.stat(H);Z.isDir($.mode)?Z.rmdir(H):Z.isFile($.mode)&&Z.unlink(H)},"removeLocalEntry"),loadRemoteEntry:p0(async(H)=>{if(H.kind==="file"){let $=await H.getFile();return{contents:new Uint8Array(await $.arrayBuffer()),mode:K.FILE_MODE,timestamp:new Date($.lastModified)}}else{if(H.kind==="directory")return{mode:K.DIR_MODE,timestamp:new Date};throw Error("unknown kind: "+H.kind)}},"loadRemoteEntry"),storeRemoteEntry:p0(async(H,$,M)=>{let q=H.get(Q.dirname($)),z=Z.isFile(M.mode)?await q.getFileHandle(Q.basename($),{create:!0}):await q.getDirectoryHandle(Q.basename($),{create:!0});if(z.kind==="file"){let T=await z.createWritable();await T.write(M.contents),await T.close()}H.set($,z)},"storeRemoteEntry"),removeRemoteEntry:p0(async(H,$)=>{await H.get(Q.dirname($)).removeEntry(Q.basename($)),H.delete($)},"removeRemoteEntry"),reconcile:p0(async(H,$,M)=>{let q=0,z=[];Object.keys($.entries).forEach(function(L){let E=$.entries[L],S=M.entries[L];(!S||Z.isFile(E.mode)&&E.timestamp.getTime()>S.timestamp.getTime())&&(z.push(L),q++)}),z.sort();let T=[];if(Object.keys(M.entries).forEach(function(L){$.entries[L]||(T.push(L),q++)}),T.sort().reverse(),!q)return;let A=$.type==="remote"?$.handles:M.handles;for(let L of z){let E=Q.normalize(L.replace(H.mountpoint,"/")).substring(1);if(M.type==="local"){let S=A.get(E),j=await K.loadRemoteEntry(S);K.storeLocalEntry(L,j)}else{let S=K.loadLocalEntry(L);await K.storeRemoteEntry(A,E,S)}}for(let L of T)if(M.type==="local")K.removeLocalEntry(L);else{let E=Q.normalize(L.replace(H.mountpoint,"/")).substring(1);await K.removeRemoteEntry(A,E)}},"reconcile")};U.FS.filesystems.NATIVEFS_ASYNC=K}p0(gV,"initializeNativeFS");var QO=p0(async(U)=>{let Z=[];async function X(K){for await(let H of K.values())Z.push(H),H.kind==="directory"&&await X(H)}p0(X,"collect"),await X(U);let Q=new Map;Q.set(".",U);for(let K of Z){let H=(await U.resolve(K)).join("/");Q.set(H,K)}return Q},"getFsHandles"),GO=UO("AGFzbQEAAAABDANfAGAAAW9gAW8BfwMDAgECByECD2NyZWF0ZV9zZW50aW5lbAAAC2lzX3NlbnRpbmVsAAEKEwIHAPsBAPsbCwkAIAD7GvsUAAs="),VO=async function(){if(!(globalThis.navigator&&(/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&typeof navigator.maxTouchPoints<"u"&&navigator.maxTouchPoints>1)))try{let U=await WebAssembly.compile(GO);return await WebAssembly.instantiate(U)}catch(U){if(U instanceof WebAssembly.CompileError)return;throw U}}();async function fV(){let U=await VO;if(U)return U.exports;let Z=Symbol("error marker");return{create_sentinel:p0(()=>Z,"create_sentinel"),is_sentinel:p0((X)=>X===Z,"is_sentinel")}}p0(fV,"getSentinelImport");function wV(U){let Z={config:U,runtimeEnv:o1},X={noImageDecoding:!0,noAudioDecoding:!0,noWasmDecoding:!1,preRun:bV(U),print:U.stdout,printErr:U.stderr,onExit(Q){X.exitCode=Q},thisProgram:U._sysExecutable,arguments:U.args,API:Z,locateFile:p0((Q)=>U.indexURL+Q,"locateFile"),instantiateWasm:dV(U.indexURL)};return X}p0(wV,"createSettings");function yV(U){return function(Z){let X="/";try{Z.FS.mkdirTree(U)}catch(Q){console.error(`Error occurred while making a home directory '${U}':`),console.error(Q),console.error(`Using '${X}' for a home directory instead`),U=X}Z.FS.chdir(U)}}p0(yV,"createHomeDirectory");function cV(U){return function(Z){Object.assign(Z.ENV,U)}}p0(cV,"setEnvironment");function pV(U){return U?[async(Z)=>{Z.addRunDependency("fsInitHook");try{await U(Z.FS,{sitePackages:Z.API.sitePackages})}finally{Z.removeRunDependency("fsInitHook")}}]:[]}p0(pV,"callFsInitHook");function hV(U){let Z=U.HEAPU32[U._Py_Version>>>2],X=Z>>>24&255,Q=Z>>>16&255,K=Z>>>8&255;return[X,Q,K]}p0(hV,"computeVersionTuple");function uV(U){let Z=vV(U);return async(X)=>{X.API.pyVersionTuple=hV(X);let[Q,K]=X.API.pyVersionTuple;X.FS.mkdirTree("/lib"),X.API.sitePackages=`/lib/python${Q}.${K}/site-packages`,X.FS.mkdirTree(X.API.sitePackages),X.addRunDependency("install-stdlib");try{let H=await Z;X.FS.writeFile(`/lib/python${Q}${K}.zip`,H)}catch(H){console.error("Error occurred while installing the standard library:"),console.error(H)}finally{X.removeRunDependency("install-stdlib")}}}p0(uV,"installStdlib");function bV(U){let Z;return U.stdLibURL!=null?Z=U.stdLibURL:Z=U.indexURL+"python_stdlib.zip",[uV(Z),yV(U.env.HOME),cV(U.env),gV,...pV(U.fsInit)]}p0(bV,"getFileSystemInitializationFuncs");function dV(U){if(typeof WasmOffsetConverter<"u")return;let{binary:Z,response:X}=oZ(U+"pyodide.asm.wasm"),Q=fV();return function(K,H){return async function(){K.sentinel=await Q;try{let $;X?$=await WebAssembly.instantiateStreaming(X,K):$=await WebAssembly.instantiate(await Z,K);let{instance:M,module:q}=$;H(M,q)}catch($){console.warn("wasm instantiation failed!"),console.warn($)}}(),{}}}p0(dV,"getInstantiateWasmFunc");var $O="0.29.1";function dZ(U){return U===void 0||U.endsWith("/")?U:U+"/"}p0(dZ,"withTrailingSlash");var GJ=$O;async function lV(U={}){if(await $J(),U.lockFileContents&&U.lockFileURL)throw Error("Can't pass both lockFileContents and lockFileURL");let Z=U.indexURL||await xV();if(Z=dZ(lZ(Z)),U.packageBaseUrl=dZ(U.packageBaseUrl),U.cdnUrl=dZ(U.packageBaseUrl??`https://cdn.jsdelivr.net/pyodide/v${GJ}/full/`),!U.lockFileContents){let K=U.lockFileURL??Z+"pyodide-lock.json";U.lockFileContents=BV(K),U.packageBaseUrl??=NV(K)}U.indexURL=Z,U.packageCacheDir&&(U.packageCacheDir=dZ(lZ(U.packageCacheDir)));let X={fullStdLib:!1,jsglobals:globalThis,stdin:globalThis.prompt?()=>globalThis.prompt():void 0,args:[],env:{},packages:[],packageCacheDir:U.packageBaseUrl,enableRunUntilComplete:!0,checkAPIVersion:!0,BUILD_ID:"15650dcb90bdff1ec9ab10398b799c17113d70be6a0ebf1d1a7d5dc7db9b5b8c"},Q=Object.assign(X,U);return Q.env.HOME??="/home/pyodide",Q.env.PYTHONINSPECT??="1",Q}p0(lV,"initializeConfiguration");function oV(U){let Z=wV(U),X=Z.API;return X.lockFilePromise=Promise.resolve(U.lockFileContents),Z}p0(oV,"createEmscriptenSettings");async function nV(U){if(typeof _createPyodideModule!="function"){let Z=`${U.indexURL}pyodide.asm.js`;await bZ(Z)}}p0(nV,"loadWasmScript");async function mV(U,Z){if(!U._loadSnapshot)return;let X=await U._loadSnapshot,Q=ArrayBuffer.isView(X)?X:new Uint8Array(X);return Z.noInitialRun=!0,Z.INITIAL_MEMORY=Q.length,Q}p0(mV,"prepareSnapshot");async function sV(U){let Z=await _createPyodideModule(U);if(U.exitCode!==void 0)throw new Z.ExitStatus(U.exitCode);return Z}p0(sV,"createPyodideModule");function rV(U,Z){let X=U.API;if(Z.pyproxyToStringRepr&&X.setPyProxyToStringMethod(!0),Z.convertNullToNone&&X.setCompatNullToNone(!0),Z.toJsLiteralMap&&X.setCompatToJsLiteralMap(!0),X.version!==GJ&&Z.checkAPIVersion)throw Error(`Pyodide version does not match: '${GJ}' <==> '${X.version}'. If you updated the Pyodide version, make sure you also updated the 'indexURL' parameter passed to loadPyodide.`);U.locateFile=(Q)=>{throw Q.endsWith(".so")?Error(`Failed to find dynamic library "${Q}"`):Error(`Unexpected call to locateFile("${Q}")`)}}p0(rV,"configureAPI");function aV(U,Z,X){let Q=U.API,K;return Z&&(K=Q.restoreSnapshot(Z)),Q.finalizeBootstrap(K,X._snapshotDeserializer)}p0(aV,"bootstrapPyodide");async function tV(U,Z){let X=U._api;return X.sys.path.insert(0,""),X._pyodide.set_excepthook(),await X.packageIndexReady,X.initializeStreams(Z.stdin,Z.stdout,Z.stderr),U}p0(tV,"finalizeSetup");async function WJ(U={}){let Z=await lV(U),X=oV(Z);await nV(Z);let Q=await mV(Z,X),K=await sV(X);rV(K,Z);let H=aV(K,Q,Z);return await tV(H,Z)}p0(WJ,"loadPyodide");var{defineProperty:ZK,getOwnPropertyDescriptor:KO}=Object,WO=(U,Z)=>{for(var X in Z)ZK(U,X,{get:Z[X],enumerable:!0})},$1=(U,Z,X,Q)=>{for(var K=Q>1?void 0:Q?KO(Z,X):Z,H=U.length-1,$;H>=0;H--)($=U[H])&&(K=(Q?$(Z,X,K):$(K))||K);return Q&&K&&ZK(Z,X,K),K},c0=(U,Z)=>(X,Q)=>Z(X,Q,U),iV="Terminal input",kJ={get:()=>iV,set:(U)=>iV=U},eV="Too much output to announce, navigate to rows manually to read",jJ={get:()=>eV,set:(U)=>eV=U};function IO(U){return U.replace(/\r?\n/g,"\r")}function HO(U,Z){return Z?"\x1B[200~"+U+"\x1B[201~":U}function FO(U,Z){U.clipboardData&&U.clipboardData.setData("text/plain",Z.selectionText),U.preventDefault()}function OO(U,Z,X,Q){if(U.stopPropagation(),U.clipboardData){let K=U.clipboardData.getData("text/plain");XK(K,Z,X,Q)}}function XK(U,Z,X,Q){U=IO(U),U=HO(U,X.decPrivateModes.bracketedPasteMode&&Q.rawOptions.ignoreBracketedPasteMode!==!0),X.triggerDataEvent(U,!0),Z.value=""}function YK(U,Z,X){let Q=X.getBoundingClientRect(),K=U.clientX-Q.left-10,H=U.clientY-Q.top-10;Z.style.width="20px",Z.style.height="20px",Z.style.left=`${K}px`,Z.style.top=`${H}px`,Z.style.zIndex="1000",Z.focus()}function U$(U,Z,X,Q,K){YK(U,Z,X),K&&Q.rightClickSelect(U),Z.value=Q.selectionText,Z.select()}function lU(U){return U>65535?(U-=65536,String.fromCharCode((U>>10)+55296)+String.fromCharCode(U%1024+56320)):String.fromCharCode(U)}function YY(U,Z=0,X=U.length){let Q="";for(let K=Z;K<X;++K){let H=U[K];H>65535?(H-=65536,Q+=String.fromCharCode((H>>10)+55296)+String.fromCharCode(H%1024+56320)):Q+=String.fromCharCode(H)}return Q}var CO=class{constructor(){this._interim=0}clear(){this._interim=0}decode(U,Z){let X=U.length;if(!X)return 0;let Q=0,K=0;if(this._interim){let H=U.charCodeAt(K++);56320<=H&&H<=57343?Z[Q++]=(this._interim-55296)*1024+H-56320+65536:(Z[Q++]=this._interim,Z[Q++]=H),this._interim=0}for(let H=K;H<X;++H){let $=U.charCodeAt(H);if(55296<=$&&$<=56319){if(++H>=X)return this._interim=$,Q;let M=U.charCodeAt(H);56320<=M&&M<=57343?Z[Q++]=($-55296)*1024+M-56320+65536:(Z[Q++]=$,Z[Q++]=M);continue}$!==65279&&(Z[Q++]=$)}return Q}},AO=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(U,Z){let X=U.length;if(!X)return 0;let Q=0,K,H,$,M,q=0,z=0;if(this.interim[0]){let L=!1,E=this.interim[0];E&=(E&224)===192?31:(E&240)===224?15:7;let S=0,j;for(;(j=this.interim[++S]&63)&&S<4;)E<<=6,E|=j;let k=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,B=k-S;for(;z<B;){if(z>=X)return 0;if(j=U[z++],(j&192)!==128){z--,L=!0;break}else this.interim[S++]=j,E<<=6,E|=j&63}L||(k===2?E<128?z--:Z[Q++]=E:k===3?E<2048||E>=55296&&E<=57343||E===65279||(Z[Q++]=E):E<65536||E>1114111||(Z[Q++]=E)),this.interim.fill(0)}let T=X-4,A=z;for(;A<X;){for(;A<T&&!((K=U[A])&128)&&!((H=U[A+1])&128)&&!(($=U[A+2])&128)&&!((M=U[A+3])&128);)Z[Q++]=K,Z[Q++]=H,Z[Q++]=$,Z[Q++]=M,A+=4;if(K=U[A++],K<128)Z[Q++]=K;else if((K&224)===192){if(A>=X)return this.interim[0]=K,Q;if(H=U[A++],(H&192)!==128){A--;continue}if(q=(K&31)<<6|H&63,q<128){A--;continue}Z[Q++]=q}else if((K&240)===224){if(A>=X)return this.interim[0]=K,Q;if(H=U[A++],(H&192)!==128){A--;continue}if(A>=X)return this.interim[0]=K,this.interim[1]=H,Q;if($=U[A++],($&192)!==128){A--;continue}if(q=(K&15)<<12|(H&63)<<6|$&63,q<2048||q>=55296&&q<=57343||q===65279)continue;Z[Q++]=q}else if((K&248)===240){if(A>=X)return this.interim[0]=K,Q;if(H=U[A++],(H&192)!==128){A--;continue}if(A>=X)return this.interim[0]=K,this.interim[1]=H,Q;if($=U[A++],($&192)!==128){A--;continue}if(A>=X)return this.interim[0]=K,this.interim[1]=H,this.interim[2]=$,Q;if(M=U[A++],(M&192)!==128){A--;continue}if(q=(K&7)<<18|(H&63)<<12|($&63)<<6|M&63,q<65536||q>1114111)continue;Z[Q++]=q}}return Q}},JK="",oU=" ",IX=class U{constructor(){this.fg=0,this.bg=0,this.extended=new sX}static toColorRGB(Z){return[Z>>>16&255,Z>>>8&255,Z&255]}static fromColorRGB(Z){return(Z[0]&255)<<16|(Z[1]&255)<<8|Z[2]&255}clone(){let Z=new U;return Z.fg=this.fg,Z.bg=this.bg,Z.extended=this.extended.clone(),Z}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},sX=class U{constructor(Z=0,X=0){this._ext=0,this._urlId=0,this._ext=Z,this._urlId=X}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(Z){this._ext=Z}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(Z){this._ext&=-469762049,this._ext|=Z<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(Z){this._ext&=-67108864,this._ext|=Z&67108863}get urlId(){return this._urlId}set urlId(Z){this._urlId=Z}get underlineVariantOffset(){let Z=(this._ext&3758096384)>>29;return Z<0?Z^4294967288:Z}set underlineVariantOffset(Z){this._ext&=536870911,this._ext|=Z<<29&3758096384}clone(){return new U(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},FU=class U extends IX{constructor(){super(...arguments);this.content=0,this.fg=0,this.bg=0,this.extended=new sX,this.combinedData=""}static fromCharData(Z){let X=new U;return X.setFromCharData(Z),X}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?lU(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(Z){this.fg=Z[0],this.bg=0;let X=!1;if(Z[1].length>2)X=!0;else if(Z[1].length===2){let Q=Z[1].charCodeAt(0);if(55296<=Q&&Q<=56319){let K=Z[1].charCodeAt(1);56320<=K&&K<=57343?this.content=(Q-55296)*1024+K-56320+65536|Z[2]<<22:X=!0}else X=!0}else this.content=Z[1].charCodeAt(0)|Z[2]<<22;X&&(this.combinedData=Z[1],this.content=2097152|Z[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Z$="di$target",vJ="di$dependencies",IJ=new Map;function zO(U){return U[vJ]||[]}function p1(U){if(IJ.has(U))return IJ.get(U);let Z=function(X,Q,K){if(arguments.length!==3)throw Error("@IServiceName-decorator can only be used to decorate a parameter");DO(Z,X,K)};return Z._id=U,IJ.set(U,Z),Z}function DO(U,Z,X){Z[Z$]===Z?Z[vJ].push({id:U,index:X}):(Z[vJ]=[{id:U,index:X}],Z[Z$]=Z)}var r1=p1("BufferService"),QK=p1("CoreMouseService"),KZ=p1("CoreService"),MO=p1("CharsetService"),YQ=p1("InstantiationService"),GK=p1("LogService"),a1=p1("OptionsService"),VK=p1("OscLinkService"),qO=p1("UnicodeService"),HX=p1("DecorationService"),_J=class{constructor(U,Z,X){this._bufferService=U,this._optionsService=Z,this._oscLinkService=X}provideLinks(U,Z){let X=this._bufferService.buffer.lines.get(U-1);if(!X){Z(void 0);return}let Q=[],K=this._optionsService.rawOptions.linkHandler,H=new FU,$=X.getTrimmedLength(),M=-1,q=-1,z=!1;for(let T=0;T<$;T++)if(!(q===-1&&!X.hasContent(T))){if(X.loadCell(T,H),H.hasExtendedAttrs()&&H.extended.urlId)if(q===-1){q=T,M=H.extended.urlId;continue}else z=H.extended.urlId!==M;else q!==-1&&(z=!0);if(z||q!==-1&&T===$-1){let A=this._oscLinkService.getLinkData(M)?.uri;if(A){let L={start:{x:q+1,y:U},end:{x:T+(!z&&T===$-1?1:0),y:U}},E=!1;if(!K?.allowNonHttpProtocols)try{let S=new URL(A);["http:","https:"].includes(S.protocol)||(E=!0)}catch{E=!0}E||Q.push({text:A,range:L,activate:(S,j)=>K?K.activate(S,j,L):LO(S,j),hover:(S,j)=>K?.hover?.(S,j,L),leave:(S,j)=>K?.leave?.(S,j,L)})}z=!1,H.hasExtendedAttrs()&&H.extended.urlId?(q=T,M=H.extended.urlId):(q=-1,M=-1)}}Z(Q)}};_J=$1([c0(0,r1),c0(1,a1),c0(2,VK)],_J);function LO(U,Z){if(confirm(`Do you want to navigate to ${Z}?
|
|
346
|
+
`;var __dirname="/home/runner/work/pyrepl-web/pyrepl-web/node_modules/pyodide";var eH=Object.defineProperty,p0=(U,Z)=>eH(U,"name",{value:Z,configurable:!0}),zV=((U)=>EU)(function(U){return EU.apply(this,arguments)}),UO=(()=>{for(var U=new Uint8Array(128),Z=0;Z<64;Z++)U[Z<26?Z+65:Z<52?Z+71:Z<62?Z-4:Z*4-205]=Z;return(X)=>{for(var Q=X.length,K=new Uint8Array((Q-(X[Q-1]=="=")-(X[Q-2]=="="))*3/4|0),F=0,$=0;F<Q;){var q=U[X.charCodeAt(F++)],M=U[X.charCodeAt(F++)],z=U[X.charCodeAt(F++)],T=U[X.charCodeAt(F++)];K[$++]=q<<2|M>>4,K[$++]=M<<4|z>>2,K[$++]=z<<6|T}return K}})();function DV(U){return!isNaN(parseFloat(U))&&isFinite(U)}p0(DV,"_isNumber");function pU(U){return U.charAt(0).toUpperCase()+U.substring(1)}p0(pU,"_capitalize");function gX(U){return function(){return this[U]}}p0(gX,"_getter");var qZ=["isConstructor","isEval","isNative","isToplevel"],MZ=["columnNumber","lineNumber"],LZ=["fileName","functionName","source"],ZO=["args"],XO=["evalOrigin"],NX=qZ.concat(MZ,LZ,ZO,XO);function JU(U){if(U)for(var Z=0;Z<NX.length;Z++)U[NX[Z]]!==void 0&&this["set"+pU(NX[Z])](U[NX[Z]])}p0(JU,"StackFrame");JU.prototype={getArgs:p0(function(){return this.args},"getArgs"),setArgs:p0(function(U){if(Object.prototype.toString.call(U)!=="[object Array]")throw TypeError("Args must be an Array");this.args=U},"setArgs"),getEvalOrigin:p0(function(){return this.evalOrigin},"getEvalOrigin"),setEvalOrigin:p0(function(U){if(U instanceof JU)this.evalOrigin=U;else if(U instanceof Object)this.evalOrigin=new JU(U);else throw TypeError("Eval Origin must be an Object or StackFrame")},"setEvalOrigin"),toString:p0(function(){var U=this.getFileName()||"",Z=this.getLineNumber()||"",X=this.getColumnNumber()||"",Q=this.getFunctionName()||"";return this.getIsEval()?U?"[eval] ("+U+":"+Z+":"+X+")":"[eval]:"+Z+":"+X:Q?Q+" ("+U+":"+Z+":"+X+")":U+":"+Z+":"+X},"toString")};JU.fromString=p0(function(U){var Z=U.indexOf("("),X=U.lastIndexOf(")"),Q=U.substring(0,Z),K=U.substring(Z+1,X).split(","),F=U.substring(X+1);if(F.indexOf("@")===0)var $=/@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(F,""),q=$[1],M=$[2],z=$[3];return new JU({functionName:Q,args:K||void 0,fileName:q,lineNumber:M||void 0,columnNumber:z||void 0})},"StackFrame$$fromString");for(eU=0;eU<qZ.length;eU++)JU.prototype["get"+pU(qZ[eU])]=gX(qZ[eU]),JU.prototype["set"+pU(qZ[eU])]=function(U){return function(Z){this[U]=!!Z}}(qZ[eU]);var eU;for(UZ=0;UZ<MZ.length;UZ++)JU.prototype["get"+pU(MZ[UZ])]=gX(MZ[UZ]),JU.prototype["set"+pU(MZ[UZ])]=function(U){return function(Z){if(!DV(Z))throw TypeError(U+" must be a Number");this[U]=Number(Z)}}(MZ[UZ]);var UZ;for(ZZ=0;ZZ<LZ.length;ZZ++)JU.prototype["get"+pU(LZ[ZZ])]=gX(LZ[ZZ]),JU.prototype["set"+pU(LZ[ZZ])]=function(U){return function(Z){this[U]=String(Z)}}(LZ[ZZ]);var ZZ,JJ=JU;function qV(){var U=/^\s*at .*(\S+:\d+|\(native\))/m,Z=/^(eval@)?(\[native code])?$/;return{parse:p0(function(X){if(X.stack&&X.stack.match(U))return this.parseV8OrIE(X);if(X.stack)return this.parseFFOrSafari(X);throw Error("Cannot parse given Error object")},"ErrorStackParser$$parse"),extractLocation:p0(function(X){if(X.indexOf(":")===-1)return[X];var Q=/(.+?)(?::(\d+))?(?::(\d+))?$/,K=Q.exec(X.replace(/[()]/g,""));return[K[1],K[2]||void 0,K[3]||void 0]},"ErrorStackParser$$extractLocation"),parseV8OrIE:p0(function(X){var Q=X.stack.split(`
|
|
347
|
+
`).filter(function(K){return!!K.match(U)},this);return Q.map(function(K){K.indexOf("(eval ")>-1&&(K=K.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(,.*$)/g,""));var F=K.replace(/^\s+/,"").replace(/\(eval code/g,"(").replace(/^.*?\s+/,""),$=F.match(/ (\(.+\)$)/);F=$?F.replace($[0],""):F;var q=this.extractLocation($?$[1]:F),M=$&&F||void 0,z=["eval","<anonymous>"].indexOf(q[0])>-1?void 0:q[0];return new JJ({functionName:M,fileName:z,lineNumber:q[1],columnNumber:q[2],source:K})},this)},"ErrorStackParser$$parseV8OrIE"),parseFFOrSafari:p0(function(X){var Q=X.stack.split(`
|
|
348
|
+
`).filter(function(K){return!K.match(Z)},this);return Q.map(function(K){if(K.indexOf(" > eval")>-1&&(K=K.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),K.indexOf("@")===-1&&K.indexOf(":")===-1)return new JJ({functionName:K});var F=/((.*".+"[^@]*)?[^@]*)(?:@)/,$=K.match(F),q=$&&$[1]?$[1]:void 0,M=this.extractLocation(K.replace(F,""));return new JJ({functionName:q,fileName:M[0],lineNumber:M[1],columnNumber:M[2],source:K})},this)},"ErrorStackParser$$parseFFOrSafari")}}p0(qV,"ErrorStackParser");var YO=new qV,JO=YO;function MV(){if(typeof API<"u"&&API!==globalThis.API)return API.runtimeEnv;let U=typeof Bun<"u",Z=typeof Deno<"u",X=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&!1,Q=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent.indexOf("Chrome")===-1&&navigator.userAgent.indexOf("Safari")>-1;return LV({IN_BUN:U,IN_DENO:Z,IN_NODE:X,IN_SAFARI:Q,IN_SHELL:typeof read=="function"&&typeof load=="function"})}p0(MV,"getGlobalRuntimeEnv");var o1=MV();function LV(U){let Z=U.IN_NODE&&typeof AV<"u"&&UA&&typeof zV=="function"&&typeof __dirname=="string",X=U.IN_NODE&&!Z,Q=!U.IN_NODE&&!U.IN_DENO&&!U.IN_BUN,K=Q&&typeof window<"u"&&typeof window.document<"u"&&typeof document.createElement=="function"&&"sessionStorage"in window&&typeof globalThis.importScripts!="function",F=Q&&typeof globalThis.WorkerGlobalScope<"u"&&typeof globalThis.self<"u"&&globalThis.self instanceof globalThis.WorkerGlobalScope;return{...U,IN_BROWSER:Q,IN_BROWSER_MAIN_THREAD:K,IN_BROWSER_WEB_WORKER:F,IN_NODE_COMMONJS:Z,IN_NODE_ESM:X}}p0(LV,"calculateDerivedFlags");var TV,QJ,RV,CV,VJ;async function $J(){if(!o1.IN_NODE||(TV=(await Promise.resolve().then(() => (qY(),DY))).default,CV=await import("node:fs"),VJ=await import("node:fs/promises"),RV=(await import("node:vm")).default,QJ=await Promise.resolve().then(() => (TY(),LY)),KJ=QJ.sep,typeof zV<"u"))return;let U=CV,Z=await Promise.resolve().then(() => (UU(),e1)),X=await import("ws"),Q=await import("node:child_process"),K={fs:U,crypto:Z,ws:X,child_process:Q};globalThis.require=function(F){return K[F]}}p0($J,"initNodeModules");function EV(U,Z){return QJ.resolve(Z||".",U)}p0(EV,"node_resolvePath");function SV(U,Z){return Z===void 0&&(Z=location),new URL(U,Z).toString()}p0(SV,"browser_resolvePath");var lZ;o1.IN_NODE?lZ=EV:o1.IN_SHELL?lZ=p0((U)=>U,"resolvePath"):lZ=SV;var KJ;o1.IN_NODE||(KJ="/");function PV(U,Z){return U.startsWith("file://")&&(U=U.slice(7)),U.includes("://")?{response:fetch(U)}:{binary:VJ.readFile(U).then((X)=>new Uint8Array(X.buffer,X.byteOffset,X.byteLength))}}p0(PV,"node_getBinaryResponse");function kV(U,Z){if(U.startsWith("file://")&&(U=U.slice(7)),U.includes("://"))throw Error("Shell cannot fetch urls");return{binary:Promise.resolve(new Uint8Array(readbuffer(U)))}}p0(kV,"shell_getBinaryResponse");function jV(U,Z){let X=new URL(U,location);return{response:fetch(X,Z?{integrity:Z}:{})}}p0(jV,"browser_getBinaryResponse");var oZ;o1.IN_NODE?oZ=PV:o1.IN_SHELL?oZ=kV:oZ=jV;async function vV(U,Z){let{response:X,binary:Q}=oZ(U,Z);if(Q)return Q;let K=await X;if(!K.ok)throw Error(`Failed to load '${U}': request failed.`);return new Uint8Array(await K.arrayBuffer())}p0(vV,"loadBinaryFile");var bZ;if(o1.IN_BROWSER_MAIN_THREAD)bZ=p0(async(U)=>await import(U),"loadScript");else if(o1.IN_BROWSER_WEB_WORKER)bZ=p0(async(U)=>{try{globalThis.importScripts(U)}catch(Z){if(Z instanceof TypeError)await import(U);else throw Z}},"loadScript");else if(o1.IN_NODE)bZ=_V;else if(o1.IN_SHELL)bZ=load;else throw Error("Cannot determine runtime environment");async function _V(U){U.startsWith("file://")&&(U=U.slice(7)),U.includes("://")?RV.runInThisContext(await(await fetch(U)).text()):await import(TV.pathToFileURL(U).href)}p0(_V,"nodeLoadScript");async function BV(U){if(o1.IN_NODE){await $J();let Z=await VJ.readFile(U,{encoding:"utf8"});return JSON.parse(Z)}else if(o1.IN_SHELL){let Z=read(U);return JSON.parse(Z)}else return await(await fetch(U)).json()}p0(BV,"loadLockFile");async function xV(){if(o1.IN_NODE_COMMONJS)return __dirname;let U;try{throw Error()}catch(Q){U=Q}let Z=JO.parse(U)[0].fileName;if(o1.IN_NODE&&!Z.startsWith("file://")&&(Z=`file://${Z}`),o1.IN_NODE_ESM){let Q=await Promise.resolve().then(() => (TY(),LY));return(await Promise.resolve().then(() => (qY(),DY))).fileURLToPath(Q.dirname(Z))}let X=Z.lastIndexOf(KJ);if(X===-1)throw Error("Could not extract indexURL path from pyodide module location. Please pass the indexURL explicitly to loadPyodide.");return Z.slice(0,X)}p0(xV,"calculateDirname");function NV(U){return U.substring(0,U.lastIndexOf("/")+1)||globalThis.location?.toString()||"."}p0(NV,"calculateInstallBaseUrl");function gV(U){let Z=U.FS,X=U.FS.filesystems.MEMFS,Q=U.PATH,K={DIR_MODE:16895,FILE_MODE:33279,mount:p0(function(F){if(!F.opts.fileSystemHandle)throw Error("opts.fileSystemHandle is required");return X.mount.apply(null,arguments)},"mount"),syncfs:p0(async(F,$,q)=>{try{let M=K.getLocalSet(F),z=await K.getRemoteSet(F),T=$?z:M,A=$?M:z;await K.reconcile(F,T,A),q(null)}catch(M){q(M)}},"syncfs"),getLocalSet:p0((F)=>{let $=Object.create(null);function q(T){return T!=="."&&T!==".."}p0(q,"isRealDir");function M(T){return(A)=>Q.join2(T,A)}p0(M,"toAbsolute");let z=Z.readdir(F.mountpoint).filter(q).map(M(F.mountpoint));for(;z.length;){let T=z.pop(),A=Z.stat(T);Z.isDir(A.mode)&&z.push.apply(z,Z.readdir(T).filter(q).map(M(T))),$[T]={timestamp:A.mtime,mode:A.mode}}return{type:"local",entries:$}},"getLocalSet"),getRemoteSet:p0(async(F)=>{let $=Object.create(null),q=await QO(F.opts.fileSystemHandle);for(let[M,z]of q)M!=="."&&($[Q.join2(F.mountpoint,M)]={timestamp:z.kind==="file"?new Date((await z.getFile()).lastModified):new Date,mode:z.kind==="file"?K.FILE_MODE:K.DIR_MODE});return{type:"remote",entries:$,handles:q}},"getRemoteSet"),loadLocalEntry:p0((F)=>{let $=Z.lookupPath(F,{}).node,q=Z.stat(F);if(Z.isDir(q.mode))return{timestamp:q.mtime,mode:q.mode};if(Z.isFile(q.mode))return $.contents=X.getFileDataAsTypedArray($),{timestamp:q.mtime,mode:q.mode,contents:$.contents};throw Error("node type not supported")},"loadLocalEntry"),storeLocalEntry:p0((F,$)=>{if(Z.isDir($.mode))Z.mkdirTree(F,$.mode);else if(Z.isFile($.mode))Z.writeFile(F,$.contents,{canOwn:!0});else throw Error("node type not supported");Z.chmod(F,$.mode),Z.utime(F,$.timestamp,$.timestamp)},"storeLocalEntry"),removeLocalEntry:p0((F)=>{var $=Z.stat(F);Z.isDir($.mode)?Z.rmdir(F):Z.isFile($.mode)&&Z.unlink(F)},"removeLocalEntry"),loadRemoteEntry:p0(async(F)=>{if(F.kind==="file"){let $=await F.getFile();return{contents:new Uint8Array(await $.arrayBuffer()),mode:K.FILE_MODE,timestamp:new Date($.lastModified)}}else{if(F.kind==="directory")return{mode:K.DIR_MODE,timestamp:new Date};throw Error("unknown kind: "+F.kind)}},"loadRemoteEntry"),storeRemoteEntry:p0(async(F,$,q)=>{let M=F.get(Q.dirname($)),z=Z.isFile(q.mode)?await M.getFileHandle(Q.basename($),{create:!0}):await M.getDirectoryHandle(Q.basename($),{create:!0});if(z.kind==="file"){let T=await z.createWritable();await T.write(q.contents),await T.close()}F.set($,z)},"storeRemoteEntry"),removeRemoteEntry:p0(async(F,$)=>{await F.get(Q.dirname($)).removeEntry(Q.basename($)),F.delete($)},"removeRemoteEntry"),reconcile:p0(async(F,$,q)=>{let M=0,z=[];Object.keys($.entries).forEach(function(L){let E=$.entries[L],S=q.entries[L];(!S||Z.isFile(E.mode)&&E.timestamp.getTime()>S.timestamp.getTime())&&(z.push(L),M++)}),z.sort();let T=[];if(Object.keys(q.entries).forEach(function(L){$.entries[L]||(T.push(L),M++)}),T.sort().reverse(),!M)return;let A=$.type==="remote"?$.handles:q.handles;for(let L of z){let E=Q.normalize(L.replace(F.mountpoint,"/")).substring(1);if(q.type==="local"){let S=A.get(E),j=await K.loadRemoteEntry(S);K.storeLocalEntry(L,j)}else{let S=K.loadLocalEntry(L);await K.storeRemoteEntry(A,E,S)}}for(let L of T)if(q.type==="local")K.removeLocalEntry(L);else{let E=Q.normalize(L.replace(F.mountpoint,"/")).substring(1);await K.removeRemoteEntry(A,E)}},"reconcile")};U.FS.filesystems.NATIVEFS_ASYNC=K}p0(gV,"initializeNativeFS");var QO=p0(async(U)=>{let Z=[];async function X(K){for await(let F of K.values())Z.push(F),F.kind==="directory"&&await X(F)}p0(X,"collect"),await X(U);let Q=new Map;Q.set(".",U);for(let K of Z){let F=(await U.resolve(K)).join("/");Q.set(F,K)}return Q},"getFsHandles"),GO=UO("AGFzbQEAAAABDANfAGAAAW9gAW8BfwMDAgECByECD2NyZWF0ZV9zZW50aW5lbAAAC2lzX3NlbnRpbmVsAAEKEwIHAPsBAPsbCwkAIAD7GvsUAAs="),VO=async function(){if(!(globalThis.navigator&&(/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&typeof navigator.maxTouchPoints<"u"&&navigator.maxTouchPoints>1)))try{let U=await WebAssembly.compile(GO);return await WebAssembly.instantiate(U)}catch(U){if(U instanceof WebAssembly.CompileError)return;throw U}}();async function fV(){let U=await VO;if(U)return U.exports;let Z=Symbol("error marker");return{create_sentinel:p0(()=>Z,"create_sentinel"),is_sentinel:p0((X)=>X===Z,"is_sentinel")}}p0(fV,"getSentinelImport");function wV(U){let Z={config:U,runtimeEnv:o1},X={noImageDecoding:!0,noAudioDecoding:!0,noWasmDecoding:!1,preRun:bV(U),print:U.stdout,printErr:U.stderr,onExit(Q){X.exitCode=Q},thisProgram:U._sysExecutable,arguments:U.args,API:Z,locateFile:p0((Q)=>U.indexURL+Q,"locateFile"),instantiateWasm:dV(U.indexURL)};return X}p0(wV,"createSettings");function yV(U){return function(Z){let X="/";try{Z.FS.mkdirTree(U)}catch(Q){console.error(`Error occurred while making a home directory '${U}':`),console.error(Q),console.error(`Using '${X}' for a home directory instead`),U=X}Z.FS.chdir(U)}}p0(yV,"createHomeDirectory");function cV(U){return function(Z){Object.assign(Z.ENV,U)}}p0(cV,"setEnvironment");function pV(U){return U?[async(Z)=>{Z.addRunDependency("fsInitHook");try{await U(Z.FS,{sitePackages:Z.API.sitePackages})}finally{Z.removeRunDependency("fsInitHook")}}]:[]}p0(pV,"callFsInitHook");function hV(U){let Z=U.HEAPU32[U._Py_Version>>>2],X=Z>>>24&255,Q=Z>>>16&255,K=Z>>>8&255;return[X,Q,K]}p0(hV,"computeVersionTuple");function uV(U){let Z=vV(U);return async(X)=>{X.API.pyVersionTuple=hV(X);let[Q,K]=X.API.pyVersionTuple;X.FS.mkdirTree("/lib"),X.API.sitePackages=`/lib/python${Q}.${K}/site-packages`,X.FS.mkdirTree(X.API.sitePackages),X.addRunDependency("install-stdlib");try{let F=await Z;X.FS.writeFile(`/lib/python${Q}${K}.zip`,F)}catch(F){console.error("Error occurred while installing the standard library:"),console.error(F)}finally{X.removeRunDependency("install-stdlib")}}}p0(uV,"installStdlib");function bV(U){let Z;return U.stdLibURL!=null?Z=U.stdLibURL:Z=U.indexURL+"python_stdlib.zip",[uV(Z),yV(U.env.HOME),cV(U.env),gV,...pV(U.fsInit)]}p0(bV,"getFileSystemInitializationFuncs");function dV(U){if(typeof WasmOffsetConverter<"u")return;let{binary:Z,response:X}=oZ(U+"pyodide.asm.wasm"),Q=fV();return function(K,F){return async function(){K.sentinel=await Q;try{let $;X?$=await WebAssembly.instantiateStreaming(X,K):$=await WebAssembly.instantiate(await Z,K);let{instance:q,module:M}=$;F(q,M)}catch($){console.warn("wasm instantiation failed!"),console.warn($)}}(),{}}}p0(dV,"getInstantiateWasmFunc");var $O="0.29.1";function dZ(U){return U===void 0||U.endsWith("/")?U:U+"/"}p0(dZ,"withTrailingSlash");var GJ=$O;async function lV(U={}){if(await $J(),U.lockFileContents&&U.lockFileURL)throw Error("Can't pass both lockFileContents and lockFileURL");let Z=U.indexURL||await xV();if(Z=dZ(lZ(Z)),U.packageBaseUrl=dZ(U.packageBaseUrl),U.cdnUrl=dZ(U.packageBaseUrl??`https://cdn.jsdelivr.net/pyodide/v${GJ}/full/`),!U.lockFileContents){let K=U.lockFileURL??Z+"pyodide-lock.json";U.lockFileContents=BV(K),U.packageBaseUrl??=NV(K)}U.indexURL=Z,U.packageCacheDir&&(U.packageCacheDir=dZ(lZ(U.packageCacheDir)));let X={fullStdLib:!1,jsglobals:globalThis,stdin:globalThis.prompt?()=>globalThis.prompt():void 0,args:[],env:{},packages:[],packageCacheDir:U.packageBaseUrl,enableRunUntilComplete:!0,checkAPIVersion:!0,BUILD_ID:"15650dcb90bdff1ec9ab10398b799c17113d70be6a0ebf1d1a7d5dc7db9b5b8c"},Q=Object.assign(X,U);return Q.env.HOME??="/home/pyodide",Q.env.PYTHONINSPECT??="1",Q}p0(lV,"initializeConfiguration");function oV(U){let Z=wV(U),X=Z.API;return X.lockFilePromise=Promise.resolve(U.lockFileContents),Z}p0(oV,"createEmscriptenSettings");async function nV(U){if(typeof _createPyodideModule!="function"){let Z=`${U.indexURL}pyodide.asm.js`;await bZ(Z)}}p0(nV,"loadWasmScript");async function mV(U,Z){if(!U._loadSnapshot)return;let X=await U._loadSnapshot,Q=ArrayBuffer.isView(X)?X:new Uint8Array(X);return Z.noInitialRun=!0,Z.INITIAL_MEMORY=Q.length,Q}p0(mV,"prepareSnapshot");async function sV(U){let Z=await _createPyodideModule(U);if(U.exitCode!==void 0)throw new Z.ExitStatus(U.exitCode);return Z}p0(sV,"createPyodideModule");function rV(U,Z){let X=U.API;if(Z.pyproxyToStringRepr&&X.setPyProxyToStringMethod(!0),Z.convertNullToNone&&X.setCompatNullToNone(!0),Z.toJsLiteralMap&&X.setCompatToJsLiteralMap(!0),X.version!==GJ&&Z.checkAPIVersion)throw Error(`Pyodide version does not match: '${GJ}' <==> '${X.version}'. If you updated the Pyodide version, make sure you also updated the 'indexURL' parameter passed to loadPyodide.`);U.locateFile=(Q)=>{throw Q.endsWith(".so")?Error(`Failed to find dynamic library "${Q}"`):Error(`Unexpected call to locateFile("${Q}")`)}}p0(rV,"configureAPI");function aV(U,Z,X){let Q=U.API,K;return Z&&(K=Q.restoreSnapshot(Z)),Q.finalizeBootstrap(K,X._snapshotDeserializer)}p0(aV,"bootstrapPyodide");async function tV(U,Z){let X=U._api;return X.sys.path.insert(0,""),X._pyodide.set_excepthook(),await X.packageIndexReady,X.initializeStreams(Z.stdin,Z.stdout,Z.stderr),U}p0(tV,"finalizeSetup");async function WJ(U={}){let Z=await lV(U),X=oV(Z);await nV(Z);let Q=await mV(Z,X),K=await sV(X);rV(K,Z);let F=aV(K,Q,Z);return await tV(F,Z)}p0(WJ,"loadPyodide");var{defineProperty:ZK,getOwnPropertyDescriptor:KO}=Object,WO=(U,Z)=>{for(var X in Z)ZK(U,X,{get:Z[X],enumerable:!0})},$1=(U,Z,X,Q)=>{for(var K=Q>1?void 0:Q?KO(Z,X):Z,F=U.length-1,$;F>=0;F--)($=U[F])&&(K=(Q?$(Z,X,K):$(K))||K);return Q&&K&&ZK(Z,X,K),K},c0=(U,Z)=>(X,Q)=>Z(X,Q,U),iV="Terminal input",kJ={get:()=>iV,set:(U)=>iV=U},eV="Too much output to announce, navigate to rows manually to read",jJ={get:()=>eV,set:(U)=>eV=U};function IO(U){return U.replace(/\r?\n/g,"\r")}function FO(U,Z){return Z?"\x1B[200~"+U+"\x1B[201~":U}function HO(U,Z){U.clipboardData&&U.clipboardData.setData("text/plain",Z.selectionText),U.preventDefault()}function OO(U,Z,X,Q){if(U.stopPropagation(),U.clipboardData){let K=U.clipboardData.getData("text/plain");XK(K,Z,X,Q)}}function XK(U,Z,X,Q){U=IO(U),U=FO(U,X.decPrivateModes.bracketedPasteMode&&Q.rawOptions.ignoreBracketedPasteMode!==!0),X.triggerDataEvent(U,!0),Z.value=""}function YK(U,Z,X){let Q=X.getBoundingClientRect(),K=U.clientX-Q.left-10,F=U.clientY-Q.top-10;Z.style.width="20px",Z.style.height="20px",Z.style.left=`${K}px`,Z.style.top=`${F}px`,Z.style.zIndex="1000",Z.focus()}function U$(U,Z,X,Q,K){YK(U,Z,X),K&&Q.rightClickSelect(U),Z.value=Q.selectionText,Z.select()}function lU(U){return U>65535?(U-=65536,String.fromCharCode((U>>10)+55296)+String.fromCharCode(U%1024+56320)):String.fromCharCode(U)}function YY(U,Z=0,X=U.length){let Q="";for(let K=Z;K<X;++K){let F=U[K];F>65535?(F-=65536,Q+=String.fromCharCode((F>>10)+55296)+String.fromCharCode(F%1024+56320)):Q+=String.fromCharCode(F)}return Q}var CO=class{constructor(){this._interim=0}clear(){this._interim=0}decode(U,Z){let X=U.length;if(!X)return 0;let Q=0,K=0;if(this._interim){let F=U.charCodeAt(K++);56320<=F&&F<=57343?Z[Q++]=(this._interim-55296)*1024+F-56320+65536:(Z[Q++]=this._interim,Z[Q++]=F),this._interim=0}for(let F=K;F<X;++F){let $=U.charCodeAt(F);if(55296<=$&&$<=56319){if(++F>=X)return this._interim=$,Q;let q=U.charCodeAt(F);56320<=q&&q<=57343?Z[Q++]=($-55296)*1024+q-56320+65536:(Z[Q++]=$,Z[Q++]=q);continue}$!==65279&&(Z[Q++]=$)}return Q}},AO=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(U,Z){let X=U.length;if(!X)return 0;let Q=0,K,F,$,q,M=0,z=0;if(this.interim[0]){let L=!1,E=this.interim[0];E&=(E&224)===192?31:(E&240)===224?15:7;let S=0,j;for(;(j=this.interim[++S]&63)&&S<4;)E<<=6,E|=j;let k=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,B=k-S;for(;z<B;){if(z>=X)return 0;if(j=U[z++],(j&192)!==128){z--,L=!0;break}else this.interim[S++]=j,E<<=6,E|=j&63}L||(k===2?E<128?z--:Z[Q++]=E:k===3?E<2048||E>=55296&&E<=57343||E===65279||(Z[Q++]=E):E<65536||E>1114111||(Z[Q++]=E)),this.interim.fill(0)}let T=X-4,A=z;for(;A<X;){for(;A<T&&!((K=U[A])&128)&&!((F=U[A+1])&128)&&!(($=U[A+2])&128)&&!((q=U[A+3])&128);)Z[Q++]=K,Z[Q++]=F,Z[Q++]=$,Z[Q++]=q,A+=4;if(K=U[A++],K<128)Z[Q++]=K;else if((K&224)===192){if(A>=X)return this.interim[0]=K,Q;if(F=U[A++],(F&192)!==128){A--;continue}if(M=(K&31)<<6|F&63,M<128){A--;continue}Z[Q++]=M}else if((K&240)===224){if(A>=X)return this.interim[0]=K,Q;if(F=U[A++],(F&192)!==128){A--;continue}if(A>=X)return this.interim[0]=K,this.interim[1]=F,Q;if($=U[A++],($&192)!==128){A--;continue}if(M=(K&15)<<12|(F&63)<<6|$&63,M<2048||M>=55296&&M<=57343||M===65279)continue;Z[Q++]=M}else if((K&248)===240){if(A>=X)return this.interim[0]=K,Q;if(F=U[A++],(F&192)!==128){A--;continue}if(A>=X)return this.interim[0]=K,this.interim[1]=F,Q;if($=U[A++],($&192)!==128){A--;continue}if(A>=X)return this.interim[0]=K,this.interim[1]=F,this.interim[2]=$,Q;if(q=U[A++],(q&192)!==128){A--;continue}if(M=(K&7)<<18|(F&63)<<12|($&63)<<6|q&63,M<65536||M>1114111)continue;Z[Q++]=M}}return Q}},JK="",oU=" ",IX=class U{constructor(){this.fg=0,this.bg=0,this.extended=new sX}static toColorRGB(Z){return[Z>>>16&255,Z>>>8&255,Z&255]}static fromColorRGB(Z){return(Z[0]&255)<<16|(Z[1]&255)<<8|Z[2]&255}clone(){let Z=new U;return Z.fg=this.fg,Z.bg=this.bg,Z.extended=this.extended.clone(),Z}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},sX=class U{constructor(Z=0,X=0){this._ext=0,this._urlId=0,this._ext=Z,this._urlId=X}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(Z){this._ext=Z}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(Z){this._ext&=-469762049,this._ext|=Z<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(Z){this._ext&=-67108864,this._ext|=Z&67108863}get urlId(){return this._urlId}set urlId(Z){this._urlId=Z}get underlineVariantOffset(){let Z=(this._ext&3758096384)>>29;return Z<0?Z^4294967288:Z}set underlineVariantOffset(Z){this._ext&=536870911,this._ext|=Z<<29&3758096384}clone(){return new U(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},HU=class U extends IX{constructor(){super(...arguments);this.content=0,this.fg=0,this.bg=0,this.extended=new sX,this.combinedData=""}static fromCharData(Z){let X=new U;return X.setFromCharData(Z),X}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?lU(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(Z){this.fg=Z[0],this.bg=0;let X=!1;if(Z[1].length>2)X=!0;else if(Z[1].length===2){let Q=Z[1].charCodeAt(0);if(55296<=Q&&Q<=56319){let K=Z[1].charCodeAt(1);56320<=K&&K<=57343?this.content=(Q-55296)*1024+K-56320+65536|Z[2]<<22:X=!0}else X=!0}else this.content=Z[1].charCodeAt(0)|Z[2]<<22;X&&(this.combinedData=Z[1],this.content=2097152|Z[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Z$="di$target",vJ="di$dependencies",IJ=new Map;function zO(U){return U[vJ]||[]}function p1(U){if(IJ.has(U))return IJ.get(U);let Z=function(X,Q,K){if(arguments.length!==3)throw Error("@IServiceName-decorator can only be used to decorate a parameter");DO(Z,X,K)};return Z._id=U,IJ.set(U,Z),Z}function DO(U,Z,X){Z[Z$]===Z?Z[vJ].push({id:U,index:X}):(Z[vJ]=[{id:U,index:X}],Z[Z$]=Z)}var r1=p1("BufferService"),QK=p1("CoreMouseService"),KZ=p1("CoreService"),qO=p1("CharsetService"),YQ=p1("InstantiationService"),GK=p1("LogService"),a1=p1("OptionsService"),VK=p1("OscLinkService"),MO=p1("UnicodeService"),FX=p1("DecorationService"),_J=class{constructor(U,Z,X){this._bufferService=U,this._optionsService=Z,this._oscLinkService=X}provideLinks(U,Z){let X=this._bufferService.buffer.lines.get(U-1);if(!X){Z(void 0);return}let Q=[],K=this._optionsService.rawOptions.linkHandler,F=new HU,$=X.getTrimmedLength(),q=-1,M=-1,z=!1;for(let T=0;T<$;T++)if(!(M===-1&&!X.hasContent(T))){if(X.loadCell(T,F),F.hasExtendedAttrs()&&F.extended.urlId)if(M===-1){M=T,q=F.extended.urlId;continue}else z=F.extended.urlId!==q;else M!==-1&&(z=!0);if(z||M!==-1&&T===$-1){let A=this._oscLinkService.getLinkData(q)?.uri;if(A){let L={start:{x:M+1,y:U},end:{x:T+(!z&&T===$-1?1:0),y:U}},E=!1;if(!K?.allowNonHttpProtocols)try{let S=new URL(A);["http:","https:"].includes(S.protocol)||(E=!0)}catch{E=!0}E||Q.push({text:A,range:L,activate:(S,j)=>K?K.activate(S,j,L):LO(S,j),hover:(S,j)=>K?.hover?.(S,j,L),leave:(S,j)=>K?.leave?.(S,j,L)})}z=!1,F.hasExtendedAttrs()&&F.extended.urlId?(M=T,q=F.extended.urlId):(M=-1,q=-1)}}Z(Q)}};_J=$1([c0(0,r1),c0(1,a1),c0(2,VK)],_J);function LO(U,Z){if(confirm(`Do you want to navigate to ${Z}?
|
|
330
349
|
|
|
331
350
|
WARNING: This link could potentially be dangerous`)){let X=window.open();if(X){try{X.opener=null}catch{}X.location.href=Z}else console.warn("Opening link blocked as opener could not be cleared")}}var JY=p1("CharSizeService"),NU=p1("CoreBrowserService"),JQ=p1("MouseService"),gU=p1("RenderService"),TO=p1("SelectionService"),$K=p1("CharacterJoinerService"),SZ=p1("ThemeService"),KK=p1("LinkProviderService"),RO=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(U){setTimeout(()=>{throw U.stack?X$.isErrorNoTelemetry(U)?new X$(U.message+`
|
|
332
351
|
|
|
333
352
|
`+U.stack):Error(U.message+`
|
|
334
353
|
|
|
335
|
-
`+U.stack):U},0)}}addListener(U){return this.listeners.push(U),()=>{this._removeListener(U)}}emit(U){this.listeners.forEach((Z)=>{Z(U)})}_removeListener(U){this.listeners.splice(this.listeners.indexOf(U),1)}setUnexpectedErrorHandler(U){this.unexpectedErrorHandler=U}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(U){this.unexpectedErrorHandler(U),this.emit(U)}onUnexpectedExternalError(U){this.unexpectedErrorHandler(U)}},EO=new RO;function hX(U){SO(U)||EO.onUnexpectedError(U)}var BJ="Canceled";function SO(U){return U instanceof PO?!0:U instanceof Error&&U.name===BJ&&U.message===BJ}var PO=class extends Error{constructor(){super(BJ),this.name=this.message}};function kO(U){return U?Error(`Illegal argument: ${U}`):Error("Illegal argument")}var X$=class U extends Error{constructor(Z){super(Z),this.name="CodeExpectedError"}static fromError(Z){if(Z instanceof U)return Z;let X=new U;return X.message=Z.message,X.stack=Z.stack,X}static isErrorNoTelemetry(Z){return Z.name==="CodeExpectedError"}},xJ=class U extends Error{constructor(Z){super(Z||"An unexpected bug occurred."),Object.setPrototypeOf(this,U.prototype)}};function jO(U,Z,X=0,Q=U.length){let K=X,
|
|
336
|
-
`).map((A)=>A.trim().replace("at ","")).filter((A)=>A!=="");return z(T,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),T.reverse()}let
|
|
337
|
-
`),
|
|
338
|
-
`)).size}/${Q.length} leaks) at ${L}`;let E=
|
|
354
|
+
`+U.stack):U},0)}}addListener(U){return this.listeners.push(U),()=>{this._removeListener(U)}}emit(U){this.listeners.forEach((Z)=>{Z(U)})}_removeListener(U){this.listeners.splice(this.listeners.indexOf(U),1)}setUnexpectedErrorHandler(U){this.unexpectedErrorHandler=U}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(U){this.unexpectedErrorHandler(U),this.emit(U)}onUnexpectedExternalError(U){this.unexpectedErrorHandler(U)}},EO=new RO;function hX(U){SO(U)||EO.onUnexpectedError(U)}var BJ="Canceled";function SO(U){return U instanceof PO?!0:U instanceof Error&&U.name===BJ&&U.message===BJ}var PO=class extends Error{constructor(){super(BJ),this.name=this.message}};function kO(U){return U?Error(`Illegal argument: ${U}`):Error("Illegal argument")}var X$=class U extends Error{constructor(Z){super(Z),this.name="CodeExpectedError"}static fromError(Z){if(Z instanceof U)return Z;let X=new U;return X.message=Z.message,X.stack=Z.stack,X}static isErrorNoTelemetry(Z){return Z.name==="CodeExpectedError"}},xJ=class U extends Error{constructor(Z){super(Z||"An unexpected bug occurred."),Object.setPrototypeOf(this,U.prototype)}};function jO(U,Z,X=0,Q=U.length){let K=X,F=Q;for(;K<F;){let $=Math.floor((K+F)/2);Z(U[$])?K=$+1:F=$}return K-1}var vO=class U{constructor(Z){this._array=Z,this._findLastMonotonousLastIdx=0}findLastMonotonous(Z){if(U.assertInvariants){if(this._prevFindLastPredicate){for(let Q of this._array)if(this._prevFindLastPredicate(Q)&&!Z(Q))throw Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=Z}let X=jO(this._array,Z,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=X+1,X===-1?void 0:this._array[X]}};vO.assertInvariants=!1;function QU(U,Z=0){return U[U.length-(1+Z)]}var WK;((U)=>{function Z(F){return F<0}U.isLessThan=Z;function X(F){return F<=0}U.isLessThanOrEqual=X;function Q(F){return F>0}U.isGreaterThan=Q;function K(F){return F===0}U.isNeitherLessOrGreaterThan=K,U.greaterThan=1,U.lessThan=-1,U.neitherLessOrGreaterThan=0})(WK||={});function _O(U,Z){return(X,Q)=>Z(U(X),U(Q))}var BO=(U,Z)=>U-Z,Y$=class U{constructor(Z){this.iterate=Z}forEach(Z){this.iterate((X)=>(Z(X),!0))}toArray(){let Z=[];return this.iterate((X)=>(Z.push(X),!0)),Z}filter(Z){return new U((X)=>this.iterate((Q)=>Z(Q)?X(Q):!0))}map(Z){return new U((X)=>this.iterate((Q)=>X(Z(Q))))}some(Z){let X=!1;return this.iterate((Q)=>(X=Z(Q),!X)),X}findFirst(Z){let X;return this.iterate((Q)=>Z(Q)?(X=Q,!1):!0),X}findLast(Z){let X;return this.iterate((Q)=>(Z(Q)&&(X=Q),!0)),X}findLastMaxBy(Z){let X,Q=!0;return this.iterate((K)=>((Q||WK.isGreaterThan(Z(K,X)))&&(Q=!1,X=K),!0)),X}};Y$.empty=new Y$((U)=>{});function xO(U,Z){let X=Object.create(null);for(let Q of U){let K=Z(Q),F=X[K];F||(F=X[K]=[]),F.push(Q)}return X}var J$,Q$,XA=class{constructor(U,Z){this.toKey=Z,this._map=new Map,this[J$]="SetWithKey";for(let X of U)this.add(X)}get size(){return this._map.size}add(U){let Z=this.toKey(U);return this._map.set(Z,U),this}delete(U){return this._map.delete(this.toKey(U))}has(U){return this._map.has(this.toKey(U))}*entries(){for(let U of this._map.values())yield[U,U]}keys(){return this.values()}*values(){for(let U of this._map.values())yield U}clear(){this._map.clear()}forEach(U,Z){this._map.forEach((X)=>U.call(Z,X,X,this))}[(Q$=Symbol.iterator,J$=Symbol.toStringTag,Q$)](){return this.values()}},NO=class{constructor(){this.map=new Map}add(U,Z){let X=this.map.get(U);X||(X=new Set,this.map.set(U,X)),X.add(Z)}delete(U,Z){let X=this.map.get(U);X&&(X.delete(Z),X.size===0&&this.map.delete(U))}forEach(U,Z){let X=this.map.get(U);X&&X.forEach(Z)}get(U){return this.map.get(U)||new Set}};function gO(U,Z){let X=this,Q=!1,K;return function(){if(Q)return K;if(Q=!0,Z)try{K=U.apply(X,arguments)}finally{Z()}else K=U.apply(X,arguments);return K}}var IK;((U)=>{function Z(N){return N&&typeof N=="object"&&typeof N[Symbol.iterator]=="function"}U.is=Z;let X=Object.freeze([]);function Q(){return X}U.empty=Q;function*K(N){yield N}U.single=K;function F(N){return Z(N)?N:K(N)}U.wrap=F;function $(N){return N||X}U.from=$;function*q(N){for(let w=N.length-1;w>=0;w--)yield N[w]}U.reverse=q;function M(N){return!N||N[Symbol.iterator]().next().done===!0}U.isEmpty=M;function z(N){return N[Symbol.iterator]().next().value}U.first=z;function T(N,w){let u=0;for(let Z0 of N)if(w(Z0,u++))return!0;return!1}U.some=T;function A(N,w){for(let u of N)if(w(u))return u}U.find=A;function*L(N,w){for(let u of N)w(u)&&(yield u)}U.filter=L;function*E(N,w){let u=0;for(let Z0 of N)yield w(Z0,u++)}U.map=E;function*S(N,w){let u=0;for(let Z0 of N)yield*w(Z0,u++)}U.flatMap=S;function*j(...N){for(let w of N)yield*w}U.concat=j;function k(N,w,u){let Z0=u;for(let V0 of N)Z0=w(Z0,V0);return Z0}U.reduce=k;function*B(N,w,u=N.length){for(w<0&&(w+=N.length),u<0?u+=N.length:u>N.length&&(u=N.length);w<u;w++)yield N[w]}U.slice=B;function v(N,w=Number.POSITIVE_INFINITY){let u=[];if(w===0)return[u,N];let Z0=N[Symbol.iterator]();for(let V0=0;V0<w;V0++){let Y0=Z0.next();if(Y0.done)return[u,U.empty()];u.push(Y0.value)}return[u,{[Symbol.iterator](){return Z0}}]}U.consume=v;async function x(N){let w=[];for await(let u of N)w.push(u);return Promise.resolve(w)}U.asyncToArray=x})(IK||={});var fO=!1,GZ=null,wO=class U{constructor(){this.livingDisposables=new Map}getDisposableData(Z){let X=this.livingDisposables.get(Z);return X||(X={parent:null,source:null,isSingleton:!1,value:Z,idx:U.idx++},this.livingDisposables.set(Z,X)),X}trackDisposable(Z){let X=this.getDisposableData(Z);X.source||(X.source=Error().stack)}setParent(Z,X){let Q=this.getDisposableData(Z);Q.parent=X}markAsDisposed(Z){this.livingDisposables.delete(Z)}markAsSingleton(Z){this.getDisposableData(Z).isSingleton=!0}getRootParent(Z,X){let Q=X.get(Z);if(Q)return Q;let K=Z.parent?this.getRootParent(this.getDisposableData(Z.parent),X):Z;return X.set(Z,K),K}getTrackedDisposables(){let Z=new Map;return[...this.livingDisposables.entries()].filter(([,X])=>X.source!==null&&!this.getRootParent(X,Z).isSingleton).flatMap(([X])=>X)}computeLeakingDisposables(Z=10,X){let Q;if(X)Q=X;else{let M=new Map,z=[...this.livingDisposables.values()].filter((A)=>A.source!==null&&!this.getRootParent(A,M).isSingleton);if(z.length===0)return;let T=new Set(z.map((A)=>A.value));if(Q=z.filter((A)=>!(A.parent&&T.has(A.parent))),Q.length===0)throw Error("There are cyclic diposable chains!")}if(!Q)return;function K(M){function z(A,L){for(;A.length>0&&L.some((E)=>typeof E=="string"?E===A[0]:A[0].match(E));)A.shift()}let T=M.source.split(`
|
|
355
|
+
`).map((A)=>A.trim().replace("at ","")).filter((A)=>A!=="");return z(T,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),T.reverse()}let F=new NO;for(let M of Q){let z=K(M);for(let T=0;T<=z.length;T++)F.add(z.slice(0,T).join(`
|
|
356
|
+
`),M)}Q.sort(_O((M)=>M.idx,BO));let $="",q=0;for(let M of Q.slice(0,Z)){q++;let z=K(M),T=[];for(let A=0;A<z.length;A++){let L=z[A];L=`(shared with ${F.get(z.slice(0,A+1).join(`
|
|
357
|
+
`)).size}/${Q.length} leaks) at ${L}`;let E=F.get(z.slice(0,A).join(`
|
|
339
358
|
`)),S=xO([...E].map((j)=>K(j)[A]),(j)=>j);delete S[z[A]];for(let[j,k]of Object.entries(S))T.unshift(` - stacktraces of ${k.length} other leaks continue with ${j}`);T.unshift(L)}$+=`
|
|
340
359
|
|
|
341
360
|
|
|
342
|
-
==================== Leaking disposable ${
|
|
361
|
+
==================== Leaking disposable ${q}/${Q.length}: ${M.value.constructor.name} ====================
|
|
343
362
|
${T.join(`
|
|
344
363
|
`)}
|
|
345
364
|
============================================================
|
|
@@ -349,21 +368,21 @@ ${T.join(`
|
|
|
349
368
|
|
|
350
369
|
... and ${Q.length-Z} more leaking disposables
|
|
351
370
|
|
|
352
|
-
`),{leaks:Q,details:$}}};wO.idx=0;function yO(U){GZ=U}if(fO){let U="__is_disposable_tracked__";yO(new class{trackDisposable(Z){let X=Error("Potentially leaked disposable").stack;setTimeout(()=>{Z[U]||console.log(X)},3000)}setParent(Z,X){if(Z&&Z!==d0.None)try{Z[U]=!0}catch{}}markAsDisposed(Z){if(Z&&Z!==d0.None)try{Z[U]=!0}catch{}}markAsSingleton(Z){}})}function QY(U){return GZ?.trackDisposable(U),U}function GY(U){GZ?.markAsDisposed(U)}function VX(U,Z){GZ?.setParent(U,Z)}function cO(U,Z){if(GZ)for(let X of U)GZ.setParent(X,Z)}function G$(U){return GZ?.markAsSingleton(U),U}function VZ(U){if(IK.is(U)){let Z=[];for(let X of U)if(X)try{X.dispose()}catch(Q){Z.push(Q)}if(Z.length===1)throw Z[0];if(Z.length>1)throw AggregateError(Z,"Encountered errors while disposing of store");return Array.isArray(U)?[]:U}else if(U)return U.dispose(),U}function pO(...U){let Z=U1(()=>VZ(U));return cO(U,Z),Z}function U1(U){let Z=QY({dispose:gO(()=>{GY(Z),U()})});return Z}var HK=class U{constructor(){this._toDispose=new Set,this._isDisposed=!1,QY(this)}dispose(){this._isDisposed||(GY(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{VZ(this._toDispose)}finally{this._toDispose.clear()}}add(Z){if(!Z)return Z;if(Z===this)throw Error("Cannot register a disposable on itself!");return VX(Z,this),this._isDisposed?U.DISABLE_DISPOSED_WARNING||console.warn(Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(Z),Z}delete(Z){if(Z){if(Z===this)throw Error("Cannot dispose a disposable on itself!");this._toDispose.delete(Z),Z.dispose()}}deleteAndLeak(Z){Z&&this._toDispose.has(Z)&&(this._toDispose.delete(Z),VX(Z,null))}};HK.DISABLE_DISPOSED_WARNING=!1;var nU=HK,d0=class{constructor(){this._store=new nU,QY(this),VX(this._store,this)}dispose(){GY(this),this._store.dispose()}_register(U){if(U===this)throw Error("Cannot register a disposable on itself!");return this._store.add(U)}};d0.None=Object.freeze({dispose(){}});var EZ=class{constructor(){this._isDisposed=!1,QY(this)}get value(){return this._isDisposed?void 0:this._value}set value(U){this._isDisposed||U===this._value||(this._value?.dispose(),U&&VX(U,this),this._value=U)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,GY(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let U=this._value;return this._value=void 0,U&&VX(U,null),U}},$U=typeof window=="object"?window:globalThis,NJ=class U{constructor(Z){this.element=Z,this.next=U.Undefined,this.prev=U.Undefined}};NJ.Undefined=new NJ(void 0);var X1=NJ,V$=class{constructor(){this._first=X1.Undefined,this._last=X1.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===X1.Undefined}clear(){let U=this._first;for(;U!==X1.Undefined;){let Z=U.next;U.prev=X1.Undefined,U.next=X1.Undefined,U=Z}this._first=X1.Undefined,this._last=X1.Undefined,this._size=0}unshift(U){return this._insert(U,!1)}push(U){return this._insert(U,!0)}_insert(U,Z){let X=new X1(U);if(this._first===X1.Undefined)this._first=X,this._last=X;else if(Z){let K=this._last;this._last=X,X.prev=K,K.next=X}else{let K=this._first;this._first=X,X.next=K,K.prev=X}this._size+=1;let Q=!1;return()=>{Q||(Q=!0,this._remove(X))}}shift(){if(this._first!==X1.Undefined){let U=this._first.element;return this._remove(this._first),U}}pop(){if(this._last!==X1.Undefined){let U=this._last.element;return this._remove(this._last),U}}_remove(U){if(U.prev!==X1.Undefined&&U.next!==X1.Undefined){let Z=U.prev;Z.next=U.next,U.next.prev=Z}else U.prev===X1.Undefined&&U.next===X1.Undefined?(this._first=X1.Undefined,this._last=X1.Undefined):U.next===X1.Undefined?(this._last=this._last.prev,this._last.next=X1.Undefined):U.prev===X1.Undefined&&(this._first=this._first.next,this._first.prev=X1.Undefined);this._size-=1}*[Symbol.iterator](){let U=this._first;for(;U!==X1.Undefined;)yield U.element,U=U.next}},hO=globalThis.performance&&typeof globalThis.performance.now=="function",uO=class U{static create(Z){return new U(Z)}constructor(Z){this._now=hO&&Z===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},bO=!1,$$=!1,dO=!1,b1;((U)=>{U.None=()=>d0.None;function Z(V){if(dO){let{onDidAddListener:I}=V,G=fJ.create(),W=0;V.onDidAddListener=()=>{++W===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),G.print()),I?.()}}}function X(V,I){return L(V,()=>{},0,void 0,!0,void 0,I)}U.defer=X;function Q(V){return(I,G=null,W)=>{let C=!1,D;return D=V((F)=>{if(!C)return D?D.dispose():C=!0,I.call(G,F)},null,W),C&&D.dispose(),D}}U.once=Q;function K(V,I,G){return T((W,C=null,D)=>V((F)=>W.call(C,I(F)),null,D),G)}U.map=K;function H(V,I,G){return T((W,C=null,D)=>V((F)=>{I(F),W.call(C,F)},null,D),G)}U.forEach=H;function $(V,I,G){return T((W,C=null,D)=>V((F)=>I(F)&&W.call(C,F),null,D),G)}U.filter=$;function M(V){return V}U.signal=M;function q(...V){return(I,G=null,W)=>{let C=pO(...V.map((D)=>D((F)=>I.call(G,F))));return A(C,W)}}U.any=q;function z(V,I,G,W){let C=G;return K(V,(D)=>(C=I(C,D),C),W)}U.reduce=z;function T(V,I){let G,W={onWillAddFirstListener(){G=V(C.fire,C)},onDidRemoveLastListener(){G?.dispose()}};I||Z(W);let C=new w0(W);return I?.add(C),C.event}function A(V,I){return I instanceof Array?I.push(V):I&&I.add(V),V}function L(V,I,G=100,W=!1,C=!1,D,F){let J,O,P,R=0,_,f={leakWarningThreshold:D,onWillAddFirstListener(){J=V((o)=>{R++,O=I(O,o),W&&!P&&(c.fire(O),O=void 0),_=()=>{let K0=O;O=void 0,P=void 0,(!W||R>1)&&c.fire(K0),R=0},typeof G=="number"?(clearTimeout(P),P=setTimeout(_,G)):P===void 0&&(P=0,queueMicrotask(_))})},onWillRemoveListener(){C&&R>0&&_?.()},onDidRemoveLastListener(){_=void 0,J.dispose()}};F||Z(f);let c=new w0(f);return F?.add(c),c.event}U.debounce=L;function E(V,I=0,G){return U.debounce(V,(W,C)=>W?(W.push(C),W):[C],I,void 0,!0,void 0,G)}U.accumulate=E;function S(V,I=(W,C)=>W===C,G){let W=!0,C;return $(V,(D)=>{let F=W||!I(D,C);return W=!1,C=D,F},G)}U.latch=S;function j(V,I,G){return[U.filter(V,I,G),U.filter(V,(W)=>!I(W),G)]}U.split=j;function k(V,I=!1,G=[],W){let C=G.slice(),D=V((O)=>{C?C.push(O):J.fire(O)});W&&W.add(D);let F=()=>{C?.forEach((O)=>J.fire(O)),C=null},J=new w0({onWillAddFirstListener(){D||(D=V((O)=>J.fire(O)),W&&W.add(D))},onDidAddFirstListener(){C&&(I?setTimeout(F):F())},onDidRemoveLastListener(){D&&D.dispose(),D=null}});return W&&W.add(J),J.event}U.buffer=k;function B(V,I){return(G,W,C)=>{let D=I(new x);return V(function(F){let J=D.evaluate(F);J!==v&&G.call(W,J)},void 0,C)}}U.chain=B;let v=Symbol("HaltChainable");class x{constructor(){this.steps=[]}map(V){return this.steps.push(V),this}forEach(V){return this.steps.push((I)=>(V(I),I)),this}filter(V){return this.steps.push((I)=>V(I)?I:v),this}reduce(V,I){let G=I;return this.steps.push((W)=>(G=V(G,W),G)),this}latch(V=(I,G)=>I===G){let I=!0,G;return this.steps.push((W)=>{let C=I||!V(W,G);return I=!1,G=W,C?W:v}),this}evaluate(V){for(let I of this.steps)if(V=I(V),V===v)break;return V}}function N(V,I,G=(W)=>W){let W=(...J)=>F.fire(G(...J)),C=()=>V.on(I,W),D=()=>V.removeListener(I,W),F=new w0({onWillAddFirstListener:C,onDidRemoveLastListener:D});return F.event}U.fromNodeEventEmitter=N;function w(V,I,G=(W)=>W){let W=(...J)=>F.fire(G(...J)),C=()=>V.addEventListener(I,W),D=()=>V.removeEventListener(I,W),F=new w0({onWillAddFirstListener:C,onDidRemoveLastListener:D});return F.event}U.fromDOMEventEmitter=w;function u(V){return new Promise((I)=>Q(V)(I))}U.toPromise=u;function Z0(V){let I=new w0;return V.then((G)=>{I.fire(G)},()=>{I.fire(void 0)}).finally(()=>{I.dispose()}),I.event}U.fromPromise=Z0;function V0(V,I){return V((G)=>I.fire(G))}U.forward=V0;function Y0(V,I,G){return I(G),V((W)=>I(W))}U.runAndSubscribe=Y0;class b{constructor(V,I){this._observable=V,this._counter=0,this._hasChanged=!1;let G={onWillAddFirstListener:()=>{V.addObserver(this)},onDidRemoveLastListener:()=>{V.removeObserver(this)}};I||Z(G),this.emitter=new w0(G),I&&I.add(this.emitter)}beginUpdate(V){this._counter++}handlePossibleChange(V){}handleChange(V,I){this._hasChanged=!0}endUpdate(V){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function i(V,I){return new b(V,I).emitter.event}U.fromObservable=i;function Y(V){return(I,G,W)=>{let C=0,D=!1,F={beginUpdate(){C++},endUpdate(){C--,C===0&&(V.reportChanges(),D&&(D=!1,I.call(G)))},handlePossibleChange(){},handleChange(){D=!0}};V.addObserver(F),V.reportChanges();let J={dispose(){V.removeObserver(F)}};return W instanceof nU?W.add(J):Array.isArray(W)&&W.push(J),J}}U.fromObservableLight=Y})(b1||={});var gJ=class U{constructor(Z){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${Z}_${U._idPool++}`,U.all.add(this)}start(Z){this._stopWatch=new uO,this.listenerCount=Z}stop(){if(this._stopWatch){let Z=this._stopWatch.elapsed();this.durations.push(Z),this.elapsedOverall+=Z,this.invocationCount+=1,this._stopWatch=void 0}}};gJ.all=new Set,gJ._idPool=0;var lO=gJ,K$=-1,FK=class U{constructor(Z,X,Q=(U._idPool++).toString(16).padStart(3,"0")){this._errorHandler=Z,this.threshold=X,this.name=Q,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(Z,X){let Q=this.threshold;if(Q<=0||X<Q)return;this._stacks||(this._stacks=new Map);let K=this._stacks.get(Z.value)||0;if(this._stacks.set(Z.value,K+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=Q*0.5;let[H,$]=this.getMostFrequentStack(),M=`[${this.name}] potential listener LEAK detected, having ${X} listeners already. MOST frequent listener (${$}):`;console.warn(M),console.warn(H);let q=new nO(M,H);this._errorHandler(q)}return()=>{let H=this._stacks.get(Z.value)||0;this._stacks.set(Z.value,H-1)}}getMostFrequentStack(){if(!this._stacks)return;let Z,X=0;for(let[Q,K]of this._stacks)(!Z||X<K)&&(Z=[Q,K],X=K);return Z}};FK._idPool=1;var oO=FK,fJ=class U{constructor(Z){this.value=Z}static create(){let Z=Error();return new U(Z.stack??"")}print(){console.warn(this.value.split(`
|
|
371
|
+
`),{leaks:Q,details:$}}};wO.idx=0;function yO(U){GZ=U}if(fO){let U="__is_disposable_tracked__";yO(new class{trackDisposable(Z){let X=Error("Potentially leaked disposable").stack;setTimeout(()=>{Z[U]||console.log(X)},3000)}setParent(Z,X){if(Z&&Z!==d0.None)try{Z[U]=!0}catch{}}markAsDisposed(Z){if(Z&&Z!==d0.None)try{Z[U]=!0}catch{}}markAsSingleton(Z){}})}function QY(U){return GZ?.trackDisposable(U),U}function GY(U){GZ?.markAsDisposed(U)}function VX(U,Z){GZ?.setParent(U,Z)}function cO(U,Z){if(GZ)for(let X of U)GZ.setParent(X,Z)}function G$(U){return GZ?.markAsSingleton(U),U}function VZ(U){if(IK.is(U)){let Z=[];for(let X of U)if(X)try{X.dispose()}catch(Q){Z.push(Q)}if(Z.length===1)throw Z[0];if(Z.length>1)throw AggregateError(Z,"Encountered errors while disposing of store");return Array.isArray(U)?[]:U}else if(U)return U.dispose(),U}function pO(...U){let Z=U1(()=>VZ(U));return cO(U,Z),Z}function U1(U){let Z=QY({dispose:gO(()=>{GY(Z),U()})});return Z}var FK=class U{constructor(){this._toDispose=new Set,this._isDisposed=!1,QY(this)}dispose(){this._isDisposed||(GY(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{VZ(this._toDispose)}finally{this._toDispose.clear()}}add(Z){if(!Z)return Z;if(Z===this)throw Error("Cannot register a disposable on itself!");return VX(Z,this),this._isDisposed?U.DISABLE_DISPOSED_WARNING||console.warn(Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(Z),Z}delete(Z){if(Z){if(Z===this)throw Error("Cannot dispose a disposable on itself!");this._toDispose.delete(Z),Z.dispose()}}deleteAndLeak(Z){Z&&this._toDispose.has(Z)&&(this._toDispose.delete(Z),VX(Z,null))}};FK.DISABLE_DISPOSED_WARNING=!1;var nU=FK,d0=class{constructor(){this._store=new nU,QY(this),VX(this._store,this)}dispose(){GY(this),this._store.dispose()}_register(U){if(U===this)throw Error("Cannot register a disposable on itself!");return this._store.add(U)}};d0.None=Object.freeze({dispose(){}});var EZ=class{constructor(){this._isDisposed=!1,QY(this)}get value(){return this._isDisposed?void 0:this._value}set value(U){this._isDisposed||U===this._value||(this._value?.dispose(),U&&VX(U,this),this._value=U)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,GY(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let U=this._value;return this._value=void 0,U&&VX(U,null),U}},$U=typeof window=="object"?window:globalThis,NJ=class U{constructor(Z){this.element=Z,this.next=U.Undefined,this.prev=U.Undefined}};NJ.Undefined=new NJ(void 0);var X1=NJ,V$=class{constructor(){this._first=X1.Undefined,this._last=X1.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===X1.Undefined}clear(){let U=this._first;for(;U!==X1.Undefined;){let Z=U.next;U.prev=X1.Undefined,U.next=X1.Undefined,U=Z}this._first=X1.Undefined,this._last=X1.Undefined,this._size=0}unshift(U){return this._insert(U,!1)}push(U){return this._insert(U,!0)}_insert(U,Z){let X=new X1(U);if(this._first===X1.Undefined)this._first=X,this._last=X;else if(Z){let K=this._last;this._last=X,X.prev=K,K.next=X}else{let K=this._first;this._first=X,X.next=K,K.prev=X}this._size+=1;let Q=!1;return()=>{Q||(Q=!0,this._remove(X))}}shift(){if(this._first!==X1.Undefined){let U=this._first.element;return this._remove(this._first),U}}pop(){if(this._last!==X1.Undefined){let U=this._last.element;return this._remove(this._last),U}}_remove(U){if(U.prev!==X1.Undefined&&U.next!==X1.Undefined){let Z=U.prev;Z.next=U.next,U.next.prev=Z}else U.prev===X1.Undefined&&U.next===X1.Undefined?(this._first=X1.Undefined,this._last=X1.Undefined):U.next===X1.Undefined?(this._last=this._last.prev,this._last.next=X1.Undefined):U.prev===X1.Undefined&&(this._first=this._first.next,this._first.prev=X1.Undefined);this._size-=1}*[Symbol.iterator](){let U=this._first;for(;U!==X1.Undefined;)yield U.element,U=U.next}},hO=globalThis.performance&&typeof globalThis.performance.now=="function",uO=class U{static create(Z){return new U(Z)}constructor(Z){this._now=hO&&Z===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},bO=!1,$$=!1,dO=!1,b1;((U)=>{U.None=()=>d0.None;function Z(V){if(dO){let{onDidAddListener:I}=V,G=fJ.create(),W=0;V.onDidAddListener=()=>{++W===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),G.print()),I?.()}}}function X(V,I){return L(V,()=>{},0,void 0,!0,void 0,I)}U.defer=X;function Q(V){return(I,G=null,W)=>{let C=!1,D;return D=V((H)=>{if(!C)return D?D.dispose():C=!0,I.call(G,H)},null,W),C&&D.dispose(),D}}U.once=Q;function K(V,I,G){return T((W,C=null,D)=>V((H)=>W.call(C,I(H)),null,D),G)}U.map=K;function F(V,I,G){return T((W,C=null,D)=>V((H)=>{I(H),W.call(C,H)},null,D),G)}U.forEach=F;function $(V,I,G){return T((W,C=null,D)=>V((H)=>I(H)&&W.call(C,H),null,D),G)}U.filter=$;function q(V){return V}U.signal=q;function M(...V){return(I,G=null,W)=>{let C=pO(...V.map((D)=>D((H)=>I.call(G,H))));return A(C,W)}}U.any=M;function z(V,I,G,W){let C=G;return K(V,(D)=>(C=I(C,D),C),W)}U.reduce=z;function T(V,I){let G,W={onWillAddFirstListener(){G=V(C.fire,C)},onDidRemoveLastListener(){G?.dispose()}};I||Z(W);let C=new w0(W);return I?.add(C),C.event}function A(V,I){return I instanceof Array?I.push(V):I&&I.add(V),V}function L(V,I,G=100,W=!1,C=!1,D,H){let J,O,P,R=0,_,f={leakWarningThreshold:D,onWillAddFirstListener(){J=V((o)=>{R++,O=I(O,o),W&&!P&&(c.fire(O),O=void 0),_=()=>{let K0=O;O=void 0,P=void 0,(!W||R>1)&&c.fire(K0),R=0},typeof G=="number"?(clearTimeout(P),P=setTimeout(_,G)):P===void 0&&(P=0,queueMicrotask(_))})},onWillRemoveListener(){C&&R>0&&_?.()},onDidRemoveLastListener(){_=void 0,J.dispose()}};H||Z(f);let c=new w0(f);return H?.add(c),c.event}U.debounce=L;function E(V,I=0,G){return U.debounce(V,(W,C)=>W?(W.push(C),W):[C],I,void 0,!0,void 0,G)}U.accumulate=E;function S(V,I=(W,C)=>W===C,G){let W=!0,C;return $(V,(D)=>{let H=W||!I(D,C);return W=!1,C=D,H},G)}U.latch=S;function j(V,I,G){return[U.filter(V,I,G),U.filter(V,(W)=>!I(W),G)]}U.split=j;function k(V,I=!1,G=[],W){let C=G.slice(),D=V((O)=>{C?C.push(O):J.fire(O)});W&&W.add(D);let H=()=>{C?.forEach((O)=>J.fire(O)),C=null},J=new w0({onWillAddFirstListener(){D||(D=V((O)=>J.fire(O)),W&&W.add(D))},onDidAddFirstListener(){C&&(I?setTimeout(H):H())},onDidRemoveLastListener(){D&&D.dispose(),D=null}});return W&&W.add(J),J.event}U.buffer=k;function B(V,I){return(G,W,C)=>{let D=I(new x);return V(function(H){let J=D.evaluate(H);J!==v&&G.call(W,J)},void 0,C)}}U.chain=B;let v=Symbol("HaltChainable");class x{constructor(){this.steps=[]}map(V){return this.steps.push(V),this}forEach(V){return this.steps.push((I)=>(V(I),I)),this}filter(V){return this.steps.push((I)=>V(I)?I:v),this}reduce(V,I){let G=I;return this.steps.push((W)=>(G=V(G,W),G)),this}latch(V=(I,G)=>I===G){let I=!0,G;return this.steps.push((W)=>{let C=I||!V(W,G);return I=!1,G=W,C?W:v}),this}evaluate(V){for(let I of this.steps)if(V=I(V),V===v)break;return V}}function N(V,I,G=(W)=>W){let W=(...J)=>H.fire(G(...J)),C=()=>V.on(I,W),D=()=>V.removeListener(I,W),H=new w0({onWillAddFirstListener:C,onDidRemoveLastListener:D});return H.event}U.fromNodeEventEmitter=N;function w(V,I,G=(W)=>W){let W=(...J)=>H.fire(G(...J)),C=()=>V.addEventListener(I,W),D=()=>V.removeEventListener(I,W),H=new w0({onWillAddFirstListener:C,onDidRemoveLastListener:D});return H.event}U.fromDOMEventEmitter=w;function u(V){return new Promise((I)=>Q(V)(I))}U.toPromise=u;function Z0(V){let I=new w0;return V.then((G)=>{I.fire(G)},()=>{I.fire(void 0)}).finally(()=>{I.dispose()}),I.event}U.fromPromise=Z0;function V0(V,I){return V((G)=>I.fire(G))}U.forward=V0;function Y0(V,I,G){return I(G),V((W)=>I(W))}U.runAndSubscribe=Y0;class b{constructor(V,I){this._observable=V,this._counter=0,this._hasChanged=!1;let G={onWillAddFirstListener:()=>{V.addObserver(this)},onDidRemoveLastListener:()=>{V.removeObserver(this)}};I||Z(G),this.emitter=new w0(G),I&&I.add(this.emitter)}beginUpdate(V){this._counter++}handlePossibleChange(V){}handleChange(V,I){this._hasChanged=!0}endUpdate(V){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function i(V,I){return new b(V,I).emitter.event}U.fromObservable=i;function Y(V){return(I,G,W)=>{let C=0,D=!1,H={beginUpdate(){C++},endUpdate(){C--,C===0&&(V.reportChanges(),D&&(D=!1,I.call(G)))},handlePossibleChange(){},handleChange(){D=!0}};V.addObserver(H),V.reportChanges();let J={dispose(){V.removeObserver(H)}};return W instanceof nU?W.add(J):Array.isArray(W)&&W.push(J),J}}U.fromObservableLight=Y})(b1||={});var gJ=class U{constructor(Z){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${Z}_${U._idPool++}`,U.all.add(this)}start(Z){this._stopWatch=new uO,this.listenerCount=Z}stop(){if(this._stopWatch){let Z=this._stopWatch.elapsed();this.durations.push(Z),this.elapsedOverall+=Z,this.invocationCount+=1,this._stopWatch=void 0}}};gJ.all=new Set,gJ._idPool=0;var lO=gJ,K$=-1,HK=class U{constructor(Z,X,Q=(U._idPool++).toString(16).padStart(3,"0")){this._errorHandler=Z,this.threshold=X,this.name=Q,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(Z,X){let Q=this.threshold;if(Q<=0||X<Q)return;this._stacks||(this._stacks=new Map);let K=this._stacks.get(Z.value)||0;if(this._stacks.set(Z.value,K+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=Q*0.5;let[F,$]=this.getMostFrequentStack(),q=`[${this.name}] potential listener LEAK detected, having ${X} listeners already. MOST frequent listener (${$}):`;console.warn(q),console.warn(F);let M=new nO(q,F);this._errorHandler(M)}return()=>{let F=this._stacks.get(Z.value)||0;this._stacks.set(Z.value,F-1)}}getMostFrequentStack(){if(!this._stacks)return;let Z,X=0;for(let[Q,K]of this._stacks)(!Z||X<K)&&(Z=[Q,K],X=K);return Z}};HK._idPool=1;var oO=HK,fJ=class U{constructor(Z){this.value=Z}static create(){let Z=Error();return new U(Z.stack??"")}print(){console.warn(this.value.split(`
|
|
353
372
|
`).slice(2).join(`
|
|
354
373
|
`))}},nO=class extends Error{constructor(U,Z){super(U),this.name="ListenerLeakError",this.stack=Z}},mO=class extends Error{constructor(U,Z){super(U),this.name="ListenerRefusalError",this.stack=Z}},sO=0,uX=class{constructor(U){this.value=U,this.id=sO++}},rO=2,aO=(U,Z)=>{if(U instanceof uX)Z(U);else for(let X=0;X<U.length;X++){let Q=U[X];Q&&Z(Q)}},bX;if(bO){let U=[];setInterval(()=>{U.length!==0&&(console.warn("[LEAKING LISTENERS] GC'ed these listeners that were NOT yet disposed:"),console.warn(U.join(`
|
|
355
|
-
`)),U.length=0)},3000),bX=new FinalizationRegistry((Z)=>{typeof Z=="string"&&U.push(Z)})}var w0=class{constructor(U){this._size=0,this._options=U,this._leakageMon=K$>0||this._options?.leakWarningThreshold?new oO(U?.onListenerError??hX,this._options?.leakWarningThreshold??K$):void 0,this._perfMon=this._options?._profName?new lO(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if($$){let U=this._listeners;queueMicrotask(()=>{aO(U,(Z)=>Z.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??=(U,Z,X)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let
|
|
374
|
+
`)),U.length=0)},3000),bX=new FinalizationRegistry((Z)=>{typeof Z=="string"&&U.push(Z)})}var w0=class{constructor(U){this._size=0,this._options=U,this._leakageMon=K$>0||this._options?.leakWarningThreshold?new oO(U?.onListenerError??hX,this._options?.leakWarningThreshold??K$):void 0,this._perfMon=this._options?._profName?new lO(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if($$){let U=this._listeners;queueMicrotask(()=>{aO(U,(Z)=>Z.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??=(U,Z,X)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let q=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(q);let M=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],z=new mO(`${q}. HINT: Stack shows most frequent listener (${M[1]}-times)`,M[0]);return(this._options?.onListenerError||hX)(z),d0.None}if(this._disposed)return d0.None;Z&&(U=U.bind(Z));let Q=new uX(U),K,F;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*0.2)&&(Q.stack=fJ.create(),K=this._leakageMon.check(Q.stack,this._size+1)),$$&&(Q.stack=F??fJ.create()),this._listeners?this._listeners instanceof uX?(this._deliveryQueue??=new tO,this._listeners=[this._listeners,Q]):this._listeners.push(Q):(this._options?.onWillAddFirstListener?.(this),this._listeners=Q,this._options?.onDidAddFirstListener?.(this)),this._size++;let $=U1(()=>{bX?.unregister($),K?.(),this._removeListener(Q)});if(X instanceof nU?X.add($):Array.isArray(X)&&X.push($),bX){let q=Error().stack.split(`
|
|
356
375
|
`).slice(2,3).join(`
|
|
357
|
-
`).trim(),q=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(M);bX.register($,q?.[2]??M,$)}return $},this._event}_removeListener(U){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let Z=this._listeners,X=Z.indexOf(U);if(X===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),Error("Attempted to dispose unknown listener");this._size--,Z[X]=void 0;let Q=this._deliveryQueue.current===this;if(this._size*rO<=Z.length){let K=0;for(let H=0;H<Z.length;H++)Z[H]?Z[K++]=Z[H]:Q&&(this._deliveryQueue.end--,K<this._deliveryQueue.i&&this._deliveryQueue.i--);Z.length=K}}_deliver(U,Z){if(!U)return;let X=this._options?.onListenerError||hX;if(!X){U.value(Z);return}try{U.value(Z)}catch(Q){X(Q)}}_deliverQueue(U){let Z=U.current._listeners;for(;U.i<U.end;)this._deliver(Z[U.i++],U.value);U.reset()}fire(U){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof uX)this._deliver(this._listeners,U);else{let Z=this._deliveryQueue;Z.enqueue(this,U,this._listeners.length),this._deliverQueue(Z)}this._perfMon?.stop()}hasListeners(){return this._size>0}},tO=class{constructor(){this.i=-1,this.end=0}enqueue(U,Z,X){this.i=0,this.end=X,this.current=U,this.value=Z}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},wJ=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new w0,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new w0,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(Z){return this.mapWindowIdToZoomLevel.get(this.getWindowId(Z))??0}setZoomLevel(Z,X){if(this.getZoomLevel(X)===Z)return;let Q=this.getWindowId(X);this.mapWindowIdToZoomLevel.set(Q,Z),this._onDidChangeZoomLevel.fire(Q)}getZoomFactor(Z){return this.mapWindowIdToZoomFactor.get(this.getWindowId(Z))??1}setZoomFactor(Z,X){this.mapWindowIdToZoomFactor.set(this.getWindowId(X),Z)}setFullscreen(Z,X){if(this.isFullscreen(X)===Z)return;let Q=this.getWindowId(X);this.mapWindowIdToFullScreen.set(Q,Z),this._onDidChangeFullscreen.fire(Q)}isFullscreen(Z){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(Z))}getWindowId(Z){return Z.vscodeWindowId}};wJ.INSTANCE=new wJ;var QQ=wJ;function iO(U,Z,X){typeof Z=="string"&&(Z=U.matchMedia(Z)),Z.addEventListener("change",X)}var YA=QQ.INSTANCE.onDidChangeZoomLevel;function eO(U){return QQ.INSTANCE.getZoomFactor(U)}var JA=QQ.INSTANCE.onDidChangeFullscreen,PZ=typeof navigator=="object"?navigator.userAgent:"",yJ=PZ.indexOf("Firefox")>=0,dX=PZ.indexOf("AppleWebKit")>=0,GQ=PZ.indexOf("Chrome")>=0,OK=!GQ&&PZ.indexOf("Safari")>=0,QA=PZ.indexOf("Electron/")>=0,GA=PZ.indexOf("Android")>=0,lX=!1;if(typeof $U.matchMedia=="function"){let U=$U.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),Z=$U.matchMedia("(display-mode: fullscreen)");lX=U.matches,iO($U,U,({matches:X})=>{lX&&Z.matches||(lX=X)})}function U2(){return lX}var RZ="en",rX=!1,aX=!1,QX=!1,Z2=!1,CK=!1,AK=!1,X2=!1,Y2=!1,J2=!1,Q2=!1,fX,oX=RZ,W$=RZ,G2,_U,xU=globalThis,VU;typeof xU.vscode<"u"&&typeof xU.vscode.process<"u"?VU=xU.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(VU=process);var zK=typeof VU?.versions?.electron=="string",V2=zK&&VU?.type==="renderer";if(typeof VU=="object"){rX=VU.platform==="win32",aX=VU.platform==="darwin",QX=VU.platform==="linux",Z2=QX&&!!VU.env.SNAP&&!!VU.env.SNAP_REVISION,X2=zK,J2=!!VU.env.CI||!!VU.env.BUILD_ARTIFACTSTAGINGDIRECTORY,fX=RZ,oX=RZ;let U=VU.env.VSCODE_NLS_CONFIG;if(U)try{let Z=JSON.parse(U);fX=Z.userLocale,W$=Z.osLocale,oX=Z.resolvedLanguage||RZ,G2=Z.languagePack?.translationsConfigFile}catch{}CK=!0}else typeof navigator=="object"&&!V2?(_U=navigator.userAgent,rX=_U.indexOf("Windows")>=0,aX=_U.indexOf("Macintosh")>=0,Y2=(_U.indexOf("Macintosh")>=0||_U.indexOf("iPad")>=0||_U.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,QX=_U.indexOf("Linux")>=0,Q2=_U?.indexOf("Mobi")>=0,AK=!0,oX=globalThis._VSCODE_NLS_LANGUAGE||RZ,fX=navigator.language.toLowerCase(),W$=fX):console.error("Unable to resolve platform.");var HJ=0;aX?HJ=1:rX?HJ=3:QX&&(HJ=2);var DK=rX,TU=aX,$2=QX,FJ=CK,K2=AK&&typeof xU.importScripts=="function",VA=K2?xU.origin:void 0,RU=_U,hU=oX,W2;((U)=>{function Z(){return hU}U.value=Z;function X(){return hU.length===2?hU==="en":hU.length>=3?hU[0]==="e"&&hU[1]==="n"&&hU[2]==="-":!1}U.isDefaultVariant=X;function Q(){return hU==="en"}U.isDefault=Q})(W2||={});var I2=typeof xU.postMessage=="function"&&!xU.importScripts,H2=(()=>{if(I2){let U=[];xU.addEventListener("message",(X)=>{if(X.data&&X.data.vscodeScheduleAsyncWork)for(let Q=0,K=U.length;Q<K;Q++){let H=U[Q];if(H.id===X.data.vscodeScheduleAsyncWork){U.splice(Q,1),H.callback();return}}});let Z=0;return(X)=>{let Q=++Z;U.push({id:Q,callback:X}),xU.postMessage({vscodeScheduleAsyncWork:Q},"*")}}return(U)=>setTimeout(U)})(),F2=!!(RU&&RU.indexOf("Chrome")>=0),$A=!!(RU&&RU.indexOf("Firefox")>=0),KA=!!(!F2&&RU&&RU.indexOf("Safari")>=0),WA=!!(RU&&RU.indexOf("Edg/")>=0),IA=!!(RU&&RU.indexOf("Android")>=0),uU=typeof navigator=="object"?navigator:{},HA={clipboard:{writeText:FJ||document.queryCommandSupported&&document.queryCommandSupported("copy")||!!(uU&&uU.clipboard&&uU.clipboard.writeText),readText:FJ||!!(uU&&uU.clipboard&&uU.clipboard.readText)},keyboard:FJ||U2()?0:uU.keyboard||OK?1:2,touch:"ontouchstart"in $U||uU.maxTouchPoints>0,pointerEvents:$U.PointerEvent&&(("ontouchstart"in $U)||navigator.maxTouchPoints>0)},VQ=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(U,Z){this._keyCodeToStr[U]=Z,this._strToKeyCode[Z.toLowerCase()]=U}keyCodeToStr(U){return this._keyCodeToStr[U]}strToKeyCode(U){return this._strToKeyCode[U.toLowerCase()]||0}},OJ=new VQ,I$=new VQ,H$=new VQ,O2=Array(230),MK;((U)=>{function Z(M){return OJ.keyCodeToStr(M)}U.toString=Z;function X(M){return OJ.strToKeyCode(M)}U.fromString=X;function Q(M){return I$.keyCodeToStr(M)}U.toUserSettingsUS=Q;function K(M){return H$.keyCodeToStr(M)}U.toUserSettingsGeneral=K;function H(M){return I$.strToKeyCode(M)||H$.strToKeyCode(M)}U.fromUserSettings=H;function $(M){if(M>=98&&M<=113)return null;switch(M){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return OJ.keyCodeToStr(M)}U.toElectronAccelerator=$})(MK||={});var C2=class U{constructor(Z,X,Q,K,H){this.ctrlKey=Z,this.shiftKey=X,this.altKey=Q,this.metaKey=K,this.keyCode=H}equals(Z){return Z instanceof U&&this.ctrlKey===Z.ctrlKey&&this.shiftKey===Z.shiftKey&&this.altKey===Z.altKey&&this.metaKey===Z.metaKey&&this.keyCode===Z.keyCode}getHashCode(){let Z=this.ctrlKey?"1":"0",X=this.shiftKey?"1":"0",Q=this.altKey?"1":"0",K=this.metaKey?"1":"0";return`K${Z}${X}${Q}${K}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new A2([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},A2=class{constructor(U){if(U.length===0)throw kO("chords");this.chords=U}getHashCode(){let U="";for(let Z=0,X=this.chords.length;Z<X;Z++)Z!==0&&(U+=";"),U+=this.chords[Z].getHashCode();return U}equals(U){if(U===null||this.chords.length!==U.chords.length)return!1;for(let Z=0;Z<this.chords.length;Z++)if(!this.chords[Z].equals(U.chords[Z]))return!1;return!0}};function z2(U){if(U.charCode){let X=String.fromCharCode(U.charCode).toUpperCase();return MK.fromString(X)}let Z=U.keyCode;if(Z===3)return 7;if(yJ)switch(Z){case 59:return 85;case 60:if($2)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(TU)return 57;break}else if(dX){if(TU&&Z===93)return 57;if(!TU&&Z===92)return 57}return O2[Z]||0}var D2=TU?256:2048,M2=512,q2=1024,L2=TU?2048:256,cJ=class{constructor(U){this._standardKeyboardEventBrand=!0;let Z=U;this.browserEvent=Z,this.target=Z.target,this.ctrlKey=Z.ctrlKey,this.shiftKey=Z.shiftKey,this.altKey=Z.altKey,this.metaKey=Z.metaKey,this.altGraphKey=Z.getModifierState?.("AltGraph"),this.keyCode=z2(Z),this.code=Z.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(U){return this._asKeybinding===U}_computeKeybinding(){let U=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(U=this.keyCode);let Z=0;return this.ctrlKey&&(Z|=D2),this.altKey&&(Z|=M2),this.shiftKey&&(Z|=q2),this.metaKey&&(Z|=L2),Z|=U,Z}_computeKeyCodeChord(){let U=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(U=this.keyCode),new C2(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,U)}},F$=new WeakMap;function T2(U){if(!U.parent||U.parent===U)return null;try{let Z=U.location,X=U.parent.location;if(Z.origin!=="null"&&X.origin!=="null"&&Z.origin!==X.origin)return null}catch{return null}return U.parent}var R2=class{static getSameOriginWindowChain(U){let Z=F$.get(U);if(!Z){Z=[],F$.set(U,Z);let X=U,Q;do Q=T2(X),Q?Z.push({window:new WeakRef(X),iframeElement:X.frameElement||null}):Z.push({window:new WeakRef(X),iframeElement:null}),X=Q;while(X)}return Z.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(U,Z){if(!Z||U===Z)return{top:0,left:0};let X=0,Q=0,K=this.getSameOriginWindowChain(U);for(let H of K){let $=H.window.deref();if(X+=$?.scrollY??0,Q+=$?.scrollX??0,$===Z||!H.iframeElement)break;let M=H.iframeElement.getBoundingClientRect();X+=M.top,Q+=M.left}return{top:X,left:Q}}},eZ=class{constructor(U,Z){this.timestamp=Date.now(),this.browserEvent=Z,this.leftButton=Z.button===0,this.middleButton=Z.button===1,this.rightButton=Z.button===2,this.buttons=Z.buttons,this.target=Z.target,this.detail=Z.detail||1,Z.type==="dblclick"&&(this.detail=2),this.ctrlKey=Z.ctrlKey,this.shiftKey=Z.shiftKey,this.altKey=Z.altKey,this.metaKey=Z.metaKey,typeof Z.pageX=="number"?(this.posx=Z.pageX,this.posy=Z.pageY):(this.posx=Z.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=Z.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let X=R2.getPositionOfChildWindowRelativeToAncestorWindow(U,Z.view);this.posx-=X.left,this.posy-=X.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},O$=class{constructor(U,Z=0,X=0){this.browserEvent=U||null,this.target=U?U.target||U.targetNode||U.srcElement:null,this.deltaY=X,this.deltaX=Z;let Q=!1;if(GQ){let K=navigator.userAgent.match(/Chrome\/(\d+)/);Q=(K?parseInt(K[1]):123)<=122}if(U){let K=U,H=U,$=U.view?.devicePixelRatio||1;if(typeof K.wheelDeltaY<"u")Q?this.deltaY=K.wheelDeltaY/(120*$):this.deltaY=K.wheelDeltaY/120;else if(typeof H.VERTICAL_AXIS<"u"&&H.axis===H.VERTICAL_AXIS)this.deltaY=-H.detail/3;else if(U.type==="wheel"){let M=U;M.deltaMode===M.DOM_DELTA_LINE?yJ&&!TU?this.deltaY=-U.deltaY/3:this.deltaY=-U.deltaY:this.deltaY=-U.deltaY/40}if(typeof K.wheelDeltaX<"u")OK&&DK?this.deltaX=-(K.wheelDeltaX/120):Q?this.deltaX=K.wheelDeltaX/(120*$):this.deltaX=K.wheelDeltaX/120;else if(typeof H.HORIZONTAL_AXIS<"u"&&H.axis===H.HORIZONTAL_AXIS)this.deltaX=-U.detail/3;else if(U.type==="wheel"){let M=U;M.deltaMode===M.DOM_DELTA_LINE?yJ&&!TU?this.deltaX=-U.deltaX/3:this.deltaX=-U.deltaX:this.deltaX=-U.deltaX/40}this.deltaY===0&&this.deltaX===0&&U.wheelDelta&&(Q?this.deltaY=U.wheelDelta/(120*$):this.deltaY=U.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},qK=Object.freeze(function(U,Z){let X=setTimeout(U.bind(Z),0);return{dispose(){clearTimeout(X)}}}),E2;((U)=>{function Z(X){return X===U.None||X===U.Cancelled||X instanceof S2?!0:!X||typeof X!="object"?!1:typeof X.isCancellationRequested=="boolean"&&typeof X.onCancellationRequested=="function"}U.isCancellationToken=Z,U.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:b1.None}),U.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:qK})})(E2||={});var S2=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?qK:(this._emitter||(this._emitter=new w0),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},FA=Symbol("MicrotaskDelay"),$Q=class{constructor(U,Z){this._isDisposed=!1,this._token=-1,typeof U=="function"&&typeof Z=="number"&&this.setIfNotSet(U,Z)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(U,Z){if(this._isDisposed)throw new xJ("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,U()},Z)}setIfNotSet(U,Z){if(this._isDisposed)throw new xJ("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,U()},Z))}},P2=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(U,Z,X=globalThis){if(this.isDisposed)throw new xJ("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let Q=X.setInterval(()=>{U()},Z);this.disposable=U1(()=>{X.clearInterval(Q),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},k2,CJ;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?CJ=(U,Z)=>{H2(()=>{if(X)return;let Q=Date.now()+15;Z(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,Q-Date.now())}}))});let X=!1;return{dispose(){X||(X=!0)}}}:CJ=(U,Z,X)=>{let Q=U.requestIdleCallback(Z,typeof X=="number"?{timeout:X}:void 0),K=!1;return{dispose(){K||(K=!0,U.cancelIdleCallback(Q))}}},k2=(U)=>CJ(globalThis,U)})();var j2;((U)=>{async function Z(Q){let K,H=await Promise.all(Q.map(($)=>$.then((M)=>M,(M)=>{K||(K=M)})));if(typeof K<"u")throw K;return H}U.settled=Z;function X(Q){return new Promise(async(K,H)=>{try{await Q(K,H)}catch($){H($)}})}U.withAsyncBody=X})(j2||={});var C$=class U{static fromArray(Z){return new U((X)=>{X.emitMany(Z)})}static fromPromise(Z){return new U(async(X)=>{X.emitMany(await Z)})}static fromPromises(Z){return new U(async(X)=>{await Promise.all(Z.map(async(Q)=>X.emitOne(await Q)))})}static merge(Z){return new U(async(X)=>{await Promise.all(Z.map(async(Q)=>{for await(let K of Q)X.emitOne(K)}))})}constructor(Z,X){this._state=0,this._results=[],this._error=null,this._onReturn=X,this._onStateChanged=new w0,queueMicrotask(async()=>{let Q={emitOne:(K)=>this.emitOne(K),emitMany:(K)=>this.emitMany(K),reject:(K)=>this.reject(K)};try{await Promise.resolve(Z(Q)),this.resolve()}catch(K){this.reject(K)}finally{Q.emitOne=void 0,Q.emitMany=void 0,Q.reject=void 0}})}[Symbol.asyncIterator](){let Z=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(Z<this._results.length)return{done:!1,value:this._results[Z++]};if(this._state===1)return{done:!0,value:void 0};await b1.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(Z,X){return new U(async(Q)=>{for await(let K of Z)Q.emitOne(X(K))})}map(Z){return U.map(this,Z)}static filter(Z,X){return new U(async(Q)=>{for await(let K of Z)X(K)&&Q.emitOne(K)})}filter(Z){return U.filter(this,Z)}static coalesce(Z){return U.filter(Z,(X)=>!!X)}coalesce(){return U.coalesce(this)}static async toPromise(Z){let X=[];for await(let Q of Z)X.push(Q);return X}toPromise(){return U.toPromise(this)}emitOne(Z){this._state===0&&(this._results.push(Z),this._onStateChanged.fire())}emitMany(Z){this._state===0&&(this._results=this._results.concat(Z),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(Z){this._state===0&&(this._state=2,this._error=Z,this._onStateChanged.fire())}};C$.EMPTY=C$.fromArray([]);function v2(U){return 55296<=U&&U<=56319}function A$(U){return 56320<=U&&U<=57343}function _2(U,Z){return(U-55296<<10)+(Z-56320)+65536}function B2(U){return KQ(U,0)}function KQ(U,Z){switch(typeof U){case"object":return U===null?BU(349,Z):Array.isArray(U)?N2(U,Z):g2(U,Z);case"string":return LK(U,Z);case"boolean":return x2(U,Z);case"number":return BU(U,Z);case"undefined":return BU(937,Z);default:return BU(617,Z)}}function BU(U,Z){return(Z<<5)-Z+U|0}function x2(U,Z){return BU(U?433:863,Z)}function LK(U,Z){Z=BU(149417,Z);for(let X=0,Q=U.length;X<Q;X++)Z=BU(U.charCodeAt(X),Z);return Z}function N2(U,Z){return Z=BU(104579,Z),U.reduce((X,Q)=>KQ(Q,X),Z)}function g2(U,Z){return Z=BU(181387,Z),Object.keys(U).sort().reduce((X,Q)=>(X=LK(Q,X),KQ(U[Q],X)),Z)}function AJ(U,Z,X=32){let Q=X-Z,K=~((1<<Q)-1);return(U<<Z|(K&U)>>>Q)>>>0}function z$(U,Z=0,X=U.byteLength,Q=0){for(let K=0;K<X;K++)U[Z+K]=Q}function f2(U,Z,X="0"){for(;U.length<Z;)U=X+U;return U}function nZ(U,Z=32){return U instanceof ArrayBuffer?Array.from(new Uint8Array(U)).map((X)=>X.toString(16).padStart(2,"0")).join(""):f2((U>>>0).toString(16),Z/4)}var w2=class U{constructor(){this._h0=1732584193,this._h1=4023233417,this._h2=2562383102,this._h3=271733878,this._h4=3285377520,this._buff=new Uint8Array(67),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(Z){let X=Z.length;if(X===0)return;let Q=this._buff,K=this._buffLen,H=this._leftoverHighSurrogate,$,M;for(H!==0?($=H,M=-1,H=0):($=Z.charCodeAt(0),M=0);;){let q=$;if(v2($))if(M+1<X){let z=Z.charCodeAt(M+1);A$(z)?(M++,q=_2($,z)):q=65533}else{H=$;break}else A$($)&&(q=65533);if(K=this._push(Q,K,q),M++,M<X)$=Z.charCodeAt(M);else break}this._buffLen=K,this._leftoverHighSurrogate=H}_push(Z,X,Q){return Q<128?Z[X++]=Q:Q<2048?(Z[X++]=192|(Q&1984)>>>6,Z[X++]=128|(Q&63)>>>0):Q<65536?(Z[X++]=224|(Q&61440)>>>12,Z[X++]=128|(Q&4032)>>>6,Z[X++]=128|(Q&63)>>>0):(Z[X++]=240|(Q&1835008)>>>18,Z[X++]=128|(Q&258048)>>>12,Z[X++]=128|(Q&4032)>>>6,Z[X++]=128|(Q&63)>>>0),X>=64&&(this._step(),X-=64,this._totalLen+=64,Z[0]=Z[64],Z[1]=Z[65],Z[2]=Z[66]),X}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),nZ(this._h0)+nZ(this._h1)+nZ(this._h2)+nZ(this._h3)+nZ(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,z$(this._buff,this._buffLen),this._buffLen>56&&(this._step(),z$(this._buff));let Z=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(Z/4294967296),!1),this._buffDV.setUint32(60,Z%4294967296,!1),this._step()}_step(){let Z=U._bigBlock32,X=this._buffDV;for(let A=0;A<64;A+=4)Z.setUint32(A,X.getUint32(A,!1),!1);for(let A=64;A<320;A+=4)Z.setUint32(A,AJ(Z.getUint32(A-12,!1)^Z.getUint32(A-32,!1)^Z.getUint32(A-56,!1)^Z.getUint32(A-64,!1),1),!1);let Q=this._h0,K=this._h1,H=this._h2,$=this._h3,M=this._h4,q,z,T;for(let A=0;A<80;A++)A<20?(q=K&H|~K&$,z=1518500249):A<40?(q=K^H^$,z=1859775393):A<60?(q=K&H|K&$|H&$,z=2400959708):(q=K^H^$,z=3395469782),T=AJ(Q,5)+q+M+z+Z.getUint32(A*4,!1)&4294967295,M=$,$=H,H=AJ(K,30),K=Q,Q=T;this._h0=this._h0+Q&4294967295,this._h1=this._h1+K&4294967295,this._h2=this._h2+H&4294967295,this._h3=this._h3+$&4294967295,this._h4=this._h4+M&4294967295}};w2._bigBlock32=new DataView(new ArrayBuffer(320));var{registerWindow:OA,getWindow:OU,getDocument:CA,getWindows:AA,getWindowsCount:zA,getWindowId:D$,getWindowById:DA,hasWindow:MA,onDidRegisterWindow:y2,onWillUnregisterWindow:qA,onDidUnregisterWindow:LA}=function(){let U=new Map,Z={window:$U,disposables:new nU};U.set($U.vscodeWindowId,Z);let X=new w0,Q=new w0,K=new w0;function H($,M){return(typeof $=="number"?U.get($):void 0)??(M?Z:void 0)}return{onDidRegisterWindow:X.event,onWillUnregisterWindow:K.event,onDidUnregisterWindow:Q.event,registerWindow($){if(U.has($.vscodeWindowId))return d0.None;let M=new nU,q={window:$,disposables:M.add(new nU)};return U.set($.vscodeWindowId,q),M.add(U1(()=>{U.delete($.vscodeWindowId),Q.fire($)})),M.add(u0($,f1.BEFORE_UNLOAD,()=>{K.fire($)})),X.fire(q),M},getWindows(){return U.values()},getWindowsCount(){return U.size},getWindowId($){return $.vscodeWindowId},hasWindow($){return U.has($)},getWindowById:H,getWindow($){let M=$;if(M?.ownerDocument?.defaultView)return M.ownerDocument.defaultView.window;let q=$;return q?.view?q.view.window:$U},getDocument($){return OU($).document}}}(),c2=class{constructor(U,Z,X,Q){this._node=U,this._type=Z,this._handler=X,this._options=Q||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function u0(U,Z,X,Q){return new c2(U,Z,X,Q)}function p2(U,Z){return function(X){return Z(new eZ(U,X))}}function h2(U){return function(Z){return U(new cJ(Z))}}var M$=function(U,Z,X,Q){let K=X;return Z==="click"||Z==="mousedown"||Z==="contextmenu"?K=p2(OU(U),X):(Z==="keydown"||Z==="keypress"||Z==="keyup")&&(K=h2(X)),u0(U,Z,K,Q)},u2,tX,b2=class extends P2{constructor(U){super(),this.defaultTarget=U&&OU(U)}cancelAndSet(U,Z,X){return super.cancelAndSet(U,Z,X??this.defaultTarget)}},zJ=class{constructor(U,Z=0){this._runner=U,this.priority=Z,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(U){hX(U)}}static sort(U,Z){return Z.priority-U.priority}};(function(){let U=new Map,Z=new Map,X=new Map,Q=new Map,K=(H)=>{X.set(H,!1);let $=U.get(H)??[];for(Z.set(H,$),U.set(H,[]),Q.set(H,!0);$.length>0;)$.sort(zJ.sort),$.shift().execute();Q.set(H,!1)};tX=(H,$,M=0)=>{let q=D$(H),z=new zJ($,M),T=U.get(q);return T||(T=[],U.set(q,T)),T.push(z),X.get(q)||(X.set(q,!0),H.requestAnimationFrame(()=>K(q))),z},u2=(H,$,M)=>{let q=D$(H);if(Q.get(q)){let z=new zJ($,M),T=Z.get(q);return T||(T=[],Z.set(q,T)),T.push(z),z}else return tX(H,$,M)}})();var q$=class U{constructor(Z,X){this.width=Z,this.height=X}with(Z=this.width,X=this.height){return Z!==this.width||X!==this.height?new U(Z,X):this}static is(Z){return typeof Z=="object"&&typeof Z.height=="number"&&typeof Z.width=="number"}static lift(Z){return Z instanceof U?Z:new U(Z.width,Z.height)}static equals(Z,X){return Z===X?!0:!Z||!X?!1:Z.width===X.width&&Z.height===X.height}};q$.None=new q$(0,0);function d2(U){let Z=U.getBoundingClientRect(),X=OU(U);return{left:Z.left+X.scrollX,top:Z.top+X.scrollY,width:Z.width,height:Z.height}}var TA=new class{constructor(){this.mutationObservers=new Map}observe(U,Z,X){let Q=this.mutationObservers.get(U);Q||(Q=new Map,this.mutationObservers.set(U,Q));let K=B2(X),H=Q.get(K);if(H)H.users+=1;else{let $=new w0,M=new MutationObserver((z)=>$.fire(z));M.observe(U,X);let q=H={users:1,observer:M,onDidMutate:$.event};Z.add(U1(()=>{q.users-=1,q.users===0&&($.dispose(),M.disconnect(),Q?.delete(K),Q?.size===0&&this.mutationObservers.delete(U))})),Q.set(K,H)}return H.onDidMutate}},f1={CLICK:"click",AUXCLICK:"auxclick",DBLCLICK:"dblclick",MOUSE_UP:"mouseup",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_MOVE:"mousemove",MOUSE_OUT:"mouseout",MOUSE_ENTER:"mouseenter",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",POINTER_LEAVE:"pointerleave",CONTEXT_MENU:"contextmenu",WHEEL:"wheel",KEY_DOWN:"keydown",KEY_PRESS:"keypress",KEY_UP:"keyup",LOAD:"load",BEFORE_UNLOAD:"beforeunload",UNLOAD:"unload",PAGE_SHOW:"pageshow",PAGE_HIDE:"pagehide",PASTE:"paste",ABORT:"abort",ERROR:"error",RESIZE:"resize",SCROLL:"scroll",FULLSCREEN_CHANGE:"fullscreenchange",WK_FULLSCREEN_CHANGE:"webkitfullscreenchange",SELECT:"select",CHANGE:"change",SUBMIT:"submit",RESET:"reset",FOCUS:"focus",FOCUS_IN:"focusin",FOCUS_OUT:"focusout",BLUR:"blur",INPUT:"input",STORAGE:"storage",DRAG_START:"dragstart",DRAG:"drag",DRAG_ENTER:"dragenter",DRAG_LEAVE:"dragleave",DRAG_OVER:"dragover",DROP:"drop",DRAG_END:"dragend",ANIMATION_START:dX?"webkitAnimationStart":"animationstart",ANIMATION_END:dX?"webkitAnimationEnd":"animationend",ANIMATION_ITERATION:dX?"webkitAnimationIteration":"animationiteration"},l2=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function TK(U,Z,X,...Q){let K=l2.exec(Z);if(!K)throw Error("Bad use of emmet");let H=K[1]||"div",$;return U!=="http://www.w3.org/1999/xhtml"?$=document.createElementNS(U,H):$=document.createElement(H),K[3]&&($.id=K[3]),K[4]&&($.className=K[4].replace(/\./g," ").trim()),X&&Object.entries(X).forEach(([M,q])=>{typeof q>"u"||(/^on\w+$/.test(M)?$[M]=q:M==="selected"?q&&$.setAttribute(M,"true"):$.setAttribute(M,q))}),$.append(...Q),$}function o2(U,Z,...X){return TK("http://www.w3.org/1999/xhtml",U,Z,...X)}o2.SVG=function(U,Z,...X){return TK("http://www.w3.org/2000/svg",U,Z,...X)};var n2=class{constructor(U){this.domNode=U,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(U){let Z=ZU(U);this._maxWidth!==Z&&(this._maxWidth=Z,this.domNode.style.maxWidth=this._maxWidth)}setWidth(U){let Z=ZU(U);this._width!==Z&&(this._width=Z,this.domNode.style.width=this._width)}setHeight(U){let Z=ZU(U);this._height!==Z&&(this._height=Z,this.domNode.style.height=this._height)}setTop(U){let Z=ZU(U);this._top!==Z&&(this._top=Z,this.domNode.style.top=this._top)}setLeft(U){let Z=ZU(U);this._left!==Z&&(this._left=Z,this.domNode.style.left=this._left)}setBottom(U){let Z=ZU(U);this._bottom!==Z&&(this._bottom=Z,this.domNode.style.bottom=this._bottom)}setRight(U){let Z=ZU(U);this._right!==Z&&(this._right=Z,this.domNode.style.right=this._right)}setPaddingTop(U){let Z=ZU(U);this._paddingTop!==Z&&(this._paddingTop=Z,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(U){let Z=ZU(U);this._paddingLeft!==Z&&(this._paddingLeft=Z,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(U){let Z=ZU(U);this._paddingBottom!==Z&&(this._paddingBottom=Z,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(U){let Z=ZU(U);this._paddingRight!==Z&&(this._paddingRight=Z,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(U){this._fontFamily!==U&&(this._fontFamily=U,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(U){this._fontWeight!==U&&(this._fontWeight=U,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(U){let Z=ZU(U);this._fontSize!==Z&&(this._fontSize=Z,this.domNode.style.fontSize=this._fontSize)}setFontStyle(U){this._fontStyle!==U&&(this._fontStyle=U,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(U){this._fontFeatureSettings!==U&&(this._fontFeatureSettings=U,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(U){this._fontVariationSettings!==U&&(this._fontVariationSettings=U,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(U){this._textDecoration!==U&&(this._textDecoration=U,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(U){let Z=ZU(U);this._lineHeight!==Z&&(this._lineHeight=Z,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(U){let Z=ZU(U);this._letterSpacing!==Z&&(this._letterSpacing=Z,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(U){this._className!==U&&(this._className=U,this.domNode.className=this._className)}toggleClassName(U,Z){this.domNode.classList.toggle(U,Z),this._className=this.domNode.className}setDisplay(U){this._display!==U&&(this._display=U,this.domNode.style.display=this._display)}setPosition(U){this._position!==U&&(this._position=U,this.domNode.style.position=this._position)}setVisibility(U){this._visibility!==U&&(this._visibility=U,this.domNode.style.visibility=this._visibility)}setColor(U){this._color!==U&&(this._color=U,this.domNode.style.color=this._color)}setBackgroundColor(U){this._backgroundColor!==U&&(this._backgroundColor=U,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(U){this._layerHint!==U&&(this._layerHint=U,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(U){this._boxShadow!==U&&(this._boxShadow=U,this.domNode.style.boxShadow=U)}setContain(U){this._contain!==U&&(this._contain=U,this.domNode.style.contain=this._contain)}setAttribute(U,Z){this.domNode.setAttribute(U,Z)}removeAttribute(U){this.domNode.removeAttribute(U)}appendChild(U){this.domNode.appendChild(U.domNode)}removeChild(U){this.domNode.removeChild(U.domNode)}};function ZU(U){return typeof U=="number"?`${U}px`:U}function GX(U){return new n2(U)}var RK=class{constructor(){this._hooks=new nU,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(U,Z){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let X=this._onStopCallback;this._onStopCallback=null,U&&X&&X(Z)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(U,Z,X,Q,K){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=Q,this._onStopCallback=K;let H=U;try{U.setPointerCapture(Z),this._hooks.add(U1(()=>{try{U.releasePointerCapture(Z)}catch{}}))}catch{H=OU(U)}this._hooks.add(u0(H,f1.POINTER_MOVE,($)=>{if($.buttons!==X){this.stopMonitoring(!0);return}$.preventDefault(),this._pointerMoveCallback($)})),this._hooks.add(u0(H,f1.POINTER_UP,($)=>this.stopMonitoring(!0)))}};function m2(U,Z,X){let Q=null,K=null;if(typeof X.value=="function"?(Q="value",K=X.value,K.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof X.get=="function"&&(Q="get",K=X.get),!K)throw Error("not supported");let H=`$memoize$${Z}`;X[Q]=function(...$){return this.hasOwnProperty(H)||Object.defineProperty(this,H,{configurable:!1,enumerable:!1,writable:!1,value:K.apply(this,$)}),this[H]}}var LU;((U)=>(U.Tap="-xterm-gesturetap",U.Change="-xterm-gesturechange",U.Start="-xterm-gesturestart",U.End="-xterm-gesturesend",U.Contextmenu="-xterm-gesturecontextmenu"))(LU||={});var UX=class U extends d0{constructor(){super();this.dispatched=!1,this.targets=new V$,this.ignoreTargets=new V$,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(b1.runAndSubscribe(y2,({window:Z,disposables:X})=>{X.add(u0(Z.document,"touchstart",(Q)=>this.onTouchStart(Q),{passive:!1})),X.add(u0(Z.document,"touchend",(Q)=>this.onTouchEnd(Z,Q))),X.add(u0(Z.document,"touchmove",(Q)=>this.onTouchMove(Q),{passive:!1}))},{window:$U,disposables:this._store}))}static addTarget(Z){if(!U.isTouchDevice())return d0.None;U.INSTANCE||(U.INSTANCE=G$(new U));let X=U.INSTANCE.targets.push(Z);return U1(X)}static ignoreTarget(Z){if(!U.isTouchDevice())return d0.None;U.INSTANCE||(U.INSTANCE=G$(new U));let X=U.INSTANCE.ignoreTargets.push(Z);return U1(X)}static isTouchDevice(){return"ontouchstart"in $U||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(Z){let X=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let Q=0,K=Z.targetTouches.length;Q<K;Q++){let H=Z.targetTouches.item(Q);this.activeTouches[H.identifier]={id:H.identifier,initialTarget:H.target,initialTimeStamp:X,initialPageX:H.pageX,initialPageY:H.pageY,rollingTimestamps:[X],rollingPageX:[H.pageX],rollingPageY:[H.pageY]};let $=this.newGestureEvent(LU.Start,H.target);$.pageX=H.pageX,$.pageY=H.pageY,this.dispatchEvent($)}this.dispatched&&(Z.preventDefault(),Z.stopPropagation(),this.dispatched=!1)}onTouchEnd(Z,X){let Q=Date.now(),K=Object.keys(this.activeTouches).length;for(let H=0,$=X.changedTouches.length;H<$;H++){let M=X.changedTouches.item(H);if(!this.activeTouches.hasOwnProperty(String(M.identifier))){console.warn("move of an UNKNOWN touch",M);continue}let q=this.activeTouches[M.identifier],z=Date.now()-q.initialTimeStamp;if(z<U.HOLD_DELAY&&Math.abs(q.initialPageX-QU(q.rollingPageX))<30&&Math.abs(q.initialPageY-QU(q.rollingPageY))<30){let T=this.newGestureEvent(LU.Tap,q.initialTarget);T.pageX=QU(q.rollingPageX),T.pageY=QU(q.rollingPageY),this.dispatchEvent(T)}else if(z>=U.HOLD_DELAY&&Math.abs(q.initialPageX-QU(q.rollingPageX))<30&&Math.abs(q.initialPageY-QU(q.rollingPageY))<30){let T=this.newGestureEvent(LU.Contextmenu,q.initialTarget);T.pageX=QU(q.rollingPageX),T.pageY=QU(q.rollingPageY),this.dispatchEvent(T)}else if(K===1){let T=QU(q.rollingPageX),A=QU(q.rollingPageY),L=QU(q.rollingTimestamps)-q.rollingTimestamps[0],E=T-q.rollingPageX[0],S=A-q.rollingPageY[0],j=[...this.targets].filter((k)=>q.initialTarget instanceof Node&&k.contains(q.initialTarget));this.inertia(Z,j,Q,Math.abs(E)/L,E>0?1:-1,T,Math.abs(S)/L,S>0?1:-1,A)}this.dispatchEvent(this.newGestureEvent(LU.End,q.initialTarget)),delete this.activeTouches[M.identifier]}this.dispatched&&(X.preventDefault(),X.stopPropagation(),this.dispatched=!1)}newGestureEvent(Z,X){let Q=document.createEvent("CustomEvent");return Q.initEvent(Z,!1,!0),Q.initialTarget=X,Q.tapCount=0,Q}dispatchEvent(Z){if(Z.type===LU.Tap){let X=new Date().getTime(),Q=0;X-this._lastSetTapCountTime>U.CLEAR_TAP_COUNT_TIME?Q=1:Q=2,this._lastSetTapCountTime=X,Z.tapCount=Q}else(Z.type===LU.Change||Z.type===LU.Contextmenu)&&(this._lastSetTapCountTime=0);if(Z.initialTarget instanceof Node){for(let Q of this.ignoreTargets)if(Q.contains(Z.initialTarget))return;let X=[];for(let Q of this.targets)if(Q.contains(Z.initialTarget)){let K=0,H=Z.initialTarget;for(;H&&H!==Q;)K++,H=H.parentElement;X.push([K,Q])}X.sort((Q,K)=>Q[0]-K[0]);for(let[Q,K]of X)K.dispatchEvent(Z),this.dispatched=!0}}inertia(Z,X,Q,K,H,$,M,q,z){this.handle=tX(Z,()=>{let T=Date.now(),A=T-Q,L=0,E=0,S=!0;K+=U.SCROLL_FRICTION*A,M+=U.SCROLL_FRICTION*A,K>0&&(S=!1,L=H*K*A),M>0&&(S=!1,E=q*M*A);let j=this.newGestureEvent(LU.Change);j.translationX=L,j.translationY=E,X.forEach((k)=>k.dispatchEvent(j)),S||this.inertia(Z,X,T,K,H,$+L,M,q,z+E)})}onTouchMove(Z){let X=Date.now();for(let Q=0,K=Z.changedTouches.length;Q<K;Q++){let H=Z.changedTouches.item(Q);if(!this.activeTouches.hasOwnProperty(String(H.identifier))){console.warn("end of an UNKNOWN touch",H);continue}let $=this.activeTouches[H.identifier],M=this.newGestureEvent(LU.Change,$.initialTarget);M.translationX=H.pageX-QU($.rollingPageX),M.translationY=H.pageY-QU($.rollingPageY),M.pageX=H.pageX,M.pageY=H.pageY,this.dispatchEvent(M),$.rollingPageX.length>3&&($.rollingPageX.shift(),$.rollingPageY.shift(),$.rollingTimestamps.shift()),$.rollingPageX.push(H.pageX),$.rollingPageY.push(H.pageY),$.rollingTimestamps.push(X)}this.dispatched&&(Z.preventDefault(),Z.stopPropagation(),this.dispatched=!1)}};UX.SCROLL_FRICTION=-0.005,UX.HOLD_DELAY=700,UX.CLEAR_TAP_COUNT_TIME=400,$1([m2],UX,"isTouchDevice",1);var s2=UX,WQ=class extends d0{onclick(U,Z){this._register(u0(U,f1.CLICK,(X)=>Z(new eZ(OU(U),X))))}onmousedown(U,Z){this._register(u0(U,f1.MOUSE_DOWN,(X)=>Z(new eZ(OU(U),X))))}onmouseover(U,Z){this._register(u0(U,f1.MOUSE_OVER,(X)=>Z(new eZ(OU(U),X))))}onmouseleave(U,Z){this._register(u0(U,f1.MOUSE_LEAVE,(X)=>Z(new eZ(OU(U),X))))}onkeydown(U,Z){this._register(u0(U,f1.KEY_DOWN,(X)=>Z(new cJ(X))))}onkeyup(U,Z){this._register(u0(U,f1.KEY_UP,(X)=>Z(new cJ(X))))}oninput(U,Z){this._register(u0(U,f1.INPUT,Z))}onblur(U,Z){this._register(u0(U,f1.BLUR,Z))}onfocus(U,Z){this._register(u0(U,f1.FOCUS,Z))}onchange(U,Z){this._register(u0(U,f1.CHANGE,Z))}ignoreGesture(U){return s2.ignoreTarget(U)}},L$=11,r2=class extends WQ{constructor(U){super(),this._onActivate=U.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=U.bgWidth+"px",this.bgDomNode.style.height=U.bgHeight+"px",typeof U.top<"u"&&(this.bgDomNode.style.top="0px"),typeof U.left<"u"&&(this.bgDomNode.style.left="0px"),typeof U.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof U.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=U.className,this.domNode.style.position="absolute",this.domNode.style.width=L$+"px",this.domNode.style.height=L$+"px",typeof U.top<"u"&&(this.domNode.style.top=U.top+"px"),typeof U.left<"u"&&(this.domNode.style.left=U.left+"px"),typeof U.bottom<"u"&&(this.domNode.style.bottom=U.bottom+"px"),typeof U.right<"u"&&(this.domNode.style.right=U.right+"px"),this._pointerMoveMonitor=this._register(new RK),this._register(M$(this.bgDomNode,f1.POINTER_DOWN,(Z)=>this._arrowPointerDown(Z))),this._register(M$(this.domNode,f1.POINTER_DOWN,(Z)=>this._arrowPointerDown(Z))),this._pointerdownRepeatTimer=this._register(new b2),this._pointerdownScheduleRepeatTimer=this._register(new $Q)}_arrowPointerDown(U){if(!U.target||!(U.target instanceof Element))return;let Z=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),41.666666666666664,OU(U))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(Z,200),this._pointerMoveMonitor.startMonitoring(U.target,U.pointerId,U.buttons,(X)=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),U.preventDefault()}},a2=class U{constructor(Z,X,Q,K,H,$,M){this._forceIntegerValues=Z,this._scrollStateBrand=void 0,this._forceIntegerValues&&(X=X|0,Q=Q|0,K=K|0,H=H|0,$=$|0,M=M|0),this.rawScrollLeft=K,this.rawScrollTop=M,X<0&&(X=0),K+X>Q&&(K=Q-X),K<0&&(K=0),H<0&&(H=0),M+H>$&&(M=$-H),M<0&&(M=0),this.width=X,this.scrollWidth=Q,this.scrollLeft=K,this.height=H,this.scrollHeight=$,this.scrollTop=M}equals(Z){return this.rawScrollLeft===Z.rawScrollLeft&&this.rawScrollTop===Z.rawScrollTop&&this.width===Z.width&&this.scrollWidth===Z.scrollWidth&&this.scrollLeft===Z.scrollLeft&&this.height===Z.height&&this.scrollHeight===Z.scrollHeight&&this.scrollTop===Z.scrollTop}withScrollDimensions(Z,X){return new U(this._forceIntegerValues,typeof Z.width<"u"?Z.width:this.width,typeof Z.scrollWidth<"u"?Z.scrollWidth:this.scrollWidth,X?this.rawScrollLeft:this.scrollLeft,typeof Z.height<"u"?Z.height:this.height,typeof Z.scrollHeight<"u"?Z.scrollHeight:this.scrollHeight,X?this.rawScrollTop:this.scrollTop)}withScrollPosition(Z){return new U(this._forceIntegerValues,this.width,this.scrollWidth,typeof Z.scrollLeft<"u"?Z.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof Z.scrollTop<"u"?Z.scrollTop:this.rawScrollTop)}createScrollEvent(Z,X){let Q=this.width!==Z.width,K=this.scrollWidth!==Z.scrollWidth,H=this.scrollLeft!==Z.scrollLeft,$=this.height!==Z.height,M=this.scrollHeight!==Z.scrollHeight,q=this.scrollTop!==Z.scrollTop;return{inSmoothScrolling:X,oldWidth:Z.width,oldScrollWidth:Z.scrollWidth,oldScrollLeft:Z.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:Z.height,oldScrollHeight:Z.scrollHeight,oldScrollTop:Z.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:Q,scrollWidthChanged:K,scrollLeftChanged:H,heightChanged:$,scrollHeightChanged:M,scrollTopChanged:q}}},t2=class extends d0{constructor(U){super();this._scrollableBrand=void 0,this._onScroll=this._register(new w0),this.onScroll=this._onScroll.event,this._smoothScrollDuration=U.smoothScrollDuration,this._scheduleAtNextAnimationFrame=U.scheduleAtNextAnimationFrame,this._state=new a2(U.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(U){this._smoothScrollDuration=U}validateScrollPosition(U){return this._state.withScrollPosition(U)}getScrollDimensions(){return this._state}setScrollDimensions(U,Z){let X=this._state.withScrollDimensions(U,Z);this._setState(X,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(U){let Z=this._state.withScrollPosition(U);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(Z,!1)}setScrollPositionSmooth(U,Z){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(U);if(this._smoothScrolling){U={scrollLeft:typeof U.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:U.scrollLeft,scrollTop:typeof U.scrollTop>"u"?this._smoothScrolling.to.scrollTop:U.scrollTop};let X=this._state.withScrollPosition(U);if(this._smoothScrolling.to.scrollLeft===X.scrollLeft&&this._smoothScrolling.to.scrollTop===X.scrollTop)return;let Q;Z?Q=new R$(this._smoothScrolling.from,X,this._smoothScrolling.startTime,this._smoothScrolling.duration):Q=this._smoothScrolling.combine(this._state,X,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=Q}else{let X=this._state.withScrollPosition(U);this._smoothScrolling=R$.start(this._state,X,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let U=this._smoothScrolling.tick(),Z=this._state.withScrollPosition(U);if(this._setState(Z,!0),!!this._smoothScrolling){if(U.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(U,Z){let X=this._state;X.equals(U)||(this._state=U,this._onScroll.fire(this._state.createScrollEvent(X,Z)))}},T$=class{constructor(U,Z,X){this.scrollLeft=U,this.scrollTop=Z,this.isDone=X}};function DJ(U,Z){let X=Z-U;return function(Q){return U+X*U8(Q)}}function i2(U,Z,X){return function(Q){return Q<X?U(Q/X):Z((Q-X)/(1-X))}}var R$=class U{constructor(Z,X,Q,K){this.from=Z,this.to=X,this.duration=K,this.startTime=Q,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(Z,X,Q){if(Math.abs(Z-X)>2.5*Q){let K,H;return Z<X?(K=Z+0.75*Q,H=X-0.75*Q):(K=Z-0.75*Q,H=X+0.75*Q),i2(DJ(Z,K),DJ(H,X),0.33)}return DJ(Z,X)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(Z){this.to=Z.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(Z){let X=(Z-this.startTime)/this.duration;if(X<1){let Q=this.scrollLeft(X),K=this.scrollTop(X);return new T$(Q,K,!1)}return new T$(this.to.scrollLeft,this.to.scrollTop,!0)}combine(Z,X,Q){return U.start(Z,X,Q)}static start(Z,X,Q){Q=Q+10;let K=Date.now()-10;return new U(Z,X,K,Q)}};function e2(U){return Math.pow(U,3)}function U8(U){return 1-e2(1-U)}var Z8=class extends d0{constructor(U,Z,X){super(),this._visibility=U,this._visibleClassName=Z,this._invisibleClassName=X,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new $Q)}setVisibility(U){this._visibility!==U&&(this._visibility=U,this._updateShouldBeVisible())}setShouldBeVisible(U){this._rawShouldBeVisible=U,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let U=this._applyVisibilitySetting();this._shouldBeVisible!==U&&(this._shouldBeVisible=U,this.ensureVisibility())}setIsNeeded(U){this._isNeeded!==U&&(this._isNeeded=U,this.ensureVisibility())}setDomNode(U){this._domNode=U,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(U){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(U?" fade":"")))}},X8=140,EK=class extends WQ{constructor(U){super(),this._lazyRender=U.lazyRender,this._host=U.host,this._scrollable=U.scrollable,this._scrollByPage=U.scrollByPage,this._scrollbarState=U.scrollbarState,this._visibilityController=this._register(new Z8(U.visibility,"visible scrollbar "+U.extraScrollbarClassName,"invisible scrollbar "+U.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new RK),this._shouldRender=!0,this.domNode=GX(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(u0(this.domNode.domNode,f1.POINTER_DOWN,(Z)=>this._domNodePointerDown(Z)))}_createArrow(U){let Z=this._register(new r2(U));this.domNode.domNode.appendChild(Z.bgDomNode),this.domNode.domNode.appendChild(Z.domNode)}_createSlider(U,Z,X,Q){this.slider=GX(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(U),this.slider.setLeft(Z),typeof X=="number"&&this.slider.setWidth(X),typeof Q=="number"&&this.slider.setHeight(Q),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(u0(this.slider.domNode,f1.POINTER_DOWN,(K)=>{K.button===0&&(K.preventDefault(),this._sliderPointerDown(K))})),this.onclick(this.slider.domNode,(K)=>{K.leftButton&&K.stopPropagation()})}_onElementSize(U){return this._scrollbarState.setVisibleSize(U)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(U){return this._scrollbarState.setScrollSize(U)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(U){return this._scrollbarState.setScrollPosition(U)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(U){U.target===this.domNode.domNode&&this._onPointerDown(U)}delegatePointerDown(U){let Z=this.domNode.domNode.getClientRects()[0].top,X=Z+this._scrollbarState.getSliderPosition(),Q=Z+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),K=this._sliderPointerPosition(U);X<=K&&K<=Q?U.button===0&&(U.preventDefault(),this._sliderPointerDown(U)):this._onPointerDown(U)}_onPointerDown(U){let Z,X;if(U.target===this.domNode.domNode&&typeof U.offsetX=="number"&&typeof U.offsetY=="number")Z=U.offsetX,X=U.offsetY;else{let K=d2(this.domNode.domNode);Z=U.pageX-K.left,X=U.pageY-K.top}let Q=this._pointerDownRelativePosition(Z,X);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(Q):this._scrollbarState.getDesiredScrollPositionFromOffset(Q)),U.button===0&&(U.preventDefault(),this._sliderPointerDown(U))}_sliderPointerDown(U){if(!U.target||!(U.target instanceof Element))return;let Z=this._sliderPointerPosition(U),X=this._sliderOrthogonalPointerPosition(U),Q=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(U.target,U.pointerId,U.buttons,(K)=>{let H=this._sliderOrthogonalPointerPosition(K),$=Math.abs(H-X);if(DK&&$>X8){this._setDesiredScrollPositionNow(Q.getScrollPosition());return}let M=this._sliderPointerPosition(K)-Z;this._setDesiredScrollPositionNow(Q.getDesiredScrollPositionFromDelta(M))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(U){let Z={};this.writeScrollPosition(Z,U),this._scrollable.setScrollPositionNow(Z)}updateScrollbarSize(U){this._updateScrollbarSize(U),this._scrollbarState.setScrollbarSize(U),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},SK=class U{constructor(Z,X,Q,K,H,$){this._scrollbarSize=Math.round(X),this._oppositeScrollbarSize=Math.round(Q),this._arrowSize=Math.round(Z),this._visibleSize=K,this._scrollSize=H,this._scrollPosition=$,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new U(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(Z){let X=Math.round(Z);return this._visibleSize!==X?(this._visibleSize=X,this._refreshComputedValues(),!0):!1}setScrollSize(Z){let X=Math.round(Z);return this._scrollSize!==X?(this._scrollSize=X,this._refreshComputedValues(),!0):!1}setScrollPosition(Z){let X=Math.round(Z);return this._scrollPosition!==X?(this._scrollPosition=X,this._refreshComputedValues(),!0):!1}setScrollbarSize(Z){this._scrollbarSize=Math.round(Z)}setOppositeScrollbarSize(Z){this._oppositeScrollbarSize=Math.round(Z)}static _computeValues(Z,X,Q,K,H){let $=Math.max(0,Q-Z),M=Math.max(0,$-2*X),q=K>0&&K>Q;if(!q)return{computedAvailableSize:Math.round($),computedIsNeeded:q,computedSliderSize:Math.round(M),computedSliderRatio:0,computedSliderPosition:0};let z=Math.round(Math.max(20,Math.floor(Q*M/K))),T=(M-z)/(K-Q),A=H*T;return{computedAvailableSize:Math.round($),computedIsNeeded:q,computedSliderSize:Math.round(z),computedSliderRatio:T,computedSliderPosition:Math.round(A)}}_refreshComputedValues(){let Z=U._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=Z.computedAvailableSize,this._computedIsNeeded=Z.computedIsNeeded,this._computedSliderSize=Z.computedSliderSize,this._computedSliderRatio=Z.computedSliderRatio,this._computedSliderPosition=Z.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(Z){if(!this._computedIsNeeded)return 0;let X=Z-this._arrowSize-this._computedSliderSize/2;return Math.round(X/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(Z){if(!this._computedIsNeeded)return 0;let X=Z-this._arrowSize,Q=this._scrollPosition;return X<this._computedSliderPosition?Q-=this._visibleSize:Q+=this._visibleSize,Q}getDesiredScrollPositionFromDelta(Z){if(!this._computedIsNeeded)return 0;let X=this._computedSliderPosition+Z;return Math.round(X/this._computedSliderRatio)}},Y8=class extends EK{constructor(U,Z,X){let Q=U.getScrollDimensions(),K=U.getCurrentScrollPosition();if(super({lazyRender:Z.lazyRender,host:X,scrollbarState:new SK(Z.horizontalHasArrows?Z.arrowSize:0,Z.horizontal===2?0:Z.horizontalScrollbarSize,Z.vertical===2?0:Z.verticalScrollbarSize,Q.width,Q.scrollWidth,K.scrollLeft),visibility:Z.horizontal,extraScrollbarClassName:"horizontal",scrollable:U,scrollByPage:Z.scrollByPage}),Z.horizontalHasArrows)throw Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((Z.horizontalScrollbarSize-Z.horizontalSliderSize)/2),0,void 0,Z.horizontalSliderSize)}_updateSlider(U,Z){this.slider.setWidth(U),this.slider.setLeft(Z)}_renderDomNode(U,Z){this.domNode.setWidth(U),this.domNode.setHeight(Z),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(U){return this._shouldRender=this._onElementScrollSize(U.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(U.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(U.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(U,Z){return U}_sliderPointerPosition(U){return U.pageX}_sliderOrthogonalPointerPosition(U){return U.pageY}_updateScrollbarSize(U){this.slider.setHeight(U)}writeScrollPosition(U,Z){U.scrollLeft=Z}updateOptions(U){this.updateScrollbarSize(U.horizontal===2?0:U.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(U.vertical===2?0:U.verticalScrollbarSize),this._visibilityController.setVisibility(U.horizontal),this._scrollByPage=U.scrollByPage}},J8=class extends EK{constructor(U,Z,X){let Q=U.getScrollDimensions(),K=U.getCurrentScrollPosition();if(super({lazyRender:Z.lazyRender,host:X,scrollbarState:new SK(Z.verticalHasArrows?Z.arrowSize:0,Z.vertical===2?0:Z.verticalScrollbarSize,0,Q.height,Q.scrollHeight,K.scrollTop),visibility:Z.vertical,extraScrollbarClassName:"vertical",scrollable:U,scrollByPage:Z.scrollByPage}),Z.verticalHasArrows)throw Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((Z.verticalScrollbarSize-Z.verticalSliderSize)/2),Z.verticalSliderSize,void 0)}_updateSlider(U,Z){this.slider.setHeight(U),this.slider.setTop(Z)}_renderDomNode(U,Z){this.domNode.setWidth(Z),this.domNode.setHeight(U),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(U){return this._shouldRender=this._onElementScrollSize(U.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(U.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(U.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(U,Z){return Z}_sliderPointerPosition(U){return U.pageY}_sliderOrthogonalPointerPosition(U){return U.pageX}_updateScrollbarSize(U){this.slider.setWidth(U)}writeScrollPosition(U,Z){U.scrollTop=Z}updateOptions(U){this.updateScrollbarSize(U.vertical===2?0:U.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(U.vertical),this._scrollByPage=U.scrollByPage}},Q8=500,E$=50,S$=!0,G8=class{constructor(U,Z,X){this.timestamp=U,this.deltaX=Z,this.deltaY=X,this.score=0}},pJ=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let Z=1,X=0,Q=1,K=this._rear;do{let H=K===this._front?Z:Math.pow(2,-Q);if(Z-=H,X+=this._memory[K].score*H,K===this._front)break;K=(this._capacity+K-1)%this._capacity,Q++}while(!0);return X<=0.5}acceptStandardWheelEvent(Z){if(GQ){let X=OU(Z.browserEvent),Q=eO(X);this.accept(Date.now(),Z.deltaX*Q,Z.deltaY*Q)}else this.accept(Date.now(),Z.deltaX,Z.deltaY)}accept(Z,X,Q){let K=null,H=new G8(Z,X,Q);this._front===-1&&this._rear===-1?(this._memory[0]=H,this._front=0,this._rear=0):(K=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=H),H.score=this._computeScore(H,K)}_computeScore(Z,X){if(Math.abs(Z.deltaX)>0&&Math.abs(Z.deltaY)>0)return 1;let Q=0.5;if((!this._isAlmostInt(Z.deltaX)||!this._isAlmostInt(Z.deltaY))&&(Q+=0.25),X){let K=Math.abs(Z.deltaX),H=Math.abs(Z.deltaY),$=Math.abs(X.deltaX),M=Math.abs(X.deltaY),q=Math.max(Math.min(K,$),1),z=Math.max(Math.min(H,M),1),T=Math.max(K,$),A=Math.max(H,M);T%q===0&&A%z===0&&(Q-=0.5)}return Math.min(Math.max(Q,0),1)}_isAlmostInt(Z){return Math.abs(Math.round(Z)-Z)<0.01}};pJ.INSTANCE=new pJ;var V8=pJ,$8=class extends WQ{constructor(U,Z,X){super();this._onScroll=this._register(new w0),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new w0),this.onWillScroll=this._onWillScroll.event,this._options=W8(Z),this._scrollable=X,this._register(this._scrollable.onScroll((K)=>{this._onWillScroll.fire(K),this._onDidScroll(K),this._onScroll.fire(K)}));let Q={onMouseWheel:(K)=>this._onMouseWheel(K),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new J8(this._scrollable,this._options,Q)),this._horizontalScrollbar=this._register(new Y8(this._scrollable,this._options,Q)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(U),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=GX(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=GX(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=GX(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,(K)=>this._onMouseOver(K)),this.onmouseleave(this._listenOnDomNode,(K)=>this._onMouseLeave(K)),this._hideTimeout=this._register(new $Q),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=VZ(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(U){this._verticalScrollbar.delegatePointerDown(U)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(U){this._scrollable.setScrollDimensions(U,!1)}updateClassName(U){this._options.className=U,TU&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(U){typeof U.handleMouseWheel<"u"&&(this._options.handleMouseWheel=U.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof U.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=U.mouseWheelScrollSensitivity),typeof U.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=U.fastScrollSensitivity),typeof U.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=U.scrollPredominantAxis),typeof U.horizontal<"u"&&(this._options.horizontal=U.horizontal),typeof U.vertical<"u"&&(this._options.vertical=U.vertical),typeof U.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=U.horizontalScrollbarSize),typeof U.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=U.verticalScrollbarSize),typeof U.scrollByPage<"u"&&(this._options.scrollByPage=U.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(U){this._revealOnScroll=U}delegateScrollFromMouseWheelEvent(U){this._onMouseWheel(new O$(U))}_setListeningToMouseWheel(U){if(this._mouseWheelToDispose.length>0!==U&&(this._mouseWheelToDispose=VZ(this._mouseWheelToDispose),U)){let Z=(X)=>{this._onMouseWheel(new O$(X))};this._mouseWheelToDispose.push(u0(this._listenOnDomNode,f1.MOUSE_WHEEL,Z,{passive:!1}))}}_onMouseWheel(U){if(U.browserEvent?.defaultPrevented)return;let Z=V8.INSTANCE;S$&&Z.acceptStandardWheelEvent(U);let X=!1;if(U.deltaY||U.deltaX){let K=U.deltaY*this._options.mouseWheelScrollSensitivity,H=U.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&H+K===0?H=K=0:Math.abs(K)>=Math.abs(H)?H=0:K=0),this._options.flipAxes&&([K,H]=[H,K]);let $=!TU&&U.browserEvent&&U.browserEvent.shiftKey;(this._options.scrollYToX||$)&&!H&&(H=K,K=0),U.browserEvent&&U.browserEvent.altKey&&(H=H*this._options.fastScrollSensitivity,K=K*this._options.fastScrollSensitivity);let M=this._scrollable.getFutureScrollPosition(),q={};if(K){let z=E$*K,T=M.scrollTop-(z<0?Math.floor(z):Math.ceil(z));this._verticalScrollbar.writeScrollPosition(q,T)}if(H){let z=E$*H,T=M.scrollLeft-(z<0?Math.floor(z):Math.ceil(z));this._horizontalScrollbar.writeScrollPosition(q,T)}q=this._scrollable.validateScrollPosition(q),(M.scrollLeft!==q.scrollLeft||M.scrollTop!==q.scrollTop)&&(S$&&this._options.mouseWheelSmoothScroll&&Z.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(q):this._scrollable.setScrollPositionNow(q),X=!0)}let Q=X;!Q&&this._options.alwaysConsumeMouseWheel&&(Q=!0),!Q&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(Q=!0),Q&&(U.preventDefault(),U.stopPropagation())}_onDidScroll(U){this._shouldRender=this._horizontalScrollbar.onDidScroll(U)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(U)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let U=this._scrollable.getCurrentScrollPosition(),Z=U.scrollTop>0,X=U.scrollLeft>0,Q=X?" left":"",K=Z?" top":"",H=X||Z?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${Q}`),this._topShadowDomNode.setClassName(`shadow${K}`),this._topLeftShadowDomNode.setClassName(`shadow${H}${K}${Q}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(U){this._mouseIsOver=!1,this._hide()}_onMouseOver(U){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),Q8)}},K8=class extends $8{constructor(U,Z,X){super(U,Z,X)}setScrollPosition(U){U.reuseAnimation?this._scrollable.setScrollPositionSmooth(U,U.reuseAnimation):this._scrollable.setScrollPositionNow(U)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function W8(U){let Z={lazyRender:typeof U.lazyRender<"u"?U.lazyRender:!1,className:typeof U.className<"u"?U.className:"",useShadows:typeof U.useShadows<"u"?U.useShadows:!0,handleMouseWheel:typeof U.handleMouseWheel<"u"?U.handleMouseWheel:!0,flipAxes:typeof U.flipAxes<"u"?U.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof U.consumeMouseWheelIfScrollbarIsNeeded<"u"?U.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof U.alwaysConsumeMouseWheel<"u"?U.alwaysConsumeMouseWheel:!1,scrollYToX:typeof U.scrollYToX<"u"?U.scrollYToX:!1,mouseWheelScrollSensitivity:typeof U.mouseWheelScrollSensitivity<"u"?U.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof U.fastScrollSensitivity<"u"?U.fastScrollSensitivity:5,scrollPredominantAxis:typeof U.scrollPredominantAxis<"u"?U.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof U.mouseWheelSmoothScroll<"u"?U.mouseWheelSmoothScroll:!0,arrowSize:typeof U.arrowSize<"u"?U.arrowSize:11,listenOnDomNode:typeof U.listenOnDomNode<"u"?U.listenOnDomNode:null,horizontal:typeof U.horizontal<"u"?U.horizontal:1,horizontalScrollbarSize:typeof U.horizontalScrollbarSize<"u"?U.horizontalScrollbarSize:10,horizontalSliderSize:typeof U.horizontalSliderSize<"u"?U.horizontalSliderSize:0,horizontalHasArrows:typeof U.horizontalHasArrows<"u"?U.horizontalHasArrows:!1,vertical:typeof U.vertical<"u"?U.vertical:1,verticalScrollbarSize:typeof U.verticalScrollbarSize<"u"?U.verticalScrollbarSize:10,verticalHasArrows:typeof U.verticalHasArrows<"u"?U.verticalHasArrows:!1,verticalSliderSize:typeof U.verticalSliderSize<"u"?U.verticalSliderSize:0,scrollByPage:typeof U.scrollByPage<"u"?U.scrollByPage:!1};return Z.horizontalSliderSize=typeof U.horizontalSliderSize<"u"?U.horizontalSliderSize:Z.horizontalScrollbarSize,Z.verticalSliderSize=typeof U.verticalSliderSize<"u"?U.verticalSliderSize:Z.verticalScrollbarSize,TU&&(Z.className+=" mac"),Z}var hJ=class extends d0{constructor(U,Z,X,Q,K,H,$,M){super();this._bufferService=X,this._optionsService=$,this._renderService=M,this._onRequestScrollLines=this._register(new w0),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let q=this._register(new t2({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:(z)=>tX(Q.window,z)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{q.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new K8(Z,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},q)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(K.onProtocolChange((z)=>{this._scrollableElement.updateOptions({handleMouseWheel:!(z&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(b1.runAndSubscribe(H.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=H.colors.background.css})),U.appendChild(this._scrollableElement.getDomNode()),this._register(U1(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=Q.mainDocument.createElement("style"),Z.appendChild(this._styleElement),this._register(U1(()=>this._styleElement.remove())),this._register(b1.runAndSubscribe(H.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${H.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${H.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${H.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
|
|
358
|
-
`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll((z)=>this._handleScroll(z)))}scrollLines(U){let Z=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:Z.scrollTop+U*this._renderService.dimensions.css.cell.height})}scrollToLine(U,Z){Z&&(this._latestYDisp=U),this._scrollableElement.setScrollPosition({reuseAnimation:!Z,scrollTop:U*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(U){U!==void 0&&(this._latestYDisp=U),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(U=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,U!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:U*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(U){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let Z=Math.round(U.scrollTop/this._renderService.dimensions.css.cell.height),X=Z-this._bufferService.buffer.ydisp;X!==0&&(this._latestYDisp=Z,this._onRequestScrollLines.fire(X)),this._isHandlingScroll=!1}};hJ=$1([c0(2,r1),c0(3,NU),c0(4,QK),c0(5,SZ),c0(6,a1),c0(7,gU)],hJ);var uJ=class extends d0{constructor(U,Z,X,Q,K){super();this._screenElement=U,this._bufferService=Z,this._coreBrowserService=X,this._decorationService=Q,this._renderService=K,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved((H)=>this._removeDecoration(H))),this._register(U1(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let U of this._decorationService.decorations)this._renderDecoration(U);this._dimensionsChanged=!1}_renderDecoration(U){this._refreshStyle(U),this._dimensionsChanged&&this._refreshXPosition(U)}_createElement(U){let Z=this._coreBrowserService.mainDocument.createElement("div");Z.classList.add("xterm-decoration"),Z.classList.toggle("xterm-decoration-top-layer",U?.options?.layer==="top"),Z.style.width=`${Math.round((U.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,Z.style.height=`${(U.options.height||1)*this._renderService.dimensions.css.cell.height}px`,Z.style.top=`${(U.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,Z.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let X=U.options.x??0;return X&&X>this._bufferService.cols&&(Z.style.display="none"),this._refreshXPosition(U,Z),Z}_refreshStyle(U){let Z=U.marker.line-this._bufferService.buffers.active.ydisp;if(Z<0||Z>=this._bufferService.rows)U.element&&(U.element.style.display="none",U.onRenderEmitter.fire(U.element));else{let X=this._decorationElements.get(U);X||(X=this._createElement(U),U.element=X,this._decorationElements.set(U,X),this._container.appendChild(X),U.onDispose(()=>{this._decorationElements.delete(U),X.remove()})),X.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(X.style.width=`${Math.round((U.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,X.style.height=`${(U.options.height||1)*this._renderService.dimensions.css.cell.height}px`,X.style.top=`${Z*this._renderService.dimensions.css.cell.height}px`,X.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),U.onRenderEmitter.fire(X)}}_refreshXPosition(U,Z=U.element){if(!Z)return;let X=U.options.x??0;(U.options.anchor||"left")==="right"?Z.style.right=X?`${X*this._renderService.dimensions.css.cell.width}px`:"":Z.style.left=X?`${X*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(U){this._decorationElements.get(U)?.remove(),this._decorationElements.delete(U),U.dispose()}};uJ=$1([c0(1,r1),c0(2,NU),c0(3,HX),c0(4,gU)],uJ);var I8=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(U){if(U.options.overviewRulerOptions){for(let Z of this._zones)if(Z.color===U.options.overviewRulerOptions.color&&Z.position===U.options.overviewRulerOptions.position){if(this._lineIntersectsZone(Z,U.marker.line))return;if(this._lineAdjacentToZone(Z,U.marker.line,U.options.overviewRulerOptions.position)){this._addLineToZone(Z,U.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=U.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=U.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=U.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=U.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:U.options.overviewRulerOptions.color,position:U.options.overviewRulerOptions.position,startBufferLine:U.marker.line,endBufferLine:U.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(U){this._linePadding=U}_lineIntersectsZone(U,Z){return Z>=U.startBufferLine&&Z<=U.endBufferLine}_lineAdjacentToZone(U,Z,X){return Z>=U.startBufferLine-this._linePadding[X||"full"]&&Z<=U.endBufferLine+this._linePadding[X||"full"]}_addLineToZone(U,Z){U.startBufferLine=Math.min(U.startBufferLine,Z),U.endBufferLine=Math.max(U.endBufferLine,Z)}},MU={full:0,left:0,center:0,right:0},bU={full:0,left:0,center:0,right:0},mZ={full:0,left:0,center:0,right:0},iX=class extends d0{constructor(U,Z,X,Q,K,H,$,M){super();this._viewportElement=U,this._screenElement=Z,this._bufferService=X,this._decorationService=Q,this._renderService=K,this._optionsService=H,this._themeService=$,this._coreBrowserService=M,this._colorZoneStore=new I8,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register(U1(()=>this._canvas?.remove()));let q=this._canvas.getContext("2d");if(q)this._ctx=q;else throw Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let U=Math.floor((this._canvas.width-1)/3),Z=Math.ceil((this._canvas.width-1)/3);bU.full=this._canvas.width,bU.left=U,bU.center=Z,bU.right=U,this._refreshDrawHeightConstants(),mZ.full=1,mZ.left=1,mZ.center=1+bU.left,mZ.right=1+bU.left+bU.center}_refreshDrawHeightConstants(){MU.full=Math.round(2*this._coreBrowserService.dpr);let U=this._canvas.height/this._bufferService.buffer.lines.length,Z=Math.round(Math.max(Math.min(U,12),6)*this._coreBrowserService.dpr);MU.left=Z,MU.center=Z,MU.right=Z}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*MU.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*MU.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*MU.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*MU.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let Z of this._decorationService.decorations)this._colorZoneStore.addDecoration(Z);this._ctx.lineWidth=1,this._renderRulerOutline();let U=this._colorZoneStore.zones;for(let Z of U)Z.position!=="full"&&this._renderColorZone(Z);for(let Z of U)Z.position==="full"&&this._renderColorZone(Z);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(U){this._ctx.fillStyle=U.color,this._ctx.fillRect(mZ[U.position||"full"],Math.round((this._canvas.height-1)*(U.startBufferLine/this._bufferService.buffers.active.lines.length)-MU[U.position||"full"]/2),bU[U.position||"full"],Math.round((this._canvas.height-1)*((U.endBufferLine-U.startBufferLine)/this._bufferService.buffers.active.lines.length)+MU[U.position||"full"]))}_queueRefresh(U,Z){this._shouldUpdateDimensions=U||this._shouldUpdateDimensions,this._shouldUpdateAnchor=Z||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};iX=$1([c0(2,r1),c0(3,HX),c0(4,gU),c0(5,a1),c0(6,SZ),c0(7,NU)],iX);var D0;((U)=>(U.NUL="\x00",U.SOH="\x01",U.STX="\x02",U.ETX="\x03",U.EOT="\x04",U.ENQ="\x05",U.ACK="\x06",U.BEL="\x07",U.BS="\b",U.HT="\t",U.LF=`
|
|
359
|
-
`,U.VT="\v",U.FF="\f",U.CR="\r",U.SO="\x0E",U.SI="\x0F",U.DLE="\x10",U.DC1="\x11",U.DC2="\x12",U.DC3="\x13",U.DC4="\x14",U.NAK="\x15",U.SYN="\x16",U.ETB="\x17",U.CAN="\x18",U.EM="\x19",U.SUB="\x1A",U.ESC="\x1B",U.FS="\x1C",U.GS="\x1D",U.RS="\x1E",U.US="\x1F",U.SP=" ",U.DEL=""))(D0||={});var nX;((U)=>(U.PAD="",U.HOP="",U.BPH="",U.NBH="",U.IND="",U.NEL="
",U.SSA="",U.ESA="",U.HTS="",U.HTJ="",U.VTS="",U.PLD="",U.PLU="",U.RI="",U.SS2="",U.SS3="",U.DCS="",U.PU1="",U.PU2="",U.STS="",U.CCH="",U.MW="",U.SPA="",U.EPA="",U.SOS="",U.SGCI="",U.SCI="",U.CSI="",U.ST="",U.OSC="",U.PM="",U.APC=""))(nX||={});var PK;((U)=>U.ST=`${D0.ESC}\\`)(PK||={});var bJ=class{constructor(U,Z,X,Q,K,H){this._textarea=U,this._compositionView=Z,this._bufferService=X,this._optionsService=Q,this._coreService=K,this._renderService=H,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(U){this._compositionView.textContent=U.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(U){if(this._isComposing||this._isSendingComposition){if(U.keyCode===20||U.keyCode===229||U.keyCode===16||U.keyCode===17||U.keyCode===18)return!1;this._finalizeComposition(!1)}return U.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(U){if(this._compositionView.classList.remove("active"),this._isComposing=!1,U){let Z={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let X;Z.start+=this._dataAlreadySent.length,this._isComposing?X=this._textarea.value.substring(Z.start,this._compositionPosition.start):X=this._textarea.value.substring(Z.start),X.length>0&&this._coreService.triggerDataEvent(X,!0)}},0)}else{this._isSendingComposition=!1;let Z=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(Z,!0)}}_handleAnyTextareaChanges(){let U=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let Z=this._textarea.value,X=Z.replace(U,"");this._dataAlreadySent=X,Z.length>U.length?this._coreService.triggerDataEvent(X,!0):Z.length<U.length?this._coreService.triggerDataEvent(`${D0.DEL}`,!0):Z.length===U.length&&Z!==U&&this._coreService.triggerDataEvent(Z,!0)}},0)}updateCompositionElements(U){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let Z=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),X=this._renderService.dimensions.css.cell.height,Q=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,K=Z*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=K+"px",this._compositionView.style.top=Q+"px",this._compositionView.style.height=X+"px",this._compositionView.style.lineHeight=X+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let H=this._compositionView.getBoundingClientRect();this._textarea.style.left=K+"px",this._textarea.style.top=Q+"px",this._textarea.style.width=Math.max(H.width,1)+"px",this._textarea.style.height=Math.max(H.height,1)+"px",this._textarea.style.lineHeight=H.height+"px"}U||setTimeout(()=>this.updateCompositionElements(!0),0)}}};bJ=$1([c0(2,r1),c0(3,a1),c0(4,KZ),c0(5,gU)],bJ);var w1=0,y1=0,c1=0,V1=0,P$={css:"#00000000",rgba:0},H1;((U)=>{function Z(K,H,$,M){return M!==void 0?`#${XZ(K)}${XZ(H)}${XZ($)}${XZ(M)}`:`#${XZ(K)}${XZ(H)}${XZ($)}`}U.toCss=Z;function X(K,H,$,M=255){return(K<<24|H<<16|$<<8|M)>>>0}U.toRgba=X;function Q(K,H,$,M){return{css:U.toCss(K,H,$,M),rgba:U.toRgba(K,H,$,M)}}U.toColor=Q})(H1||={});var e0;((U)=>{function Z(q,z){if(V1=(z.rgba&255)/255,V1===1)return{css:z.css,rgba:z.rgba};let T=z.rgba>>24&255,A=z.rgba>>16&255,L=z.rgba>>8&255,E=q.rgba>>24&255,S=q.rgba>>16&255,j=q.rgba>>8&255;w1=E+Math.round((T-E)*V1),y1=S+Math.round((A-S)*V1),c1=j+Math.round((L-j)*V1);let k=H1.toCss(w1,y1,c1),B=H1.toRgba(w1,y1,c1);return{css:k,rgba:B}}U.blend=Z;function X(q){return(q.rgba&255)===255}U.isOpaque=X;function Q(q,z,T){let A=mX.ensureContrastRatio(q.rgba,z.rgba,T);if(A)return H1.toColor(A>>24&255,A>>16&255,A>>8&255)}U.ensureContrastRatio=Q;function K(q){let z=(q.rgba|255)>>>0;return[w1,y1,c1]=mX.toChannels(z),{css:H1.toCss(w1,y1,c1),rgba:z}}U.opaque=K;function H(q,z){return V1=Math.round(z*255),[w1,y1,c1]=mX.toChannels(q.rgba),{css:H1.toCss(w1,y1,c1,V1),rgba:H1.toRgba(w1,y1,c1,V1)}}U.opacity=H;function $(q,z){return V1=q.rgba&255,H(q,V1*z/255)}U.multiplyOpacity=$;function M(q){return[q.rgba>>24&255,q.rgba>>16&255,q.rgba>>8&255]}U.toColorRGB=M})(e0||={});var Y1;((U)=>{let Z,X;try{let K=document.createElement("canvas");K.width=1,K.height=1;let H=K.getContext("2d",{willReadFrequently:!0});H&&(Z=H,Z.globalCompositeOperation="copy",X=Z.createLinearGradient(0,0,1,1))}catch{}function Q(K){if(K.match(/#[\da-f]{3,8}/i))switch(K.length){case 4:return w1=parseInt(K.slice(1,2).repeat(2),16),y1=parseInt(K.slice(2,3).repeat(2),16),c1=parseInt(K.slice(3,4).repeat(2),16),H1.toColor(w1,y1,c1);case 5:return w1=parseInt(K.slice(1,2).repeat(2),16),y1=parseInt(K.slice(2,3).repeat(2),16),c1=parseInt(K.slice(3,4).repeat(2),16),V1=parseInt(K.slice(4,5).repeat(2),16),H1.toColor(w1,y1,c1,V1);case 7:return{css:K,rgba:(parseInt(K.slice(1),16)<<8|255)>>>0};case 9:return{css:K,rgba:parseInt(K.slice(1),16)>>>0}}let H=K.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(H)return w1=parseInt(H[1]),y1=parseInt(H[2]),c1=parseInt(H[3]),V1=Math.round((H[5]===void 0?1:parseFloat(H[5]))*255),H1.toColor(w1,y1,c1,V1);if(!Z||!X)throw Error("css.toColor: Unsupported css format");if(Z.fillStyle=X,Z.fillStyle=K,typeof Z.fillStyle!="string")throw Error("css.toColor: Unsupported css format");if(Z.fillRect(0,0,1,1),[w1,y1,c1,V1]=Z.getImageData(0,0,1,1).data,V1!==255)throw Error("css.toColor: Unsupported css format");return{rgba:H1.toRgba(w1,y1,c1,V1),css:K}}U.toColor=Q})(Y1||={});var s1;((U)=>{function Z(Q){return X(Q>>16&255,Q>>8&255,Q&255)}U.relativeLuminance=Z;function X(Q,K,H){let $=Q/255,M=K/255,q=H/255,z=$<=0.03928?$/12.92:Math.pow(($+0.055)/1.055,2.4),T=M<=0.03928?M/12.92:Math.pow((M+0.055)/1.055,2.4),A=q<=0.03928?q/12.92:Math.pow((q+0.055)/1.055,2.4);return z*0.2126+T*0.7152+A*0.0722}U.relativeLuminance2=X})(s1||={});var mX;((U)=>{function Z($,M){if(V1=(M&255)/255,V1===1)return M;let q=M>>24&255,z=M>>16&255,T=M>>8&255,A=$>>24&255,L=$>>16&255,E=$>>8&255;return w1=A+Math.round((q-A)*V1),y1=L+Math.round((z-L)*V1),c1=E+Math.round((T-E)*V1),H1.toRgba(w1,y1,c1)}U.blend=Z;function X($,M,q){let z=s1.relativeLuminance($>>8),T=s1.relativeLuminance(M>>8);if(vU(z,T)<q){if(T<z){let E=Q($,M,q),S=vU(z,s1.relativeLuminance(E>>8));if(S<q){let j=K($,M,q),k=vU(z,s1.relativeLuminance(j>>8));return S>k?E:j}return E}let A=K($,M,q),L=vU(z,s1.relativeLuminance(A>>8));if(L<q){let E=Q($,M,q),S=vU(z,s1.relativeLuminance(E>>8));return L>S?A:E}return A}}U.ensureContrastRatio=X;function Q($,M,q){let z=$>>24&255,T=$>>16&255,A=$>>8&255,L=M>>24&255,E=M>>16&255,S=M>>8&255,j=vU(s1.relativeLuminance2(L,E,S),s1.relativeLuminance2(z,T,A));for(;j<q&&(L>0||E>0||S>0);)L-=Math.max(0,Math.ceil(L*0.1)),E-=Math.max(0,Math.ceil(E*0.1)),S-=Math.max(0,Math.ceil(S*0.1)),j=vU(s1.relativeLuminance2(L,E,S),s1.relativeLuminance2(z,T,A));return(L<<24|E<<16|S<<8|255)>>>0}U.reduceLuminance=Q;function K($,M,q){let z=$>>24&255,T=$>>16&255,A=$>>8&255,L=M>>24&255,E=M>>16&255,S=M>>8&255,j=vU(s1.relativeLuminance2(L,E,S),s1.relativeLuminance2(z,T,A));for(;j<q&&(L<255||E<255||S<255);)L=Math.min(255,L+Math.ceil((255-L)*0.1)),E=Math.min(255,E+Math.ceil((255-E)*0.1)),S=Math.min(255,S+Math.ceil((255-S)*0.1)),j=vU(s1.relativeLuminance2(L,E,S),s1.relativeLuminance2(z,T,A));return(L<<24|E<<16|S<<8|255)>>>0}U.increaseLuminance=K;function H($){return[$>>24&255,$>>16&255,$>>8&255,$&255]}U.toChannels=H})(mX||={});function XZ(U){let Z=U.toString(16);return Z.length<2?"0"+Z:Z}function vU(U,Z){return U<Z?(Z+0.05)/(U+0.05):(U+0.05)/(Z+0.05)}var H8=class extends IX{constructor(U,Z,X){super();this.content=0,this.combinedData="",this.fg=U.fg,this.bg=U.bg,this.combinedData=Z,this._width=X}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(U){throw Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},eX=class{constructor(U){this._bufferService=U,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new FU}register(U){let Z={id:this._nextCharacterJoinerId++,handler:U};return this._characterJoiners.push(Z),Z.id}deregister(U){for(let Z=0;Z<this._characterJoiners.length;Z++)if(this._characterJoiners[Z].id===U)return this._characterJoiners.splice(Z,1),!0;return!1}getJoinedCharacters(U){if(this._characterJoiners.length===0)return[];let Z=this._bufferService.buffer.lines.get(U);if(!Z||Z.length===0)return[];let X=[],Q=Z.translateToString(!0),K=0,H=0,$=0,M=Z.getFg(0),q=Z.getBg(0);for(let z=0;z<Z.getTrimmedLength();z++)if(Z.loadCell(z,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==M||this._workCell.bg!==q){if(z-K>1){let T=this._getJoinedRanges(Q,$,H,Z,K);for(let A=0;A<T.length;A++)X.push(T[A])}K=z,$=H,M=this._workCell.fg,q=this._workCell.bg}H+=this._workCell.getChars().length||oU.length}if(this._bufferService.cols-K>1){let z=this._getJoinedRanges(Q,$,H,Z,K);for(let T=0;T<z.length;T++)X.push(z[T])}return X}_getJoinedRanges(U,Z,X,Q,K){let H=U.substring(Z,X),$=[];try{$=this._characterJoiners[0].handler(H)}catch(M){console.error(M)}for(let M=1;M<this._characterJoiners.length;M++)try{let q=this._characterJoiners[M].handler(H);for(let z=0;z<q.length;z++)eX._mergeRanges($,q[z])}catch(q){console.error(q)}return this._stringRangesToCellRanges($,Q,K),$}_stringRangesToCellRanges(U,Z,X){let Q=0,K=!1,H=0,$=U[Q];if($){for(let M=X;M<this._bufferService.cols;M++){let q=Z.getWidth(M),z=Z.getString(M).length||oU.length;if(q!==0){if(!K&&$[0]<=H&&($[0]=M,K=!0),$[1]<=H){if($[1]=M,$=U[++Q],!$)break;$[0]<=H?($[0]=M,K=!0):K=!1}H+=z}}$&&($[1]=this._bufferService.cols)}}static _mergeRanges(U,Z){let X=!1;for(let Q=0;Q<U.length;Q++){let K=U[Q];if(X){if(Z[1]<=K[0])return U[Q-1][1]=Z[1],U;if(Z[1]<=K[1])return U[Q-1][1]=Math.max(Z[1],K[1]),U.splice(Q,1),U;U.splice(Q,1),Q--}else{if(Z[1]<=K[0])return U.splice(Q,0,Z),U;if(Z[1]<=K[1])return K[0]=Math.min(Z[0],K[0]),U;Z[0]<K[1]&&(K[0]=Math.min(Z[0],K[0]),X=!0);continue}}return X?U[U.length-1][1]=Z[1]:U.push(Z),U}};eX=$1([c0(0,r1)],eX);function F8(U){return 57508<=U&&U<=57558}function O8(U){return 9472<=U&&U<=9631}function C8(U){return F8(U)||O8(U)}function A8(){return{css:{canvas:wX(),cell:wX()},device:{canvas:wX(),cell:wX(),char:{width:0,height:0,left:0,top:0}}}}function wX(){return{width:0,height:0}}var dJ=class{constructor(U,Z,X,Q,K,H,$){this._document=U,this._characterJoinerService=Z,this._optionsService=X,this._coreBrowserService=Q,this._coreService=K,this._decorationService=H,this._themeService=$,this._workCell=new FU,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(U,Z,X){this._selectionStart=U,this._selectionEnd=Z,this._columnSelectMode=X}createRow(U,Z,X,Q,K,H,$,M,q,z,T){let A=[],L=this._characterJoinerService.getJoinedCharacters(Z),E=this._themeService.colors,S=U.getNoBgTrimmedLength();X&&S<H+1&&(S=H+1);let j,k=0,B="",v=0,x=0,N=0,w=0,u=!1,Z0=0,V0=!1,Y0=0,b=0,i=[],Y=z!==-1&&T!==-1;for(let V=0;V<S;V++){U.loadCell(V,this._workCell);let I=this._workCell.getWidth();if(I===0)continue;let G=!1,W=V>=b,C=V,D=this._workCell;if(L.length>0&&V===L[0][0]&&W){let s=L.shift(),f0=this._isCellInSelection(s[0],Z);for(v=s[0]+1;v<s[1];v++)W&&=f0===this._isCellInSelection(v,Z);W&&=!X||H<s[0]||H>=s[1],W?(G=!0,D=new H8(this._workCell,U.translateToString(!0,s[0],s[1]),s[1]-s[0]),C=s[1]-1,I=D.getWidth()):b=s[1]}let F=this._isCellInSelection(V,Z),J=X&&V===H,O=Y&&V>=z&&V<=T,P=!1;this._decorationService.forEachDecorationAtCell(V,Z,void 0,(s)=>{P=!0});let R=D.getChars()||oU;if(R===" "&&(D.isUnderline()||D.isOverline())&&(R=" "),Y0=I*M-q.get(R,D.isBold(),D.isItalic()),!j)j=this._document.createElement("span");else if(k&&(F&&V0||!F&&!V0&&D.bg===x)&&(F&&V0&&E.selectionForeground||D.fg===N)&&D.extended.ext===w&&O===u&&Y0===Z0&&!J&&!G&&!P&&W){D.isInvisible()?B+=oU:B+=R,k++;continue}else k&&(j.textContent=B),j=this._document.createElement("span"),k=0,B="";if(x=D.bg,N=D.fg,w=D.extended.ext,u=O,Z0=Y0,V0=F,G&&H>=V&&H<=C&&(H=V),!this._coreService.isCursorHidden&&J&&this._coreService.isCursorInitialized){if(i.push("xterm-cursor"),this._coreBrowserService.isFocused)$&&i.push("xterm-cursor-blink"),i.push(Q==="bar"?"xterm-cursor-bar":Q==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(K)switch(K){case"outline":i.push("xterm-cursor-outline");break;case"block":i.push("xterm-cursor-block");break;case"bar":i.push("xterm-cursor-bar");break;case"underline":i.push("xterm-cursor-underline");break;default:break}}if(D.isBold()&&i.push("xterm-bold"),D.isItalic()&&i.push("xterm-italic"),D.isDim()&&i.push("xterm-dim"),D.isInvisible()?B=oU:B=D.getChars()||oU,D.isUnderline()&&(i.push(`xterm-underline-${D.extended.underlineStyle}`),B===" "&&(B=" "),!D.isUnderlineColorDefault()))if(D.isUnderlineColorRGB())j.style.textDecorationColor=`rgb(${IX.toColorRGB(D.getUnderlineColor()).join(",")})`;else{let s=D.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&D.isBold()&&s<8&&(s+=8),j.style.textDecorationColor=E.ansi[s].css}D.isOverline()&&(i.push("xterm-overline"),B===" "&&(B=" ")),D.isStrikethrough()&&i.push("xterm-strikethrough"),O&&(j.style.textDecoration="underline");let _=D.getFgColor(),f=D.getFgColorMode(),c=D.getBgColor(),o=D.getBgColorMode(),K0=!!D.isInverse();if(K0){let s=_;_=c,c=s;let f0=f;f=o,o=f0}let a,l,Q0=!1;this._decorationService.forEachDecorationAtCell(V,Z,void 0,(s)=>{s.options.layer!=="top"&&Q0||(s.backgroundColorRGB&&(o=50331648,c=s.backgroundColorRGB.rgba>>8&16777215,a=s.backgroundColorRGB),s.foregroundColorRGB&&(f=50331648,_=s.foregroundColorRGB.rgba>>8&16777215,l=s.foregroundColorRGB),Q0=s.options.layer==="top")}),!Q0&&F&&(a=this._coreBrowserService.isFocused?E.selectionBackgroundOpaque:E.selectionInactiveBackgroundOpaque,c=a.rgba>>8&16777215,o=50331648,Q0=!0,E.selectionForeground&&(f=50331648,_=E.selectionForeground.rgba>>8&16777215,l=E.selectionForeground)),Q0&&i.push("xterm-decoration-top");let n;switch(o){case 16777216:case 33554432:n=E.ansi[c],i.push(`xterm-bg-${c}`);break;case 50331648:n=H1.toColor(c>>16,c>>8&255,c&255),this._addStyle(j,`background-color:#${k$((c>>>0).toString(16),"0",6)}`);break;case 0:default:K0?(n=E.foreground,i.push("xterm-bg-257")):n=E.background}switch(a||D.isDim()&&(a=e0.multiplyOpacity(n,0.5)),f){case 16777216:case 33554432:D.isBold()&&_<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(_+=8),this._applyMinimumContrast(j,n,E.ansi[_],D,a,void 0)||i.push(`xterm-fg-${_}`);break;case 50331648:let s=H1.toColor(_>>16&255,_>>8&255,_&255);this._applyMinimumContrast(j,n,s,D,a,l)||this._addStyle(j,`color:#${k$(_.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(j,n,E.foreground,D,a,l)||K0&&i.push("xterm-fg-257")}i.length&&(j.className=i.join(" "),i.length=0),!J&&!G&&!P&&W?k++:j.textContent=B,Y0!==this.defaultSpacing&&(j.style.letterSpacing=`${Y0}px`),A.push(j),V=C}return j&&k&&(j.textContent=B),A}_applyMinimumContrast(U,Z,X,Q,K,H){if(this._optionsService.rawOptions.minimumContrastRatio===1||C8(Q.getCode()))return!1;let $=this._getContrastCache(Q),M;if(!K&&!H&&(M=$.getColor(Z.rgba,X.rgba)),M===void 0){let q=this._optionsService.rawOptions.minimumContrastRatio/(Q.isDim()?2:1);M=e0.ensureContrastRatio(K||Z,H||X,q),$.setColor((K||Z).rgba,(H||X).rgba,M??null)}return M?(this._addStyle(U,`color:${M.css}`),!0):!1}_getContrastCache(U){return U.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(U,Z){U.setAttribute("style",`${U.getAttribute("style")||""}${Z};`)}_isCellInSelection(U,Z){let X=this._selectionStart,Q=this._selectionEnd;return!X||!Q?!1:this._columnSelectMode?X[0]<=Q[0]?U>=X[0]&&Z>=X[1]&&U<Q[0]&&Z<=Q[1]:U<X[0]&&Z>=X[1]&&U>=Q[0]&&Z<=Q[1]:Z>X[1]&&Z<Q[1]||X[1]===Q[1]&&Z===X[1]&&U>=X[0]&&U<Q[0]||X[1]<Q[1]&&Z===Q[1]&&U<Q[0]||X[1]<Q[1]&&Z===X[1]&&U>=X[0]}};dJ=$1([c0(1,$K),c0(2,a1),c0(3,NU),c0(4,KZ),c0(5,HX),c0(6,SZ)],dJ);function k$(U,Z,X){for(;U.length<X;)U=Z+U;return U}var z8=class{constructor(U,Z){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=U.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let X=U.createElement("span");X.classList.add("xterm-char-measure-element");let Q=U.createElement("span");Q.classList.add("xterm-char-measure-element"),Q.style.fontWeight="bold";let K=U.createElement("span");K.classList.add("xterm-char-measure-element"),K.style.fontStyle="italic";let H=U.createElement("span");H.classList.add("xterm-char-measure-element"),H.style.fontWeight="bold",H.style.fontStyle="italic",this._measureElements=[X,Q,K,H],this._container.appendChild(X),this._container.appendChild(Q),this._container.appendChild(K),this._container.appendChild(H),Z.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(U,Z,X,Q){U===this._font&&Z===this._fontSize&&X===this._weight&&Q===this._weightBold||(this._font=U,this._fontSize=Z,this._weight=X,this._weightBold=Q,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${X}`,this._measureElements[1].style.fontWeight=`${Q}`,this._measureElements[2].style.fontWeight=`${X}`,this._measureElements[3].style.fontWeight=`${Q}`,this.clear())}get(U,Z,X){let Q=0;if(!Z&&!X&&U.length===1&&(Q=U.charCodeAt(0))<256){if(this._flat[Q]!==-9999)return this._flat[Q];let $=this._measure(U,0);return $>0&&(this._flat[Q]=$),$}let K=U;Z&&(K+="B"),X&&(K+="I");let H=this._holey.get(K);if(H===void 0){let $=0;Z&&($|=1),X&&($|=2),H=this._measure(U,$),H>0&&this._holey.set(K,H)}return H}_measure(U,Z){let X=this._measureElements[Z];return X.textContent=U.repeat(32),X.offsetWidth/32}},D8=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(U,Z,X,Q=!1){if(this.selectionStart=Z,this.selectionEnd=X,!Z||!X||Z[0]===X[0]&&Z[1]===X[1]){this.clear();return}let K=U.buffers.active.ydisp,H=Z[1]-K,$=X[1]-K,M=Math.max(H,0),q=Math.min($,U.rows-1);if(M>=U.rows||q<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=Q,this.viewportStartRow=H,this.viewportEndRow=$,this.viewportCappedStartRow=M,this.viewportCappedEndRow=q,this.startCol=Z[0],this.endCol=X[0]}isCellSelected(U,Z,X){return this.hasSelection?(X-=U.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?Z>=this.startCol&&X>=this.viewportCappedStartRow&&Z<this.endCol&&X<=this.viewportCappedEndRow:Z<this.startCol&&X>=this.viewportCappedStartRow&&Z>=this.endCol&&X<=this.viewportCappedEndRow:X>this.viewportStartRow&&X<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&X===this.viewportStartRow&&Z>=this.startCol&&Z<this.endCol||this.viewportStartRow<this.viewportEndRow&&X===this.viewportEndRow&&Z<this.endCol||this.viewportStartRow<this.viewportEndRow&&X===this.viewportStartRow&&Z>=this.startCol):!1}};function M8(){return new D8}var MJ="xterm-dom-renderer-owner-",IU="xterm-rows",yX="xterm-fg-",j$="xterm-bg-",sZ="xterm-focus",cX="xterm-selection",q8=1,lJ=class extends d0{constructor(U,Z,X,Q,K,H,$,M,q,z,T,A,L,E){super();this._terminal=U,this._document=Z,this._element=X,this._screenElement=Q,this._viewportElement=K,this._helperContainer=H,this._linkifier2=$,this._charSizeService=q,this._optionsService=z,this._bufferService=T,this._coreService=A,this._coreBrowserService=L,this._themeService=E,this._terminalClass=q8++,this._rowElements=[],this._selectionRenderModel=M8(),this.onRequestRedraw=this._register(new w0).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(IU),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(cX),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=A8(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors((S)=>this._injectCss(S))),this._injectCss(this._themeService.colors),this._rowFactory=M.createInstance(dJ,document),this._element.classList.add(MJ+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline((S)=>this._handleLinkHover(S))),this._register(this._linkifier2.onHideLinkUnderline((S)=>this._handleLinkLeave(S))),this._register(U1(()=>{this._element.classList.remove(MJ+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new z8(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let U=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*U,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*U),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/U),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/U),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let X of this._rowElements)X.style.width=`${this.dimensions.css.canvas.width}px`,X.style.height=`${this.dimensions.css.cell.height}px`,X.style.lineHeight=`${this.dimensions.css.cell.height}px`,X.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let Z=`${this._terminalSelector} .${IU} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=Z,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(U){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let Z=`${this._terminalSelector} .${IU} { pointer-events: none; color: ${U.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;Z+=`${this._terminalSelector} .${IU} .xterm-dim { color: ${e0.multiplyOpacity(U.foreground,0.5).css};}`,Z+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let X=`blink_underline_${this._terminalClass}`,Q=`blink_bar_${this._terminalClass}`,K=`blink_block_${this._terminalClass}`;Z+=`@keyframes ${X} { 50% { border-bottom-style: hidden; }}`,Z+=`@keyframes ${Q} { 50% { box-shadow: none; }}`,Z+=`@keyframes ${K} { 0% { background-color: ${U.cursor.css}; color: ${U.cursorAccent.css}; } 50% { background-color: inherit; color: ${U.cursor.css}; }}`,Z+=`${this._terminalSelector} .${IU}.${sZ} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${X} 1s step-end infinite;}${this._terminalSelector} .${IU}.${sZ} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${Q} 1s step-end infinite;}${this._terminalSelector} .${IU}.${sZ} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${K} 1s step-end infinite;}${this._terminalSelector} .${IU} .xterm-cursor.xterm-cursor-block { background-color: ${U.cursor.css}; color: ${U.cursorAccent.css};}${this._terminalSelector} .${IU} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${U.cursor.css} !important; color: ${U.cursorAccent.css} !important;}${this._terminalSelector} .${IU} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${U.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${IU} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${U.cursor.css} inset;}${this._terminalSelector} .${IU} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${U.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,Z+=`${this._terminalSelector} .${cX} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${cX} div { position: absolute; background-color: ${U.selectionBackgroundOpaque.css};}${this._terminalSelector} .${cX} div { position: absolute; background-color: ${U.selectionInactiveBackgroundOpaque.css};}`;for(let[H,$]of U.ansi.entries())Z+=`${this._terminalSelector} .${yX}${H} { color: ${$.css}; }${this._terminalSelector} .${yX}${H}.xterm-dim { color: ${e0.multiplyOpacity($,0.5).css}; }${this._terminalSelector} .${j$}${H} { background-color: ${$.css}; }`;Z+=`${this._terminalSelector} .${yX}257 { color: ${e0.opaque(U.background).css}; }${this._terminalSelector} .${yX}257.xterm-dim { color: ${e0.multiplyOpacity(e0.opaque(U.background),0.5).css}; }${this._terminalSelector} .${j$}257 { background-color: ${U.foreground.css}; }`,this._themeStyleElement.textContent=Z}_setDefaultSpacing(){let U=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${U}px`,this._rowFactory.defaultSpacing=U}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(U,Z){for(let X=this._rowElements.length;X<=Z;X++){let Q=this._document.createElement("div");this._rowContainer.appendChild(Q),this._rowElements.push(Q)}for(;this._rowElements.length>Z;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(U,Z){this._refreshRowElements(U,Z),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(sZ),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(sZ),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(U,Z,X){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(U,Z,X),this.renderRows(0,this._bufferService.rows-1),!U||!Z||(this._selectionRenderModel.update(this._terminal,U,Z,X),!this._selectionRenderModel.hasSelection))return;let Q=this._selectionRenderModel.viewportStartRow,K=this._selectionRenderModel.viewportEndRow,H=this._selectionRenderModel.viewportCappedStartRow,$=this._selectionRenderModel.viewportCappedEndRow,M=this._document.createDocumentFragment();if(X){let q=U[0]>Z[0];M.appendChild(this._createSelectionElement(H,q?Z[0]:U[0],q?U[0]:Z[0],$-H+1))}else{let q=Q===H?U[0]:0,z=H===K?Z[0]:this._bufferService.cols;M.appendChild(this._createSelectionElement(H,q,z));let T=$-H-1;if(M.appendChild(this._createSelectionElement(H+1,0,this._bufferService.cols,T)),H!==$){let A=K===$?Z[0]:this._bufferService.cols;M.appendChild(this._createSelectionElement($,0,A))}}this._selectionContainer.appendChild(M)}_createSelectionElement(U,Z,X,Q=1){let K=this._document.createElement("div"),H=Z*this.dimensions.css.cell.width,$=this.dimensions.css.cell.width*(X-Z);return H+$>this.dimensions.css.canvas.width&&($=this.dimensions.css.canvas.width-H),K.style.height=`${Q*this.dimensions.css.cell.height}px`,K.style.top=`${U*this.dimensions.css.cell.height}px`,K.style.left=`${H}px`,K.style.width=`${$}px`,K}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let U of this._rowElements)U.replaceChildren()}renderRows(U,Z){let X=this._bufferService.buffer,Q=X.ybase+X.y,K=Math.min(X.x,this._bufferService.cols-1),H=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,$=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,M=this._optionsService.rawOptions.cursorInactiveStyle;for(let q=U;q<=Z;q++){let z=q+X.ydisp,T=this._rowElements[q],A=X.lines.get(z);if(!T||!A)break;T.replaceChildren(...this._rowFactory.createRow(A,z,z===Q,$,M,K,H,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${MJ}${this._terminalClass}`}_handleLinkHover(U){this._setCellUnderline(U.x1,U.x2,U.y1,U.y2,U.cols,!0)}_handleLinkLeave(U){this._setCellUnderline(U.x1,U.x2,U.y1,U.y2,U.cols,!1)}_setCellUnderline(U,Z,X,Q,K,H){X<0&&(U=0),Q<0&&(Z=0);let $=this._bufferService.rows-1;X=Math.max(Math.min(X,$),0),Q=Math.max(Math.min(Q,$),0),K=Math.min(K,this._bufferService.cols);let M=this._bufferService.buffer,q=M.ybase+M.y,z=Math.min(M.x,K-1),T=this._optionsService.rawOptions.cursorBlink,A=this._optionsService.rawOptions.cursorStyle,L=this._optionsService.rawOptions.cursorInactiveStyle;for(let E=X;E<=Q;++E){let S=E+M.ydisp,j=this._rowElements[E],k=M.lines.get(S);if(!j||!k)break;j.replaceChildren(...this._rowFactory.createRow(k,S,S===q,A,L,z,T,this.dimensions.css.cell.width,this._widthCache,H?E===X?U:0:-1,H?(E===Q?Z:K)-1:-1))}}};lJ=$1([c0(7,YQ),c0(8,JY),c0(9,a1),c0(10,r1),c0(11,KZ),c0(12,NU),c0(13,SZ)],lJ);var oJ=class extends d0{constructor(U,Z,X){super();this._optionsService=X,this.width=0,this.height=0,this._onCharSizeChange=this._register(new w0),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new T8(this._optionsService))}catch{this._measureStrategy=this._register(new L8(U,Z,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let U=this._measureStrategy.measure();(U.width!==this.width||U.height!==this.height)&&(this.width=U.width,this.height=U.height,this._onCharSizeChange.fire())}};oJ=$1([c0(2,a1)],oJ);var kK=class extends d0{constructor(){super(...arguments);this._result={width:0,height:0}}_validateAndSet(U,Z){U!==void 0&&U>0&&Z!==void 0&&Z>0&&(this._result.width=U,this._result.height=Z)}},L8=class extends kK{constructor(U,Z,X){super();this._document=U,this._parentElement=Z,this._optionsService=X,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},T8=class extends kK{constructor(U){super();this._optionsService=U,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let Z=this._ctx.measureText("W");if(!(("width"in Z)&&("fontBoundingBoxAscent"in Z)&&("fontBoundingBoxDescent"in Z)))throw Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let U=this._ctx.measureText("W");return this._validateAndSet(U.width,U.fontBoundingBoxAscent+U.fontBoundingBoxDescent),this._result}},R8=class extends d0{constructor(U,Z,X){super();this._textarea=U,this._window=Z,this.mainDocument=X,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new E8(this._window)),this._onDprChange=this._register(new w0),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new w0),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange((Q)=>this._screenDprMonitor.setWindow(Q))),this._register(b1.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(u0(this._textarea,"focus",()=>this._isFocused=!0)),this._register(u0(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(U){this._window!==U&&(this._window=U,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},E8=class extends d0{constructor(U){super();this._parentWindow=U,this._windowResizeListener=this._register(new EZ),this._onDprChange=this._register(new w0),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(U1(()=>this.clearListener()))}setWindow(U){this._parentWindow=U,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=u0(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},S8=class extends d0{constructor(){super();this.linkProviders=[],this._register(U1(()=>this.linkProviders.length=0))}registerLinkProvider(U){return this.linkProviders.push(U),{dispose:()=>{let Z=this.linkProviders.indexOf(U);Z!==-1&&this.linkProviders.splice(Z,1)}}}};function IQ(U,Z,X){let Q=X.getBoundingClientRect(),K=U.getComputedStyle(X),H=parseInt(K.getPropertyValue("padding-left")),$=parseInt(K.getPropertyValue("padding-top"));return[Z.clientX-Q.left-H,Z.clientY-Q.top-$]}function P8(U,Z,X,Q,K,H,$,M,q){if(!H)return;let z=IQ(U,Z,X);if(z)return z[0]=Math.ceil((z[0]+(q?$/2:0))/$),z[1]=Math.ceil(z[1]/M),z[0]=Math.min(Math.max(z[0],1),Q+(q?1:0)),z[1]=Math.min(Math.max(z[1],1),K),z}var nJ=class{constructor(U,Z){this._renderService=U,this._charSizeService=Z}getCoords(U,Z,X,Q,K){return P8(window,U,Z,X,Q,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,K)}getMouseReportCoords(U,Z){let X=IQ(window,U,Z);if(this._charSizeService.hasValidSize)return X[0]=Math.min(Math.max(X[0],0),this._renderService.dimensions.css.canvas.width-1),X[1]=Math.min(Math.max(X[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(X[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(X[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(X[0]),y:Math.floor(X[1])}}};nJ=$1([c0(0,gU),c0(1,JY)],nJ);var k8=class{constructor(U,Z){this._renderCallback=U,this._coreBrowserService=Z,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(U){return this._refreshCallbacks.push(U),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(U,Z,X){this._rowCount=X,U=U!==void 0?U:0,Z=Z!==void 0?Z:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,U):U,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,Z):Z,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let U=Math.max(this._rowStart,0),Z=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(U,Z),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let U of this._refreshCallbacks)U(0);this._refreshCallbacks=[]}},jK={};WO(jK,{getSafariVersion:()=>v8,isChromeOS:()=>xK,isFirefox:()=>vK,isIpad:()=>_8,isIphone:()=>B8,isLegacyEdge:()=>j8,isLinux:()=>HQ,isMac:()=>UY,isNode:()=>VY,isSafari:()=>_K,isWindows:()=>BK});var VY=typeof process<"u"&&"title"in process,FX=VY?"node":navigator.userAgent,OX=VY?"node":navigator.platform,vK=FX.includes("Firefox"),j8=FX.includes("Edge"),_K=/^((?!chrome|android).)*safari/i.test(FX);function v8(){if(!_K)return 0;let U=FX.match(/Version\/(\d+)/);return U===null||U.length<2?0:parseInt(U[1])}var UY=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(OX),_8=OX==="iPad",B8=OX==="iPhone",BK=["Windows","Win16","Win32","WinCE"].includes(OX),HQ=OX.indexOf("Linux")>=0,xK=/\bCrOS\b/.test(FX),NK=class{constructor(){this._tasks=[],this._i=0}enqueue(U){this._tasks.push(U),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(U){this._idleCallback=void 0;let Z=0,X=0,Q=U.timeRemaining(),K=0;for(;this._i<this._tasks.length;){if(Z=performance.now(),this._tasks[this._i]()||this._i++,Z=Math.max(1,performance.now()-Z),X=Math.max(Z,X),K=U.timeRemaining(),X*1.5>K){Q-Z<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(Q-Z))}ms`),this._start();return}Q=K}this.clear()}},x8=class extends NK{_requestCallback(U){return setTimeout(()=>U(this._createDeadline(16)))}_cancelCallback(U){clearTimeout(U)}_createDeadline(U){let Z=performance.now()+U;return{timeRemaining:()=>Math.max(0,Z-performance.now())}}},N8=class extends NK{_requestCallback(U){return requestIdleCallback(U)}_cancelCallback(U){cancelIdleCallback(U)}},ZY=!VY&&"requestIdleCallback"in window?N8:x8,g8=class{constructor(){this._queue=new ZY}set(U){this._queue.clear(),this._queue.enqueue(U)}flush(){this._queue.flush()}},mJ=class extends d0{constructor(U,Z,X,Q,K,H,$,M,q){super();this._rowCount=U,this._optionsService=X,this._charSizeService=Q,this._coreService=K,this._coreBrowserService=M,this._renderer=this._register(new EZ),this._pausedResizeTask=new g8,this._observerDisposable=this._register(new EZ),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new w0),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new w0),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new w0),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new w0),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new k8((z,T)=>this._renderRows(z,T),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new f8(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(U1(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register($.onResize(()=>this._fullRefresh())),this._register($.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(H.onDecorationRegistered(()=>this._fullRefresh())),this._register(H.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize($.cols,$.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows($.buffer.y,$.buffer.y,!0))),this._register(q.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,Z),this._register(this._coreBrowserService.onWindowChange((z)=>this._registerIntersectionObserver(z,Z)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(U,Z){if("IntersectionObserver"in U){let X=new U.IntersectionObserver((Q)=>this._handleIntersectionChange(Q[Q.length-1]),{threshold:0});X.observe(Z),this._observerDisposable.value=U1(()=>X.disconnect())}}_handleIntersectionChange(U){this._isPaused=U.isIntersecting===void 0?U.intersectionRatio===0:!U.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(U,Z,X=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(U,Z);return}let Q=this._syncOutputHandler.flush();Q&&(U=Math.min(U,Q.start),Z=Math.max(Z,Q.end)),X||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(U,Z,this._rowCount)}_renderRows(U,Z){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(U,Z);return}U=Math.min(U,this._rowCount-1),Z=Math.min(Z,this._rowCount-1),this._renderer.value.renderRows(U,Z),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:U,end:Z}),this._onRender.fire({start:U,end:Z}),this._isNextRenderRedrawOnly=!0}}resize(U,Z){this._rowCount=Z,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(U){this._renderer.value=U,this._renderer.value&&(this._renderer.value.onRequestRedraw((Z)=>this.refreshRows(Z.start,Z.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(U){return this._renderDebouncer.addRefreshCallback(U)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(U,Z){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(U,Z)):this._renderer.value.handleResize(U,Z),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(U,Z,X){this._selectionState.start=U,this._selectionState.end=Z,this._selectionState.columnSelectMode=X,this._renderer.value?.handleSelectionChanged(U,Z,X)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};mJ=$1([c0(2,a1),c0(3,JY),c0(4,KZ),c0(5,HX),c0(6,r1),c0(7,NU),c0(8,SZ)],mJ);var f8=class{constructor(U,Z,X){this._coreBrowserService=U,this._coreService=Z,this._onTimeout=X,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(U,Z){this._isBuffering?(this._start=Math.min(this._start,U),this._end=Math.max(this._end,Z)):(this._start=U,this._end=Z,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1000))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let U={start:this._start,end:this._end};return this._isBuffering=!1,U}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function w8(U,Z,X,Q){let K=X.buffer.x,H=X.buffer.y;if(!X.buffer.hasScrollback)return p8(K,H,U,Z,X,Q)+$Y(H,Z,X,Q)+h8(K,H,U,Z,X,Q);let $;if(H===Z)return $=K>U?"D":"C",KX(Math.abs(K-U),$X($,Q));$=H>Z?"D":"C";let M=Math.abs(H-Z),q=c8(H>Z?U:K,X)+(M-1)*X.cols+1+y8(H>Z?K:U,X);return KX(q,$X($,Q))}function y8(U,Z){return U-1}function c8(U,Z){return Z.cols-U}function p8(U,Z,X,Q,K,H){return $Y(Z,Q,K,H).length===0?"":KX(fK(U,Z,U,Z-$Z(Z,K),!1,K).length,$X("D",H))}function $Y(U,Z,X,Q){let K=U-$Z(U,X),H=Z-$Z(Z,X),$=Math.abs(K-H)-u8(U,Z,X);return KX($,$X(gK(U,Z),Q))}function h8(U,Z,X,Q,K,H){let $;$Y(Z,Q,K,H).length>0?$=Q-$Z(Q,K):$=Z;let M=Q,q=b8(U,Z,X,Q,K,H);return KX(fK(U,$,X,M,q==="C",K).length,$X(q,H))}function u8(U,Z,X){let Q=0,K=U-$Z(U,X),H=Z-$Z(Z,X);for(let $=0;$<Math.abs(K-H);$++){let M=gK(U,Z)==="A"?-1:1;X.buffer.lines.get(K+M*$)?.isWrapped&&Q++}return Q}function $Z(U,Z){let X=0,Q=Z.buffer.lines.get(U),K=Q?.isWrapped;for(;K&&U>=0&&U<Z.rows;)X++,Q=Z.buffer.lines.get(--U),K=Q?.isWrapped;return X}function b8(U,Z,X,Q,K,H){let $;return $Y(X,Q,K,H).length>0?$=Q-$Z(Q,K):$=Z,U<X&&$<=Q||U>=X&&$<Q?"C":"D"}function gK(U,Z){return U>Z?"A":"B"}function fK(U,Z,X,Q,K,H){let $=U,M=Z,q="";for(;($!==X||M!==Q)&&M>=0&&M<H.buffer.lines.length;)$+=K?1:-1,K&&$>H.cols-1?(q+=H.buffer.translateBufferLineToString(M,!1,U,$),$=0,U=0,M++):!K&&$<0&&(q+=H.buffer.translateBufferLineToString(M,!1,0,U+1),$=H.cols-1,U=$,M--);return q+H.buffer.translateBufferLineToString(M,!1,U,$)}function $X(U,Z){let X=Z?"O":"[";return D0.ESC+X+U}function KX(U,Z){U=Math.floor(U);let X="";for(let Q=0;Q<U;Q++)X+=Z;return X}var d8=class{constructor(U){this._bufferService=U,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let U=this.selectionStart[0]+this.selectionStartLength;return U>this._bufferService.cols?U%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(U/this._bufferService.cols)-1]:[U%this._bufferService.cols,this.selectionStart[1]+Math.floor(U/this._bufferService.cols)]:[U,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let U=this.selectionStart[0]+this.selectionStartLength;return U>this._bufferService.cols?[U%this._bufferService.cols,this.selectionStart[1]+Math.floor(U/this._bufferService.cols)]:[Math.max(U,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let U=this.selectionStart,Z=this.selectionEnd;return!U||!Z?!1:U[1]>Z[1]||U[1]===Z[1]&&U[0]>Z[0]}handleTrim(U){return this.selectionStart&&(this.selectionStart[1]-=U),this.selectionEnd&&(this.selectionEnd[1]-=U),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function v$(U,Z){if(U.start.y>U.end.y)throw Error(`Buffer range end (${U.end.x}, ${U.end.y}) cannot be before start (${U.start.x}, ${U.start.y})`);return Z*(U.end.y-U.start.y)+(U.end.x-U.start.x+1)}var qJ=50,l8=15,o8=50,n8=500,m8=" ",s8=new RegExp(m8,"g"),sJ=class extends d0{constructor(U,Z,X,Q,K,H,$,M,q){super();this._element=U,this._screenElement=Z,this._linkifier=X,this._bufferService=Q,this._coreService=K,this._mouseService=H,this._optionsService=$,this._renderService=M,this._coreBrowserService=q,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new FU,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new w0),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new w0),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new w0),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new w0),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=(z)=>this._handleMouseMove(z),this._mouseUpListener=(z)=>this._handleMouseUp(z),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim((z)=>this._handleTrim(z)),this._register(this._bufferService.buffers.onBufferActivate((z)=>this._handleBufferActivate(z))),this.enable(),this._model=new d8(this._bufferService),this._activeSelectionMode=0,this._register(U1(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize((z)=>{z.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let U=this._model.finalSelectionStart,Z=this._model.finalSelectionEnd;return!U||!Z?!1:U[0]!==Z[0]||U[1]!==Z[1]}get selectionText(){let U=this._model.finalSelectionStart,Z=this._model.finalSelectionEnd;if(!U||!Z)return"";let X=this._bufferService.buffer,Q=[];if(this._activeSelectionMode===3){if(U[0]===Z[0])return"";let K=U[0]<Z[0]?U[0]:Z[0],H=U[0]<Z[0]?Z[0]:U[0];for(let $=U[1];$<=Z[1];$++){let M=X.translateBufferLineToString($,!0,K,H);Q.push(M)}}else{let K=U[1]===Z[1]?Z[0]:void 0;Q.push(X.translateBufferLineToString(U[1],!0,U[0],K));for(let H=U[1]+1;H<=Z[1]-1;H++){let $=X.lines.get(H),M=X.translateBufferLineToString(H,!0);$?.isWrapped?Q[Q.length-1]+=M:Q.push(M)}if(U[1]!==Z[1]){let H=X.lines.get(Z[1]),$=X.translateBufferLineToString(Z[1],!0,0,Z[0]);H&&H.isWrapped?Q[Q.length-1]+=$:Q.push($)}}return Q.map((K)=>K.replace(s8," ")).join(BK?`\r
|
|
376
|
+
`).trim(),M=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(q);bX.register($,M?.[2]??q,$)}return $},this._event}_removeListener(U){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let Z=this._listeners,X=Z.indexOf(U);if(X===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),Error("Attempted to dispose unknown listener");this._size--,Z[X]=void 0;let Q=this._deliveryQueue.current===this;if(this._size*rO<=Z.length){let K=0;for(let F=0;F<Z.length;F++)Z[F]?Z[K++]=Z[F]:Q&&(this._deliveryQueue.end--,K<this._deliveryQueue.i&&this._deliveryQueue.i--);Z.length=K}}_deliver(U,Z){if(!U)return;let X=this._options?.onListenerError||hX;if(!X){U.value(Z);return}try{U.value(Z)}catch(Q){X(Q)}}_deliverQueue(U){let Z=U.current._listeners;for(;U.i<U.end;)this._deliver(Z[U.i++],U.value);U.reset()}fire(U){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof uX)this._deliver(this._listeners,U);else{let Z=this._deliveryQueue;Z.enqueue(this,U,this._listeners.length),this._deliverQueue(Z)}this._perfMon?.stop()}hasListeners(){return this._size>0}},tO=class{constructor(){this.i=-1,this.end=0}enqueue(U,Z,X){this.i=0,this.end=X,this.current=U,this.value=Z}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},wJ=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new w0,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new w0,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(Z){return this.mapWindowIdToZoomLevel.get(this.getWindowId(Z))??0}setZoomLevel(Z,X){if(this.getZoomLevel(X)===Z)return;let Q=this.getWindowId(X);this.mapWindowIdToZoomLevel.set(Q,Z),this._onDidChangeZoomLevel.fire(Q)}getZoomFactor(Z){return this.mapWindowIdToZoomFactor.get(this.getWindowId(Z))??1}setZoomFactor(Z,X){this.mapWindowIdToZoomFactor.set(this.getWindowId(X),Z)}setFullscreen(Z,X){if(this.isFullscreen(X)===Z)return;let Q=this.getWindowId(X);this.mapWindowIdToFullScreen.set(Q,Z),this._onDidChangeFullscreen.fire(Q)}isFullscreen(Z){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(Z))}getWindowId(Z){return Z.vscodeWindowId}};wJ.INSTANCE=new wJ;var QQ=wJ;function iO(U,Z,X){typeof Z=="string"&&(Z=U.matchMedia(Z)),Z.addEventListener("change",X)}var YA=QQ.INSTANCE.onDidChangeZoomLevel;function eO(U){return QQ.INSTANCE.getZoomFactor(U)}var JA=QQ.INSTANCE.onDidChangeFullscreen,PZ=typeof navigator=="object"?navigator.userAgent:"",yJ=PZ.indexOf("Firefox")>=0,dX=PZ.indexOf("AppleWebKit")>=0,GQ=PZ.indexOf("Chrome")>=0,OK=!GQ&&PZ.indexOf("Safari")>=0,QA=PZ.indexOf("Electron/")>=0,GA=PZ.indexOf("Android")>=0,lX=!1;if(typeof $U.matchMedia=="function"){let U=$U.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),Z=$U.matchMedia("(display-mode: fullscreen)");lX=U.matches,iO($U,U,({matches:X})=>{lX&&Z.matches||(lX=X)})}function U2(){return lX}var RZ="en",rX=!1,aX=!1,QX=!1,Z2=!1,CK=!1,AK=!1,X2=!1,Y2=!1,J2=!1,Q2=!1,fX,oX=RZ,W$=RZ,G2,_U,xU=globalThis,VU;typeof xU.vscode<"u"&&typeof xU.vscode.process<"u"?VU=xU.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(VU=process);var zK=typeof VU?.versions?.electron=="string",V2=zK&&VU?.type==="renderer";if(typeof VU=="object"){rX=VU.platform==="win32",aX=VU.platform==="darwin",QX=VU.platform==="linux",Z2=QX&&!!VU.env.SNAP&&!!VU.env.SNAP_REVISION,X2=zK,J2=!!VU.env.CI||!!VU.env.BUILD_ARTIFACTSTAGINGDIRECTORY,fX=RZ,oX=RZ;let U=VU.env.VSCODE_NLS_CONFIG;if(U)try{let Z=JSON.parse(U);fX=Z.userLocale,W$=Z.osLocale,oX=Z.resolvedLanguage||RZ,G2=Z.languagePack?.translationsConfigFile}catch{}CK=!0}else typeof navigator=="object"&&!V2?(_U=navigator.userAgent,rX=_U.indexOf("Windows")>=0,aX=_U.indexOf("Macintosh")>=0,Y2=(_U.indexOf("Macintosh")>=0||_U.indexOf("iPad")>=0||_U.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,QX=_U.indexOf("Linux")>=0,Q2=_U?.indexOf("Mobi")>=0,AK=!0,oX=globalThis._VSCODE_NLS_LANGUAGE||RZ,fX=navigator.language.toLowerCase(),W$=fX):console.error("Unable to resolve platform.");var FJ=0;aX?FJ=1:rX?FJ=3:QX&&(FJ=2);var DK=rX,TU=aX,$2=QX,HJ=CK,K2=AK&&typeof xU.importScripts=="function",VA=K2?xU.origin:void 0,RU=_U,hU=oX,W2;((U)=>{function Z(){return hU}U.value=Z;function X(){return hU.length===2?hU==="en":hU.length>=3?hU[0]==="e"&&hU[1]==="n"&&hU[2]==="-":!1}U.isDefaultVariant=X;function Q(){return hU==="en"}U.isDefault=Q})(W2||={});var I2=typeof xU.postMessage=="function"&&!xU.importScripts,F2=(()=>{if(I2){let U=[];xU.addEventListener("message",(X)=>{if(X.data&&X.data.vscodeScheduleAsyncWork)for(let Q=0,K=U.length;Q<K;Q++){let F=U[Q];if(F.id===X.data.vscodeScheduleAsyncWork){U.splice(Q,1),F.callback();return}}});let Z=0;return(X)=>{let Q=++Z;U.push({id:Q,callback:X}),xU.postMessage({vscodeScheduleAsyncWork:Q},"*")}}return(U)=>setTimeout(U)})(),H2=!!(RU&&RU.indexOf("Chrome")>=0),$A=!!(RU&&RU.indexOf("Firefox")>=0),KA=!!(!H2&&RU&&RU.indexOf("Safari")>=0),WA=!!(RU&&RU.indexOf("Edg/")>=0),IA=!!(RU&&RU.indexOf("Android")>=0),uU=typeof navigator=="object"?navigator:{},FA={clipboard:{writeText:HJ||document.queryCommandSupported&&document.queryCommandSupported("copy")||!!(uU&&uU.clipboard&&uU.clipboard.writeText),readText:HJ||!!(uU&&uU.clipboard&&uU.clipboard.readText)},keyboard:HJ||U2()?0:uU.keyboard||OK?1:2,touch:"ontouchstart"in $U||uU.maxTouchPoints>0,pointerEvents:$U.PointerEvent&&(("ontouchstart"in $U)||navigator.maxTouchPoints>0)},VQ=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(U,Z){this._keyCodeToStr[U]=Z,this._strToKeyCode[Z.toLowerCase()]=U}keyCodeToStr(U){return this._keyCodeToStr[U]}strToKeyCode(U){return this._strToKeyCode[U.toLowerCase()]||0}},OJ=new VQ,I$=new VQ,F$=new VQ,O2=Array(230),qK;((U)=>{function Z(q){return OJ.keyCodeToStr(q)}U.toString=Z;function X(q){return OJ.strToKeyCode(q)}U.fromString=X;function Q(q){return I$.keyCodeToStr(q)}U.toUserSettingsUS=Q;function K(q){return F$.keyCodeToStr(q)}U.toUserSettingsGeneral=K;function F(q){return I$.strToKeyCode(q)||F$.strToKeyCode(q)}U.fromUserSettings=F;function $(q){if(q>=98&&q<=113)return null;switch(q){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return OJ.keyCodeToStr(q)}U.toElectronAccelerator=$})(qK||={});var C2=class U{constructor(Z,X,Q,K,F){this.ctrlKey=Z,this.shiftKey=X,this.altKey=Q,this.metaKey=K,this.keyCode=F}equals(Z){return Z instanceof U&&this.ctrlKey===Z.ctrlKey&&this.shiftKey===Z.shiftKey&&this.altKey===Z.altKey&&this.metaKey===Z.metaKey&&this.keyCode===Z.keyCode}getHashCode(){let Z=this.ctrlKey?"1":"0",X=this.shiftKey?"1":"0",Q=this.altKey?"1":"0",K=this.metaKey?"1":"0";return`K${Z}${X}${Q}${K}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new A2([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},A2=class{constructor(U){if(U.length===0)throw kO("chords");this.chords=U}getHashCode(){let U="";for(let Z=0,X=this.chords.length;Z<X;Z++)Z!==0&&(U+=";"),U+=this.chords[Z].getHashCode();return U}equals(U){if(U===null||this.chords.length!==U.chords.length)return!1;for(let Z=0;Z<this.chords.length;Z++)if(!this.chords[Z].equals(U.chords[Z]))return!1;return!0}};function z2(U){if(U.charCode){let X=String.fromCharCode(U.charCode).toUpperCase();return qK.fromString(X)}let Z=U.keyCode;if(Z===3)return 7;if(yJ)switch(Z){case 59:return 85;case 60:if($2)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(TU)return 57;break}else if(dX){if(TU&&Z===93)return 57;if(!TU&&Z===92)return 57}return O2[Z]||0}var D2=TU?256:2048,q2=512,M2=1024,L2=TU?2048:256,cJ=class{constructor(U){this._standardKeyboardEventBrand=!0;let Z=U;this.browserEvent=Z,this.target=Z.target,this.ctrlKey=Z.ctrlKey,this.shiftKey=Z.shiftKey,this.altKey=Z.altKey,this.metaKey=Z.metaKey,this.altGraphKey=Z.getModifierState?.("AltGraph"),this.keyCode=z2(Z),this.code=Z.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(U){return this._asKeybinding===U}_computeKeybinding(){let U=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(U=this.keyCode);let Z=0;return this.ctrlKey&&(Z|=D2),this.altKey&&(Z|=q2),this.shiftKey&&(Z|=M2),this.metaKey&&(Z|=L2),Z|=U,Z}_computeKeyCodeChord(){let U=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(U=this.keyCode),new C2(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,U)}},H$=new WeakMap;function T2(U){if(!U.parent||U.parent===U)return null;try{let Z=U.location,X=U.parent.location;if(Z.origin!=="null"&&X.origin!=="null"&&Z.origin!==X.origin)return null}catch{return null}return U.parent}var R2=class{static getSameOriginWindowChain(U){let Z=H$.get(U);if(!Z){Z=[],H$.set(U,Z);let X=U,Q;do Q=T2(X),Q?Z.push({window:new WeakRef(X),iframeElement:X.frameElement||null}):Z.push({window:new WeakRef(X),iframeElement:null}),X=Q;while(X)}return Z.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(U,Z){if(!Z||U===Z)return{top:0,left:0};let X=0,Q=0,K=this.getSameOriginWindowChain(U);for(let F of K){let $=F.window.deref();if(X+=$?.scrollY??0,Q+=$?.scrollX??0,$===Z||!F.iframeElement)break;let q=F.iframeElement.getBoundingClientRect();X+=q.top,Q+=q.left}return{top:X,left:Q}}},eZ=class{constructor(U,Z){this.timestamp=Date.now(),this.browserEvent=Z,this.leftButton=Z.button===0,this.middleButton=Z.button===1,this.rightButton=Z.button===2,this.buttons=Z.buttons,this.target=Z.target,this.detail=Z.detail||1,Z.type==="dblclick"&&(this.detail=2),this.ctrlKey=Z.ctrlKey,this.shiftKey=Z.shiftKey,this.altKey=Z.altKey,this.metaKey=Z.metaKey,typeof Z.pageX=="number"?(this.posx=Z.pageX,this.posy=Z.pageY):(this.posx=Z.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=Z.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let X=R2.getPositionOfChildWindowRelativeToAncestorWindow(U,Z.view);this.posx-=X.left,this.posy-=X.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},O$=class{constructor(U,Z=0,X=0){this.browserEvent=U||null,this.target=U?U.target||U.targetNode||U.srcElement:null,this.deltaY=X,this.deltaX=Z;let Q=!1;if(GQ){let K=navigator.userAgent.match(/Chrome\/(\d+)/);Q=(K?parseInt(K[1]):123)<=122}if(U){let K=U,F=U,$=U.view?.devicePixelRatio||1;if(typeof K.wheelDeltaY<"u")Q?this.deltaY=K.wheelDeltaY/(120*$):this.deltaY=K.wheelDeltaY/120;else if(typeof F.VERTICAL_AXIS<"u"&&F.axis===F.VERTICAL_AXIS)this.deltaY=-F.detail/3;else if(U.type==="wheel"){let q=U;q.deltaMode===q.DOM_DELTA_LINE?yJ&&!TU?this.deltaY=-U.deltaY/3:this.deltaY=-U.deltaY:this.deltaY=-U.deltaY/40}if(typeof K.wheelDeltaX<"u")OK&&DK?this.deltaX=-(K.wheelDeltaX/120):Q?this.deltaX=K.wheelDeltaX/(120*$):this.deltaX=K.wheelDeltaX/120;else if(typeof F.HORIZONTAL_AXIS<"u"&&F.axis===F.HORIZONTAL_AXIS)this.deltaX=-U.detail/3;else if(U.type==="wheel"){let q=U;q.deltaMode===q.DOM_DELTA_LINE?yJ&&!TU?this.deltaX=-U.deltaX/3:this.deltaX=-U.deltaX:this.deltaX=-U.deltaX/40}this.deltaY===0&&this.deltaX===0&&U.wheelDelta&&(Q?this.deltaY=U.wheelDelta/(120*$):this.deltaY=U.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},MK=Object.freeze(function(U,Z){let X=setTimeout(U.bind(Z),0);return{dispose(){clearTimeout(X)}}}),E2;((U)=>{function Z(X){return X===U.None||X===U.Cancelled||X instanceof S2?!0:!X||typeof X!="object"?!1:typeof X.isCancellationRequested=="boolean"&&typeof X.onCancellationRequested=="function"}U.isCancellationToken=Z,U.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:b1.None}),U.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:MK})})(E2||={});var S2=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?MK:(this._emitter||(this._emitter=new w0),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},HA=Symbol("MicrotaskDelay"),$Q=class{constructor(U,Z){this._isDisposed=!1,this._token=-1,typeof U=="function"&&typeof Z=="number"&&this.setIfNotSet(U,Z)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(U,Z){if(this._isDisposed)throw new xJ("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,U()},Z)}setIfNotSet(U,Z){if(this._isDisposed)throw new xJ("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,U()},Z))}},P2=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(U,Z,X=globalThis){if(this.isDisposed)throw new xJ("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let Q=X.setInterval(()=>{U()},Z);this.disposable=U1(()=>{X.clearInterval(Q),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},k2,CJ;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?CJ=(U,Z)=>{F2(()=>{if(X)return;let Q=Date.now()+15;Z(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,Q-Date.now())}}))});let X=!1;return{dispose(){X||(X=!0)}}}:CJ=(U,Z,X)=>{let Q=U.requestIdleCallback(Z,typeof X=="number"?{timeout:X}:void 0),K=!1;return{dispose(){K||(K=!0,U.cancelIdleCallback(Q))}}},k2=(U)=>CJ(globalThis,U)})();var j2;((U)=>{async function Z(Q){let K,F=await Promise.all(Q.map(($)=>$.then((q)=>q,(q)=>{K||(K=q)})));if(typeof K<"u")throw K;return F}U.settled=Z;function X(Q){return new Promise(async(K,F)=>{try{await Q(K,F)}catch($){F($)}})}U.withAsyncBody=X})(j2||={});var C$=class U{static fromArray(Z){return new U((X)=>{X.emitMany(Z)})}static fromPromise(Z){return new U(async(X)=>{X.emitMany(await Z)})}static fromPromises(Z){return new U(async(X)=>{await Promise.all(Z.map(async(Q)=>X.emitOne(await Q)))})}static merge(Z){return new U(async(X)=>{await Promise.all(Z.map(async(Q)=>{for await(let K of Q)X.emitOne(K)}))})}constructor(Z,X){this._state=0,this._results=[],this._error=null,this._onReturn=X,this._onStateChanged=new w0,queueMicrotask(async()=>{let Q={emitOne:(K)=>this.emitOne(K),emitMany:(K)=>this.emitMany(K),reject:(K)=>this.reject(K)};try{await Promise.resolve(Z(Q)),this.resolve()}catch(K){this.reject(K)}finally{Q.emitOne=void 0,Q.emitMany=void 0,Q.reject=void 0}})}[Symbol.asyncIterator](){let Z=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(Z<this._results.length)return{done:!1,value:this._results[Z++]};if(this._state===1)return{done:!0,value:void 0};await b1.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(Z,X){return new U(async(Q)=>{for await(let K of Z)Q.emitOne(X(K))})}map(Z){return U.map(this,Z)}static filter(Z,X){return new U(async(Q)=>{for await(let K of Z)X(K)&&Q.emitOne(K)})}filter(Z){return U.filter(this,Z)}static coalesce(Z){return U.filter(Z,(X)=>!!X)}coalesce(){return U.coalesce(this)}static async toPromise(Z){let X=[];for await(let Q of Z)X.push(Q);return X}toPromise(){return U.toPromise(this)}emitOne(Z){this._state===0&&(this._results.push(Z),this._onStateChanged.fire())}emitMany(Z){this._state===0&&(this._results=this._results.concat(Z),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(Z){this._state===0&&(this._state=2,this._error=Z,this._onStateChanged.fire())}};C$.EMPTY=C$.fromArray([]);function v2(U){return 55296<=U&&U<=56319}function A$(U){return 56320<=U&&U<=57343}function _2(U,Z){return(U-55296<<10)+(Z-56320)+65536}function B2(U){return KQ(U,0)}function KQ(U,Z){switch(typeof U){case"object":return U===null?BU(349,Z):Array.isArray(U)?N2(U,Z):g2(U,Z);case"string":return LK(U,Z);case"boolean":return x2(U,Z);case"number":return BU(U,Z);case"undefined":return BU(937,Z);default:return BU(617,Z)}}function BU(U,Z){return(Z<<5)-Z+U|0}function x2(U,Z){return BU(U?433:863,Z)}function LK(U,Z){Z=BU(149417,Z);for(let X=0,Q=U.length;X<Q;X++)Z=BU(U.charCodeAt(X),Z);return Z}function N2(U,Z){return Z=BU(104579,Z),U.reduce((X,Q)=>KQ(Q,X),Z)}function g2(U,Z){return Z=BU(181387,Z),Object.keys(U).sort().reduce((X,Q)=>(X=LK(Q,X),KQ(U[Q],X)),Z)}function AJ(U,Z,X=32){let Q=X-Z,K=~((1<<Q)-1);return(U<<Z|(K&U)>>>Q)>>>0}function z$(U,Z=0,X=U.byteLength,Q=0){for(let K=0;K<X;K++)U[Z+K]=Q}function f2(U,Z,X="0"){for(;U.length<Z;)U=X+U;return U}function nZ(U,Z=32){return U instanceof ArrayBuffer?Array.from(new Uint8Array(U)).map((X)=>X.toString(16).padStart(2,"0")).join(""):f2((U>>>0).toString(16),Z/4)}var w2=class U{constructor(){this._h0=1732584193,this._h1=4023233417,this._h2=2562383102,this._h3=271733878,this._h4=3285377520,this._buff=new Uint8Array(67),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(Z){let X=Z.length;if(X===0)return;let Q=this._buff,K=this._buffLen,F=this._leftoverHighSurrogate,$,q;for(F!==0?($=F,q=-1,F=0):($=Z.charCodeAt(0),q=0);;){let M=$;if(v2($))if(q+1<X){let z=Z.charCodeAt(q+1);A$(z)?(q++,M=_2($,z)):M=65533}else{F=$;break}else A$($)&&(M=65533);if(K=this._push(Q,K,M),q++,q<X)$=Z.charCodeAt(q);else break}this._buffLen=K,this._leftoverHighSurrogate=F}_push(Z,X,Q){return Q<128?Z[X++]=Q:Q<2048?(Z[X++]=192|(Q&1984)>>>6,Z[X++]=128|(Q&63)>>>0):Q<65536?(Z[X++]=224|(Q&61440)>>>12,Z[X++]=128|(Q&4032)>>>6,Z[X++]=128|(Q&63)>>>0):(Z[X++]=240|(Q&1835008)>>>18,Z[X++]=128|(Q&258048)>>>12,Z[X++]=128|(Q&4032)>>>6,Z[X++]=128|(Q&63)>>>0),X>=64&&(this._step(),X-=64,this._totalLen+=64,Z[0]=Z[64],Z[1]=Z[65],Z[2]=Z[66]),X}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),nZ(this._h0)+nZ(this._h1)+nZ(this._h2)+nZ(this._h3)+nZ(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,z$(this._buff,this._buffLen),this._buffLen>56&&(this._step(),z$(this._buff));let Z=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(Z/4294967296),!1),this._buffDV.setUint32(60,Z%4294967296,!1),this._step()}_step(){let Z=U._bigBlock32,X=this._buffDV;for(let A=0;A<64;A+=4)Z.setUint32(A,X.getUint32(A,!1),!1);for(let A=64;A<320;A+=4)Z.setUint32(A,AJ(Z.getUint32(A-12,!1)^Z.getUint32(A-32,!1)^Z.getUint32(A-56,!1)^Z.getUint32(A-64,!1),1),!1);let Q=this._h0,K=this._h1,F=this._h2,$=this._h3,q=this._h4,M,z,T;for(let A=0;A<80;A++)A<20?(M=K&F|~K&$,z=1518500249):A<40?(M=K^F^$,z=1859775393):A<60?(M=K&F|K&$|F&$,z=2400959708):(M=K^F^$,z=3395469782),T=AJ(Q,5)+M+q+z+Z.getUint32(A*4,!1)&4294967295,q=$,$=F,F=AJ(K,30),K=Q,Q=T;this._h0=this._h0+Q&4294967295,this._h1=this._h1+K&4294967295,this._h2=this._h2+F&4294967295,this._h3=this._h3+$&4294967295,this._h4=this._h4+q&4294967295}};w2._bigBlock32=new DataView(new ArrayBuffer(320));var{registerWindow:OA,getWindow:OU,getDocument:CA,getWindows:AA,getWindowsCount:zA,getWindowId:D$,getWindowById:DA,hasWindow:qA,onDidRegisterWindow:y2,onWillUnregisterWindow:MA,onDidUnregisterWindow:LA}=function(){let U=new Map,Z={window:$U,disposables:new nU};U.set($U.vscodeWindowId,Z);let X=new w0,Q=new w0,K=new w0;function F($,q){return(typeof $=="number"?U.get($):void 0)??(q?Z:void 0)}return{onDidRegisterWindow:X.event,onWillUnregisterWindow:K.event,onDidUnregisterWindow:Q.event,registerWindow($){if(U.has($.vscodeWindowId))return d0.None;let q=new nU,M={window:$,disposables:q.add(new nU)};return U.set($.vscodeWindowId,M),q.add(U1(()=>{U.delete($.vscodeWindowId),Q.fire($)})),q.add(u0($,f1.BEFORE_UNLOAD,()=>{K.fire($)})),X.fire(M),q},getWindows(){return U.values()},getWindowsCount(){return U.size},getWindowId($){return $.vscodeWindowId},hasWindow($){return U.has($)},getWindowById:F,getWindow($){let q=$;if(q?.ownerDocument?.defaultView)return q.ownerDocument.defaultView.window;let M=$;return M?.view?M.view.window:$U},getDocument($){return OU($).document}}}(),c2=class{constructor(U,Z,X,Q){this._node=U,this._type=Z,this._handler=X,this._options=Q||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function u0(U,Z,X,Q){return new c2(U,Z,X,Q)}function p2(U,Z){return function(X){return Z(new eZ(U,X))}}function h2(U){return function(Z){return U(new cJ(Z))}}var q$=function(U,Z,X,Q){let K=X;return Z==="click"||Z==="mousedown"||Z==="contextmenu"?K=p2(OU(U),X):(Z==="keydown"||Z==="keypress"||Z==="keyup")&&(K=h2(X)),u0(U,Z,K,Q)},u2,tX,b2=class extends P2{constructor(U){super(),this.defaultTarget=U&&OU(U)}cancelAndSet(U,Z,X){return super.cancelAndSet(U,Z,X??this.defaultTarget)}},zJ=class{constructor(U,Z=0){this._runner=U,this.priority=Z,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(U){hX(U)}}static sort(U,Z){return Z.priority-U.priority}};(function(){let U=new Map,Z=new Map,X=new Map,Q=new Map,K=(F)=>{X.set(F,!1);let $=U.get(F)??[];for(Z.set(F,$),U.set(F,[]),Q.set(F,!0);$.length>0;)$.sort(zJ.sort),$.shift().execute();Q.set(F,!1)};tX=(F,$,q=0)=>{let M=D$(F),z=new zJ($,q),T=U.get(M);return T||(T=[],U.set(M,T)),T.push(z),X.get(M)||(X.set(M,!0),F.requestAnimationFrame(()=>K(M))),z},u2=(F,$,q)=>{let M=D$(F);if(Q.get(M)){let z=new zJ($,q),T=Z.get(M);return T||(T=[],Z.set(M,T)),T.push(z),z}else return tX(F,$,q)}})();var M$=class U{constructor(Z,X){this.width=Z,this.height=X}with(Z=this.width,X=this.height){return Z!==this.width||X!==this.height?new U(Z,X):this}static is(Z){return typeof Z=="object"&&typeof Z.height=="number"&&typeof Z.width=="number"}static lift(Z){return Z instanceof U?Z:new U(Z.width,Z.height)}static equals(Z,X){return Z===X?!0:!Z||!X?!1:Z.width===X.width&&Z.height===X.height}};M$.None=new M$(0,0);function d2(U){let Z=U.getBoundingClientRect(),X=OU(U);return{left:Z.left+X.scrollX,top:Z.top+X.scrollY,width:Z.width,height:Z.height}}var TA=new class{constructor(){this.mutationObservers=new Map}observe(U,Z,X){let Q=this.mutationObservers.get(U);Q||(Q=new Map,this.mutationObservers.set(U,Q));let K=B2(X),F=Q.get(K);if(F)F.users+=1;else{let $=new w0,q=new MutationObserver((z)=>$.fire(z));q.observe(U,X);let M=F={users:1,observer:q,onDidMutate:$.event};Z.add(U1(()=>{M.users-=1,M.users===0&&($.dispose(),q.disconnect(),Q?.delete(K),Q?.size===0&&this.mutationObservers.delete(U))})),Q.set(K,F)}return F.onDidMutate}},f1={CLICK:"click",AUXCLICK:"auxclick",DBLCLICK:"dblclick",MOUSE_UP:"mouseup",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_MOVE:"mousemove",MOUSE_OUT:"mouseout",MOUSE_ENTER:"mouseenter",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",POINTER_LEAVE:"pointerleave",CONTEXT_MENU:"contextmenu",WHEEL:"wheel",KEY_DOWN:"keydown",KEY_PRESS:"keypress",KEY_UP:"keyup",LOAD:"load",BEFORE_UNLOAD:"beforeunload",UNLOAD:"unload",PAGE_SHOW:"pageshow",PAGE_HIDE:"pagehide",PASTE:"paste",ABORT:"abort",ERROR:"error",RESIZE:"resize",SCROLL:"scroll",FULLSCREEN_CHANGE:"fullscreenchange",WK_FULLSCREEN_CHANGE:"webkitfullscreenchange",SELECT:"select",CHANGE:"change",SUBMIT:"submit",RESET:"reset",FOCUS:"focus",FOCUS_IN:"focusin",FOCUS_OUT:"focusout",BLUR:"blur",INPUT:"input",STORAGE:"storage",DRAG_START:"dragstart",DRAG:"drag",DRAG_ENTER:"dragenter",DRAG_LEAVE:"dragleave",DRAG_OVER:"dragover",DROP:"drop",DRAG_END:"dragend",ANIMATION_START:dX?"webkitAnimationStart":"animationstart",ANIMATION_END:dX?"webkitAnimationEnd":"animationend",ANIMATION_ITERATION:dX?"webkitAnimationIteration":"animationiteration"},l2=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function TK(U,Z,X,...Q){let K=l2.exec(Z);if(!K)throw Error("Bad use of emmet");let F=K[1]||"div",$;return U!=="http://www.w3.org/1999/xhtml"?$=document.createElementNS(U,F):$=document.createElement(F),K[3]&&($.id=K[3]),K[4]&&($.className=K[4].replace(/\./g," ").trim()),X&&Object.entries(X).forEach(([q,M])=>{typeof M>"u"||(/^on\w+$/.test(q)?$[q]=M:q==="selected"?M&&$.setAttribute(q,"true"):$.setAttribute(q,M))}),$.append(...Q),$}function o2(U,Z,...X){return TK("http://www.w3.org/1999/xhtml",U,Z,...X)}o2.SVG=function(U,Z,...X){return TK("http://www.w3.org/2000/svg",U,Z,...X)};var n2=class{constructor(U){this.domNode=U,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(U){let Z=ZU(U);this._maxWidth!==Z&&(this._maxWidth=Z,this.domNode.style.maxWidth=this._maxWidth)}setWidth(U){let Z=ZU(U);this._width!==Z&&(this._width=Z,this.domNode.style.width=this._width)}setHeight(U){let Z=ZU(U);this._height!==Z&&(this._height=Z,this.domNode.style.height=this._height)}setTop(U){let Z=ZU(U);this._top!==Z&&(this._top=Z,this.domNode.style.top=this._top)}setLeft(U){let Z=ZU(U);this._left!==Z&&(this._left=Z,this.domNode.style.left=this._left)}setBottom(U){let Z=ZU(U);this._bottom!==Z&&(this._bottom=Z,this.domNode.style.bottom=this._bottom)}setRight(U){let Z=ZU(U);this._right!==Z&&(this._right=Z,this.domNode.style.right=this._right)}setPaddingTop(U){let Z=ZU(U);this._paddingTop!==Z&&(this._paddingTop=Z,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(U){let Z=ZU(U);this._paddingLeft!==Z&&(this._paddingLeft=Z,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(U){let Z=ZU(U);this._paddingBottom!==Z&&(this._paddingBottom=Z,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(U){let Z=ZU(U);this._paddingRight!==Z&&(this._paddingRight=Z,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(U){this._fontFamily!==U&&(this._fontFamily=U,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(U){this._fontWeight!==U&&(this._fontWeight=U,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(U){let Z=ZU(U);this._fontSize!==Z&&(this._fontSize=Z,this.domNode.style.fontSize=this._fontSize)}setFontStyle(U){this._fontStyle!==U&&(this._fontStyle=U,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(U){this._fontFeatureSettings!==U&&(this._fontFeatureSettings=U,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(U){this._fontVariationSettings!==U&&(this._fontVariationSettings=U,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(U){this._textDecoration!==U&&(this._textDecoration=U,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(U){let Z=ZU(U);this._lineHeight!==Z&&(this._lineHeight=Z,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(U){let Z=ZU(U);this._letterSpacing!==Z&&(this._letterSpacing=Z,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(U){this._className!==U&&(this._className=U,this.domNode.className=this._className)}toggleClassName(U,Z){this.domNode.classList.toggle(U,Z),this._className=this.domNode.className}setDisplay(U){this._display!==U&&(this._display=U,this.domNode.style.display=this._display)}setPosition(U){this._position!==U&&(this._position=U,this.domNode.style.position=this._position)}setVisibility(U){this._visibility!==U&&(this._visibility=U,this.domNode.style.visibility=this._visibility)}setColor(U){this._color!==U&&(this._color=U,this.domNode.style.color=this._color)}setBackgroundColor(U){this._backgroundColor!==U&&(this._backgroundColor=U,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(U){this._layerHint!==U&&(this._layerHint=U,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(U){this._boxShadow!==U&&(this._boxShadow=U,this.domNode.style.boxShadow=U)}setContain(U){this._contain!==U&&(this._contain=U,this.domNode.style.contain=this._contain)}setAttribute(U,Z){this.domNode.setAttribute(U,Z)}removeAttribute(U){this.domNode.removeAttribute(U)}appendChild(U){this.domNode.appendChild(U.domNode)}removeChild(U){this.domNode.removeChild(U.domNode)}};function ZU(U){return typeof U=="number"?`${U}px`:U}function GX(U){return new n2(U)}var RK=class{constructor(){this._hooks=new nU,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(U,Z){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let X=this._onStopCallback;this._onStopCallback=null,U&&X&&X(Z)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(U,Z,X,Q,K){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=Q,this._onStopCallback=K;let F=U;try{U.setPointerCapture(Z),this._hooks.add(U1(()=>{try{U.releasePointerCapture(Z)}catch{}}))}catch{F=OU(U)}this._hooks.add(u0(F,f1.POINTER_MOVE,($)=>{if($.buttons!==X){this.stopMonitoring(!0);return}$.preventDefault(),this._pointerMoveCallback($)})),this._hooks.add(u0(F,f1.POINTER_UP,($)=>this.stopMonitoring(!0)))}};function m2(U,Z,X){let Q=null,K=null;if(typeof X.value=="function"?(Q="value",K=X.value,K.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof X.get=="function"&&(Q="get",K=X.get),!K)throw Error("not supported");let F=`$memoize$${Z}`;X[Q]=function(...$){return this.hasOwnProperty(F)||Object.defineProperty(this,F,{configurable:!1,enumerable:!1,writable:!1,value:K.apply(this,$)}),this[F]}}var LU;((U)=>(U.Tap="-xterm-gesturetap",U.Change="-xterm-gesturechange",U.Start="-xterm-gesturestart",U.End="-xterm-gesturesend",U.Contextmenu="-xterm-gesturecontextmenu"))(LU||={});var UX=class U extends d0{constructor(){super();this.dispatched=!1,this.targets=new V$,this.ignoreTargets=new V$,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(b1.runAndSubscribe(y2,({window:Z,disposables:X})=>{X.add(u0(Z.document,"touchstart",(Q)=>this.onTouchStart(Q),{passive:!1})),X.add(u0(Z.document,"touchend",(Q)=>this.onTouchEnd(Z,Q))),X.add(u0(Z.document,"touchmove",(Q)=>this.onTouchMove(Q),{passive:!1}))},{window:$U,disposables:this._store}))}static addTarget(Z){if(!U.isTouchDevice())return d0.None;U.INSTANCE||(U.INSTANCE=G$(new U));let X=U.INSTANCE.targets.push(Z);return U1(X)}static ignoreTarget(Z){if(!U.isTouchDevice())return d0.None;U.INSTANCE||(U.INSTANCE=G$(new U));let X=U.INSTANCE.ignoreTargets.push(Z);return U1(X)}static isTouchDevice(){return"ontouchstart"in $U||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(Z){let X=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let Q=0,K=Z.targetTouches.length;Q<K;Q++){let F=Z.targetTouches.item(Q);this.activeTouches[F.identifier]={id:F.identifier,initialTarget:F.target,initialTimeStamp:X,initialPageX:F.pageX,initialPageY:F.pageY,rollingTimestamps:[X],rollingPageX:[F.pageX],rollingPageY:[F.pageY]};let $=this.newGestureEvent(LU.Start,F.target);$.pageX=F.pageX,$.pageY=F.pageY,this.dispatchEvent($)}this.dispatched&&(Z.preventDefault(),Z.stopPropagation(),this.dispatched=!1)}onTouchEnd(Z,X){let Q=Date.now(),K=Object.keys(this.activeTouches).length;for(let F=0,$=X.changedTouches.length;F<$;F++){let q=X.changedTouches.item(F);if(!this.activeTouches.hasOwnProperty(String(q.identifier))){console.warn("move of an UNKNOWN touch",q);continue}let M=this.activeTouches[q.identifier],z=Date.now()-M.initialTimeStamp;if(z<U.HOLD_DELAY&&Math.abs(M.initialPageX-QU(M.rollingPageX))<30&&Math.abs(M.initialPageY-QU(M.rollingPageY))<30){let T=this.newGestureEvent(LU.Tap,M.initialTarget);T.pageX=QU(M.rollingPageX),T.pageY=QU(M.rollingPageY),this.dispatchEvent(T)}else if(z>=U.HOLD_DELAY&&Math.abs(M.initialPageX-QU(M.rollingPageX))<30&&Math.abs(M.initialPageY-QU(M.rollingPageY))<30){let T=this.newGestureEvent(LU.Contextmenu,M.initialTarget);T.pageX=QU(M.rollingPageX),T.pageY=QU(M.rollingPageY),this.dispatchEvent(T)}else if(K===1){let T=QU(M.rollingPageX),A=QU(M.rollingPageY),L=QU(M.rollingTimestamps)-M.rollingTimestamps[0],E=T-M.rollingPageX[0],S=A-M.rollingPageY[0],j=[...this.targets].filter((k)=>M.initialTarget instanceof Node&&k.contains(M.initialTarget));this.inertia(Z,j,Q,Math.abs(E)/L,E>0?1:-1,T,Math.abs(S)/L,S>0?1:-1,A)}this.dispatchEvent(this.newGestureEvent(LU.End,M.initialTarget)),delete this.activeTouches[q.identifier]}this.dispatched&&(X.preventDefault(),X.stopPropagation(),this.dispatched=!1)}newGestureEvent(Z,X){let Q=document.createEvent("CustomEvent");return Q.initEvent(Z,!1,!0),Q.initialTarget=X,Q.tapCount=0,Q}dispatchEvent(Z){if(Z.type===LU.Tap){let X=new Date().getTime(),Q=0;X-this._lastSetTapCountTime>U.CLEAR_TAP_COUNT_TIME?Q=1:Q=2,this._lastSetTapCountTime=X,Z.tapCount=Q}else(Z.type===LU.Change||Z.type===LU.Contextmenu)&&(this._lastSetTapCountTime=0);if(Z.initialTarget instanceof Node){for(let Q of this.ignoreTargets)if(Q.contains(Z.initialTarget))return;let X=[];for(let Q of this.targets)if(Q.contains(Z.initialTarget)){let K=0,F=Z.initialTarget;for(;F&&F!==Q;)K++,F=F.parentElement;X.push([K,Q])}X.sort((Q,K)=>Q[0]-K[0]);for(let[Q,K]of X)K.dispatchEvent(Z),this.dispatched=!0}}inertia(Z,X,Q,K,F,$,q,M,z){this.handle=tX(Z,()=>{let T=Date.now(),A=T-Q,L=0,E=0,S=!0;K+=U.SCROLL_FRICTION*A,q+=U.SCROLL_FRICTION*A,K>0&&(S=!1,L=F*K*A),q>0&&(S=!1,E=M*q*A);let j=this.newGestureEvent(LU.Change);j.translationX=L,j.translationY=E,X.forEach((k)=>k.dispatchEvent(j)),S||this.inertia(Z,X,T,K,F,$+L,q,M,z+E)})}onTouchMove(Z){let X=Date.now();for(let Q=0,K=Z.changedTouches.length;Q<K;Q++){let F=Z.changedTouches.item(Q);if(!this.activeTouches.hasOwnProperty(String(F.identifier))){console.warn("end of an UNKNOWN touch",F);continue}let $=this.activeTouches[F.identifier],q=this.newGestureEvent(LU.Change,$.initialTarget);q.translationX=F.pageX-QU($.rollingPageX),q.translationY=F.pageY-QU($.rollingPageY),q.pageX=F.pageX,q.pageY=F.pageY,this.dispatchEvent(q),$.rollingPageX.length>3&&($.rollingPageX.shift(),$.rollingPageY.shift(),$.rollingTimestamps.shift()),$.rollingPageX.push(F.pageX),$.rollingPageY.push(F.pageY),$.rollingTimestamps.push(X)}this.dispatched&&(Z.preventDefault(),Z.stopPropagation(),this.dispatched=!1)}};UX.SCROLL_FRICTION=-0.005,UX.HOLD_DELAY=700,UX.CLEAR_TAP_COUNT_TIME=400,$1([m2],UX,"isTouchDevice",1);var s2=UX,WQ=class extends d0{onclick(U,Z){this._register(u0(U,f1.CLICK,(X)=>Z(new eZ(OU(U),X))))}onmousedown(U,Z){this._register(u0(U,f1.MOUSE_DOWN,(X)=>Z(new eZ(OU(U),X))))}onmouseover(U,Z){this._register(u0(U,f1.MOUSE_OVER,(X)=>Z(new eZ(OU(U),X))))}onmouseleave(U,Z){this._register(u0(U,f1.MOUSE_LEAVE,(X)=>Z(new eZ(OU(U),X))))}onkeydown(U,Z){this._register(u0(U,f1.KEY_DOWN,(X)=>Z(new cJ(X))))}onkeyup(U,Z){this._register(u0(U,f1.KEY_UP,(X)=>Z(new cJ(X))))}oninput(U,Z){this._register(u0(U,f1.INPUT,Z))}onblur(U,Z){this._register(u0(U,f1.BLUR,Z))}onfocus(U,Z){this._register(u0(U,f1.FOCUS,Z))}onchange(U,Z){this._register(u0(U,f1.CHANGE,Z))}ignoreGesture(U){return s2.ignoreTarget(U)}},L$=11,r2=class extends WQ{constructor(U){super(),this._onActivate=U.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=U.bgWidth+"px",this.bgDomNode.style.height=U.bgHeight+"px",typeof U.top<"u"&&(this.bgDomNode.style.top="0px"),typeof U.left<"u"&&(this.bgDomNode.style.left="0px"),typeof U.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof U.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=U.className,this.domNode.style.position="absolute",this.domNode.style.width=L$+"px",this.domNode.style.height=L$+"px",typeof U.top<"u"&&(this.domNode.style.top=U.top+"px"),typeof U.left<"u"&&(this.domNode.style.left=U.left+"px"),typeof U.bottom<"u"&&(this.domNode.style.bottom=U.bottom+"px"),typeof U.right<"u"&&(this.domNode.style.right=U.right+"px"),this._pointerMoveMonitor=this._register(new RK),this._register(q$(this.bgDomNode,f1.POINTER_DOWN,(Z)=>this._arrowPointerDown(Z))),this._register(q$(this.domNode,f1.POINTER_DOWN,(Z)=>this._arrowPointerDown(Z))),this._pointerdownRepeatTimer=this._register(new b2),this._pointerdownScheduleRepeatTimer=this._register(new $Q)}_arrowPointerDown(U){if(!U.target||!(U.target instanceof Element))return;let Z=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),41.666666666666664,OU(U))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(Z,200),this._pointerMoveMonitor.startMonitoring(U.target,U.pointerId,U.buttons,(X)=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),U.preventDefault()}},a2=class U{constructor(Z,X,Q,K,F,$,q){this._forceIntegerValues=Z,this._scrollStateBrand=void 0,this._forceIntegerValues&&(X=X|0,Q=Q|0,K=K|0,F=F|0,$=$|0,q=q|0),this.rawScrollLeft=K,this.rawScrollTop=q,X<0&&(X=0),K+X>Q&&(K=Q-X),K<0&&(K=0),F<0&&(F=0),q+F>$&&(q=$-F),q<0&&(q=0),this.width=X,this.scrollWidth=Q,this.scrollLeft=K,this.height=F,this.scrollHeight=$,this.scrollTop=q}equals(Z){return this.rawScrollLeft===Z.rawScrollLeft&&this.rawScrollTop===Z.rawScrollTop&&this.width===Z.width&&this.scrollWidth===Z.scrollWidth&&this.scrollLeft===Z.scrollLeft&&this.height===Z.height&&this.scrollHeight===Z.scrollHeight&&this.scrollTop===Z.scrollTop}withScrollDimensions(Z,X){return new U(this._forceIntegerValues,typeof Z.width<"u"?Z.width:this.width,typeof Z.scrollWidth<"u"?Z.scrollWidth:this.scrollWidth,X?this.rawScrollLeft:this.scrollLeft,typeof Z.height<"u"?Z.height:this.height,typeof Z.scrollHeight<"u"?Z.scrollHeight:this.scrollHeight,X?this.rawScrollTop:this.scrollTop)}withScrollPosition(Z){return new U(this._forceIntegerValues,this.width,this.scrollWidth,typeof Z.scrollLeft<"u"?Z.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof Z.scrollTop<"u"?Z.scrollTop:this.rawScrollTop)}createScrollEvent(Z,X){let Q=this.width!==Z.width,K=this.scrollWidth!==Z.scrollWidth,F=this.scrollLeft!==Z.scrollLeft,$=this.height!==Z.height,q=this.scrollHeight!==Z.scrollHeight,M=this.scrollTop!==Z.scrollTop;return{inSmoothScrolling:X,oldWidth:Z.width,oldScrollWidth:Z.scrollWidth,oldScrollLeft:Z.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:Z.height,oldScrollHeight:Z.scrollHeight,oldScrollTop:Z.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:Q,scrollWidthChanged:K,scrollLeftChanged:F,heightChanged:$,scrollHeightChanged:q,scrollTopChanged:M}}},t2=class extends d0{constructor(U){super();this._scrollableBrand=void 0,this._onScroll=this._register(new w0),this.onScroll=this._onScroll.event,this._smoothScrollDuration=U.smoothScrollDuration,this._scheduleAtNextAnimationFrame=U.scheduleAtNextAnimationFrame,this._state=new a2(U.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(U){this._smoothScrollDuration=U}validateScrollPosition(U){return this._state.withScrollPosition(U)}getScrollDimensions(){return this._state}setScrollDimensions(U,Z){let X=this._state.withScrollDimensions(U,Z);this._setState(X,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(U){let Z=this._state.withScrollPosition(U);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(Z,!1)}setScrollPositionSmooth(U,Z){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(U);if(this._smoothScrolling){U={scrollLeft:typeof U.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:U.scrollLeft,scrollTop:typeof U.scrollTop>"u"?this._smoothScrolling.to.scrollTop:U.scrollTop};let X=this._state.withScrollPosition(U);if(this._smoothScrolling.to.scrollLeft===X.scrollLeft&&this._smoothScrolling.to.scrollTop===X.scrollTop)return;let Q;Z?Q=new R$(this._smoothScrolling.from,X,this._smoothScrolling.startTime,this._smoothScrolling.duration):Q=this._smoothScrolling.combine(this._state,X,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=Q}else{let X=this._state.withScrollPosition(U);this._smoothScrolling=R$.start(this._state,X,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let U=this._smoothScrolling.tick(),Z=this._state.withScrollPosition(U);if(this._setState(Z,!0),!!this._smoothScrolling){if(U.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(U,Z){let X=this._state;X.equals(U)||(this._state=U,this._onScroll.fire(this._state.createScrollEvent(X,Z)))}},T$=class{constructor(U,Z,X){this.scrollLeft=U,this.scrollTop=Z,this.isDone=X}};function DJ(U,Z){let X=Z-U;return function(Q){return U+X*U8(Q)}}function i2(U,Z,X){return function(Q){return Q<X?U(Q/X):Z((Q-X)/(1-X))}}var R$=class U{constructor(Z,X,Q,K){this.from=Z,this.to=X,this.duration=K,this.startTime=Q,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(Z,X,Q){if(Math.abs(Z-X)>2.5*Q){let K,F;return Z<X?(K=Z+0.75*Q,F=X-0.75*Q):(K=Z-0.75*Q,F=X+0.75*Q),i2(DJ(Z,K),DJ(F,X),0.33)}return DJ(Z,X)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(Z){this.to=Z.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(Z){let X=(Z-this.startTime)/this.duration;if(X<1){let Q=this.scrollLeft(X),K=this.scrollTop(X);return new T$(Q,K,!1)}return new T$(this.to.scrollLeft,this.to.scrollTop,!0)}combine(Z,X,Q){return U.start(Z,X,Q)}static start(Z,X,Q){Q=Q+10;let K=Date.now()-10;return new U(Z,X,K,Q)}};function e2(U){return Math.pow(U,3)}function U8(U){return 1-e2(1-U)}var Z8=class extends d0{constructor(U,Z,X){super(),this._visibility=U,this._visibleClassName=Z,this._invisibleClassName=X,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new $Q)}setVisibility(U){this._visibility!==U&&(this._visibility=U,this._updateShouldBeVisible())}setShouldBeVisible(U){this._rawShouldBeVisible=U,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let U=this._applyVisibilitySetting();this._shouldBeVisible!==U&&(this._shouldBeVisible=U,this.ensureVisibility())}setIsNeeded(U){this._isNeeded!==U&&(this._isNeeded=U,this.ensureVisibility())}setDomNode(U){this._domNode=U,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(U){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(U?" fade":"")))}},X8=140,EK=class extends WQ{constructor(U){super(),this._lazyRender=U.lazyRender,this._host=U.host,this._scrollable=U.scrollable,this._scrollByPage=U.scrollByPage,this._scrollbarState=U.scrollbarState,this._visibilityController=this._register(new Z8(U.visibility,"visible scrollbar "+U.extraScrollbarClassName,"invisible scrollbar "+U.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new RK),this._shouldRender=!0,this.domNode=GX(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(u0(this.domNode.domNode,f1.POINTER_DOWN,(Z)=>this._domNodePointerDown(Z)))}_createArrow(U){let Z=this._register(new r2(U));this.domNode.domNode.appendChild(Z.bgDomNode),this.domNode.domNode.appendChild(Z.domNode)}_createSlider(U,Z,X,Q){this.slider=GX(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(U),this.slider.setLeft(Z),typeof X=="number"&&this.slider.setWidth(X),typeof Q=="number"&&this.slider.setHeight(Q),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(u0(this.slider.domNode,f1.POINTER_DOWN,(K)=>{K.button===0&&(K.preventDefault(),this._sliderPointerDown(K))})),this.onclick(this.slider.domNode,(K)=>{K.leftButton&&K.stopPropagation()})}_onElementSize(U){return this._scrollbarState.setVisibleSize(U)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(U){return this._scrollbarState.setScrollSize(U)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(U){return this._scrollbarState.setScrollPosition(U)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(U){U.target===this.domNode.domNode&&this._onPointerDown(U)}delegatePointerDown(U){let Z=this.domNode.domNode.getClientRects()[0].top,X=Z+this._scrollbarState.getSliderPosition(),Q=Z+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),K=this._sliderPointerPosition(U);X<=K&&K<=Q?U.button===0&&(U.preventDefault(),this._sliderPointerDown(U)):this._onPointerDown(U)}_onPointerDown(U){let Z,X;if(U.target===this.domNode.domNode&&typeof U.offsetX=="number"&&typeof U.offsetY=="number")Z=U.offsetX,X=U.offsetY;else{let K=d2(this.domNode.domNode);Z=U.pageX-K.left,X=U.pageY-K.top}let Q=this._pointerDownRelativePosition(Z,X);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(Q):this._scrollbarState.getDesiredScrollPositionFromOffset(Q)),U.button===0&&(U.preventDefault(),this._sliderPointerDown(U))}_sliderPointerDown(U){if(!U.target||!(U.target instanceof Element))return;let Z=this._sliderPointerPosition(U),X=this._sliderOrthogonalPointerPosition(U),Q=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(U.target,U.pointerId,U.buttons,(K)=>{let F=this._sliderOrthogonalPointerPosition(K),$=Math.abs(F-X);if(DK&&$>X8){this._setDesiredScrollPositionNow(Q.getScrollPosition());return}let q=this._sliderPointerPosition(K)-Z;this._setDesiredScrollPositionNow(Q.getDesiredScrollPositionFromDelta(q))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(U){let Z={};this.writeScrollPosition(Z,U),this._scrollable.setScrollPositionNow(Z)}updateScrollbarSize(U){this._updateScrollbarSize(U),this._scrollbarState.setScrollbarSize(U),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},SK=class U{constructor(Z,X,Q,K,F,$){this._scrollbarSize=Math.round(X),this._oppositeScrollbarSize=Math.round(Q),this._arrowSize=Math.round(Z),this._visibleSize=K,this._scrollSize=F,this._scrollPosition=$,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new U(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(Z){let X=Math.round(Z);return this._visibleSize!==X?(this._visibleSize=X,this._refreshComputedValues(),!0):!1}setScrollSize(Z){let X=Math.round(Z);return this._scrollSize!==X?(this._scrollSize=X,this._refreshComputedValues(),!0):!1}setScrollPosition(Z){let X=Math.round(Z);return this._scrollPosition!==X?(this._scrollPosition=X,this._refreshComputedValues(),!0):!1}setScrollbarSize(Z){this._scrollbarSize=Math.round(Z)}setOppositeScrollbarSize(Z){this._oppositeScrollbarSize=Math.round(Z)}static _computeValues(Z,X,Q,K,F){let $=Math.max(0,Q-Z),q=Math.max(0,$-2*X),M=K>0&&K>Q;if(!M)return{computedAvailableSize:Math.round($),computedIsNeeded:M,computedSliderSize:Math.round(q),computedSliderRatio:0,computedSliderPosition:0};let z=Math.round(Math.max(20,Math.floor(Q*q/K))),T=(q-z)/(K-Q),A=F*T;return{computedAvailableSize:Math.round($),computedIsNeeded:M,computedSliderSize:Math.round(z),computedSliderRatio:T,computedSliderPosition:Math.round(A)}}_refreshComputedValues(){let Z=U._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=Z.computedAvailableSize,this._computedIsNeeded=Z.computedIsNeeded,this._computedSliderSize=Z.computedSliderSize,this._computedSliderRatio=Z.computedSliderRatio,this._computedSliderPosition=Z.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(Z){if(!this._computedIsNeeded)return 0;let X=Z-this._arrowSize-this._computedSliderSize/2;return Math.round(X/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(Z){if(!this._computedIsNeeded)return 0;let X=Z-this._arrowSize,Q=this._scrollPosition;return X<this._computedSliderPosition?Q-=this._visibleSize:Q+=this._visibleSize,Q}getDesiredScrollPositionFromDelta(Z){if(!this._computedIsNeeded)return 0;let X=this._computedSliderPosition+Z;return Math.round(X/this._computedSliderRatio)}},Y8=class extends EK{constructor(U,Z,X){let Q=U.getScrollDimensions(),K=U.getCurrentScrollPosition();if(super({lazyRender:Z.lazyRender,host:X,scrollbarState:new SK(Z.horizontalHasArrows?Z.arrowSize:0,Z.horizontal===2?0:Z.horizontalScrollbarSize,Z.vertical===2?0:Z.verticalScrollbarSize,Q.width,Q.scrollWidth,K.scrollLeft),visibility:Z.horizontal,extraScrollbarClassName:"horizontal",scrollable:U,scrollByPage:Z.scrollByPage}),Z.horizontalHasArrows)throw Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((Z.horizontalScrollbarSize-Z.horizontalSliderSize)/2),0,void 0,Z.horizontalSliderSize)}_updateSlider(U,Z){this.slider.setWidth(U),this.slider.setLeft(Z)}_renderDomNode(U,Z){this.domNode.setWidth(U),this.domNode.setHeight(Z),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(U){return this._shouldRender=this._onElementScrollSize(U.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(U.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(U.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(U,Z){return U}_sliderPointerPosition(U){return U.pageX}_sliderOrthogonalPointerPosition(U){return U.pageY}_updateScrollbarSize(U){this.slider.setHeight(U)}writeScrollPosition(U,Z){U.scrollLeft=Z}updateOptions(U){this.updateScrollbarSize(U.horizontal===2?0:U.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(U.vertical===2?0:U.verticalScrollbarSize),this._visibilityController.setVisibility(U.horizontal),this._scrollByPage=U.scrollByPage}},J8=class extends EK{constructor(U,Z,X){let Q=U.getScrollDimensions(),K=U.getCurrentScrollPosition();if(super({lazyRender:Z.lazyRender,host:X,scrollbarState:new SK(Z.verticalHasArrows?Z.arrowSize:0,Z.vertical===2?0:Z.verticalScrollbarSize,0,Q.height,Q.scrollHeight,K.scrollTop),visibility:Z.vertical,extraScrollbarClassName:"vertical",scrollable:U,scrollByPage:Z.scrollByPage}),Z.verticalHasArrows)throw Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((Z.verticalScrollbarSize-Z.verticalSliderSize)/2),Z.verticalSliderSize,void 0)}_updateSlider(U,Z){this.slider.setHeight(U),this.slider.setTop(Z)}_renderDomNode(U,Z){this.domNode.setWidth(Z),this.domNode.setHeight(U),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(U){return this._shouldRender=this._onElementScrollSize(U.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(U.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(U.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(U,Z){return Z}_sliderPointerPosition(U){return U.pageY}_sliderOrthogonalPointerPosition(U){return U.pageX}_updateScrollbarSize(U){this.slider.setWidth(U)}writeScrollPosition(U,Z){U.scrollTop=Z}updateOptions(U){this.updateScrollbarSize(U.vertical===2?0:U.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(U.vertical),this._scrollByPage=U.scrollByPage}},Q8=500,E$=50,S$=!0,G8=class{constructor(U,Z,X){this.timestamp=U,this.deltaX=Z,this.deltaY=X,this.score=0}},pJ=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let Z=1,X=0,Q=1,K=this._rear;do{let F=K===this._front?Z:Math.pow(2,-Q);if(Z-=F,X+=this._memory[K].score*F,K===this._front)break;K=(this._capacity+K-1)%this._capacity,Q++}while(!0);return X<=0.5}acceptStandardWheelEvent(Z){if(GQ){let X=OU(Z.browserEvent),Q=eO(X);this.accept(Date.now(),Z.deltaX*Q,Z.deltaY*Q)}else this.accept(Date.now(),Z.deltaX,Z.deltaY)}accept(Z,X,Q){let K=null,F=new G8(Z,X,Q);this._front===-1&&this._rear===-1?(this._memory[0]=F,this._front=0,this._rear=0):(K=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=F),F.score=this._computeScore(F,K)}_computeScore(Z,X){if(Math.abs(Z.deltaX)>0&&Math.abs(Z.deltaY)>0)return 1;let Q=0.5;if((!this._isAlmostInt(Z.deltaX)||!this._isAlmostInt(Z.deltaY))&&(Q+=0.25),X){let K=Math.abs(Z.deltaX),F=Math.abs(Z.deltaY),$=Math.abs(X.deltaX),q=Math.abs(X.deltaY),M=Math.max(Math.min(K,$),1),z=Math.max(Math.min(F,q),1),T=Math.max(K,$),A=Math.max(F,q);T%M===0&&A%z===0&&(Q-=0.5)}return Math.min(Math.max(Q,0),1)}_isAlmostInt(Z){return Math.abs(Math.round(Z)-Z)<0.01}};pJ.INSTANCE=new pJ;var V8=pJ,$8=class extends WQ{constructor(U,Z,X){super();this._onScroll=this._register(new w0),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new w0),this.onWillScroll=this._onWillScroll.event,this._options=W8(Z),this._scrollable=X,this._register(this._scrollable.onScroll((K)=>{this._onWillScroll.fire(K),this._onDidScroll(K),this._onScroll.fire(K)}));let Q={onMouseWheel:(K)=>this._onMouseWheel(K),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new J8(this._scrollable,this._options,Q)),this._horizontalScrollbar=this._register(new Y8(this._scrollable,this._options,Q)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(U),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=GX(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=GX(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=GX(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,(K)=>this._onMouseOver(K)),this.onmouseleave(this._listenOnDomNode,(K)=>this._onMouseLeave(K)),this._hideTimeout=this._register(new $Q),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=VZ(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(U){this._verticalScrollbar.delegatePointerDown(U)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(U){this._scrollable.setScrollDimensions(U,!1)}updateClassName(U){this._options.className=U,TU&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(U){typeof U.handleMouseWheel<"u"&&(this._options.handleMouseWheel=U.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof U.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=U.mouseWheelScrollSensitivity),typeof U.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=U.fastScrollSensitivity),typeof U.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=U.scrollPredominantAxis),typeof U.horizontal<"u"&&(this._options.horizontal=U.horizontal),typeof U.vertical<"u"&&(this._options.vertical=U.vertical),typeof U.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=U.horizontalScrollbarSize),typeof U.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=U.verticalScrollbarSize),typeof U.scrollByPage<"u"&&(this._options.scrollByPage=U.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(U){this._revealOnScroll=U}delegateScrollFromMouseWheelEvent(U){this._onMouseWheel(new O$(U))}_setListeningToMouseWheel(U){if(this._mouseWheelToDispose.length>0!==U&&(this._mouseWheelToDispose=VZ(this._mouseWheelToDispose),U)){let Z=(X)=>{this._onMouseWheel(new O$(X))};this._mouseWheelToDispose.push(u0(this._listenOnDomNode,f1.MOUSE_WHEEL,Z,{passive:!1}))}}_onMouseWheel(U){if(U.browserEvent?.defaultPrevented)return;let Z=V8.INSTANCE;S$&&Z.acceptStandardWheelEvent(U);let X=!1;if(U.deltaY||U.deltaX){let K=U.deltaY*this._options.mouseWheelScrollSensitivity,F=U.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&F+K===0?F=K=0:Math.abs(K)>=Math.abs(F)?F=0:K=0),this._options.flipAxes&&([K,F]=[F,K]);let $=!TU&&U.browserEvent&&U.browserEvent.shiftKey;(this._options.scrollYToX||$)&&!F&&(F=K,K=0),U.browserEvent&&U.browserEvent.altKey&&(F=F*this._options.fastScrollSensitivity,K=K*this._options.fastScrollSensitivity);let q=this._scrollable.getFutureScrollPosition(),M={};if(K){let z=E$*K,T=q.scrollTop-(z<0?Math.floor(z):Math.ceil(z));this._verticalScrollbar.writeScrollPosition(M,T)}if(F){let z=E$*F,T=q.scrollLeft-(z<0?Math.floor(z):Math.ceil(z));this._horizontalScrollbar.writeScrollPosition(M,T)}M=this._scrollable.validateScrollPosition(M),(q.scrollLeft!==M.scrollLeft||q.scrollTop!==M.scrollTop)&&(S$&&this._options.mouseWheelSmoothScroll&&Z.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(M):this._scrollable.setScrollPositionNow(M),X=!0)}let Q=X;!Q&&this._options.alwaysConsumeMouseWheel&&(Q=!0),!Q&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(Q=!0),Q&&(U.preventDefault(),U.stopPropagation())}_onDidScroll(U){this._shouldRender=this._horizontalScrollbar.onDidScroll(U)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(U)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let U=this._scrollable.getCurrentScrollPosition(),Z=U.scrollTop>0,X=U.scrollLeft>0,Q=X?" left":"",K=Z?" top":"",F=X||Z?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${Q}`),this._topShadowDomNode.setClassName(`shadow${K}`),this._topLeftShadowDomNode.setClassName(`shadow${F}${K}${Q}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(U){this._mouseIsOver=!1,this._hide()}_onMouseOver(U){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),Q8)}},K8=class extends $8{constructor(U,Z,X){super(U,Z,X)}setScrollPosition(U){U.reuseAnimation?this._scrollable.setScrollPositionSmooth(U,U.reuseAnimation):this._scrollable.setScrollPositionNow(U)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function W8(U){let Z={lazyRender:typeof U.lazyRender<"u"?U.lazyRender:!1,className:typeof U.className<"u"?U.className:"",useShadows:typeof U.useShadows<"u"?U.useShadows:!0,handleMouseWheel:typeof U.handleMouseWheel<"u"?U.handleMouseWheel:!0,flipAxes:typeof U.flipAxes<"u"?U.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof U.consumeMouseWheelIfScrollbarIsNeeded<"u"?U.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof U.alwaysConsumeMouseWheel<"u"?U.alwaysConsumeMouseWheel:!1,scrollYToX:typeof U.scrollYToX<"u"?U.scrollYToX:!1,mouseWheelScrollSensitivity:typeof U.mouseWheelScrollSensitivity<"u"?U.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof U.fastScrollSensitivity<"u"?U.fastScrollSensitivity:5,scrollPredominantAxis:typeof U.scrollPredominantAxis<"u"?U.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof U.mouseWheelSmoothScroll<"u"?U.mouseWheelSmoothScroll:!0,arrowSize:typeof U.arrowSize<"u"?U.arrowSize:11,listenOnDomNode:typeof U.listenOnDomNode<"u"?U.listenOnDomNode:null,horizontal:typeof U.horizontal<"u"?U.horizontal:1,horizontalScrollbarSize:typeof U.horizontalScrollbarSize<"u"?U.horizontalScrollbarSize:10,horizontalSliderSize:typeof U.horizontalSliderSize<"u"?U.horizontalSliderSize:0,horizontalHasArrows:typeof U.horizontalHasArrows<"u"?U.horizontalHasArrows:!1,vertical:typeof U.vertical<"u"?U.vertical:1,verticalScrollbarSize:typeof U.verticalScrollbarSize<"u"?U.verticalScrollbarSize:10,verticalHasArrows:typeof U.verticalHasArrows<"u"?U.verticalHasArrows:!1,verticalSliderSize:typeof U.verticalSliderSize<"u"?U.verticalSliderSize:0,scrollByPage:typeof U.scrollByPage<"u"?U.scrollByPage:!1};return Z.horizontalSliderSize=typeof U.horizontalSliderSize<"u"?U.horizontalSliderSize:Z.horizontalScrollbarSize,Z.verticalSliderSize=typeof U.verticalSliderSize<"u"?U.verticalSliderSize:Z.verticalScrollbarSize,TU&&(Z.className+=" mac"),Z}var hJ=class extends d0{constructor(U,Z,X,Q,K,F,$,q){super();this._bufferService=X,this._optionsService=$,this._renderService=q,this._onRequestScrollLines=this._register(new w0),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let M=this._register(new t2({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:(z)=>tX(Q.window,z)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{M.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new K8(Z,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},M)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(K.onProtocolChange((z)=>{this._scrollableElement.updateOptions({handleMouseWheel:!(z&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(b1.runAndSubscribe(F.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=F.colors.background.css})),U.appendChild(this._scrollableElement.getDomNode()),this._register(U1(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=Q.mainDocument.createElement("style"),Z.appendChild(this._styleElement),this._register(U1(()=>this._styleElement.remove())),this._register(b1.runAndSubscribe(F.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${F.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${F.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${F.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
|
|
377
|
+
`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll((z)=>this._handleScroll(z)))}scrollLines(U){let Z=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:Z.scrollTop+U*this._renderService.dimensions.css.cell.height})}scrollToLine(U,Z){Z&&(this._latestYDisp=U),this._scrollableElement.setScrollPosition({reuseAnimation:!Z,scrollTop:U*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(U){U!==void 0&&(this._latestYDisp=U),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(U=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,U!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:U*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(U){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let Z=Math.round(U.scrollTop/this._renderService.dimensions.css.cell.height),X=Z-this._bufferService.buffer.ydisp;X!==0&&(this._latestYDisp=Z,this._onRequestScrollLines.fire(X)),this._isHandlingScroll=!1}};hJ=$1([c0(2,r1),c0(3,NU),c0(4,QK),c0(5,SZ),c0(6,a1),c0(7,gU)],hJ);var uJ=class extends d0{constructor(U,Z,X,Q,K){super();this._screenElement=U,this._bufferService=Z,this._coreBrowserService=X,this._decorationService=Q,this._renderService=K,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved((F)=>this._removeDecoration(F))),this._register(U1(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let U of this._decorationService.decorations)this._renderDecoration(U);this._dimensionsChanged=!1}_renderDecoration(U){this._refreshStyle(U),this._dimensionsChanged&&this._refreshXPosition(U)}_createElement(U){let Z=this._coreBrowserService.mainDocument.createElement("div");Z.classList.add("xterm-decoration"),Z.classList.toggle("xterm-decoration-top-layer",U?.options?.layer==="top"),Z.style.width=`${Math.round((U.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,Z.style.height=`${(U.options.height||1)*this._renderService.dimensions.css.cell.height}px`,Z.style.top=`${(U.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,Z.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let X=U.options.x??0;return X&&X>this._bufferService.cols&&(Z.style.display="none"),this._refreshXPosition(U,Z),Z}_refreshStyle(U){let Z=U.marker.line-this._bufferService.buffers.active.ydisp;if(Z<0||Z>=this._bufferService.rows)U.element&&(U.element.style.display="none",U.onRenderEmitter.fire(U.element));else{let X=this._decorationElements.get(U);X||(X=this._createElement(U),U.element=X,this._decorationElements.set(U,X),this._container.appendChild(X),U.onDispose(()=>{this._decorationElements.delete(U),X.remove()})),X.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(X.style.width=`${Math.round((U.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,X.style.height=`${(U.options.height||1)*this._renderService.dimensions.css.cell.height}px`,X.style.top=`${Z*this._renderService.dimensions.css.cell.height}px`,X.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),U.onRenderEmitter.fire(X)}}_refreshXPosition(U,Z=U.element){if(!Z)return;let X=U.options.x??0;(U.options.anchor||"left")==="right"?Z.style.right=X?`${X*this._renderService.dimensions.css.cell.width}px`:"":Z.style.left=X?`${X*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(U){this._decorationElements.get(U)?.remove(),this._decorationElements.delete(U),U.dispose()}};uJ=$1([c0(1,r1),c0(2,NU),c0(3,FX),c0(4,gU)],uJ);var I8=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(U){if(U.options.overviewRulerOptions){for(let Z of this._zones)if(Z.color===U.options.overviewRulerOptions.color&&Z.position===U.options.overviewRulerOptions.position){if(this._lineIntersectsZone(Z,U.marker.line))return;if(this._lineAdjacentToZone(Z,U.marker.line,U.options.overviewRulerOptions.position)){this._addLineToZone(Z,U.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=U.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=U.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=U.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=U.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:U.options.overviewRulerOptions.color,position:U.options.overviewRulerOptions.position,startBufferLine:U.marker.line,endBufferLine:U.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(U){this._linePadding=U}_lineIntersectsZone(U,Z){return Z>=U.startBufferLine&&Z<=U.endBufferLine}_lineAdjacentToZone(U,Z,X){return Z>=U.startBufferLine-this._linePadding[X||"full"]&&Z<=U.endBufferLine+this._linePadding[X||"full"]}_addLineToZone(U,Z){U.startBufferLine=Math.min(U.startBufferLine,Z),U.endBufferLine=Math.max(U.endBufferLine,Z)}},qU={full:0,left:0,center:0,right:0},bU={full:0,left:0,center:0,right:0},mZ={full:0,left:0,center:0,right:0},iX=class extends d0{constructor(U,Z,X,Q,K,F,$,q){super();this._viewportElement=U,this._screenElement=Z,this._bufferService=X,this._decorationService=Q,this._renderService=K,this._optionsService=F,this._themeService=$,this._coreBrowserService=q,this._colorZoneStore=new I8,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register(U1(()=>this._canvas?.remove()));let M=this._canvas.getContext("2d");if(M)this._ctx=M;else throw Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let U=Math.floor((this._canvas.width-1)/3),Z=Math.ceil((this._canvas.width-1)/3);bU.full=this._canvas.width,bU.left=U,bU.center=Z,bU.right=U,this._refreshDrawHeightConstants(),mZ.full=1,mZ.left=1,mZ.center=1+bU.left,mZ.right=1+bU.left+bU.center}_refreshDrawHeightConstants(){qU.full=Math.round(2*this._coreBrowserService.dpr);let U=this._canvas.height/this._bufferService.buffer.lines.length,Z=Math.round(Math.max(Math.min(U,12),6)*this._coreBrowserService.dpr);qU.left=Z,qU.center=Z,qU.right=Z}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*qU.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*qU.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*qU.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*qU.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let Z of this._decorationService.decorations)this._colorZoneStore.addDecoration(Z);this._ctx.lineWidth=1,this._renderRulerOutline();let U=this._colorZoneStore.zones;for(let Z of U)Z.position!=="full"&&this._renderColorZone(Z);for(let Z of U)Z.position==="full"&&this._renderColorZone(Z);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(U){this._ctx.fillStyle=U.color,this._ctx.fillRect(mZ[U.position||"full"],Math.round((this._canvas.height-1)*(U.startBufferLine/this._bufferService.buffers.active.lines.length)-qU[U.position||"full"]/2),bU[U.position||"full"],Math.round((this._canvas.height-1)*((U.endBufferLine-U.startBufferLine)/this._bufferService.buffers.active.lines.length)+qU[U.position||"full"]))}_queueRefresh(U,Z){this._shouldUpdateDimensions=U||this._shouldUpdateDimensions,this._shouldUpdateAnchor=Z||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};iX=$1([c0(2,r1),c0(3,FX),c0(4,gU),c0(5,a1),c0(6,SZ),c0(7,NU)],iX);var D0;((U)=>(U.NUL="\x00",U.SOH="\x01",U.STX="\x02",U.ETX="\x03",U.EOT="\x04",U.ENQ="\x05",U.ACK="\x06",U.BEL="\x07",U.BS="\b",U.HT="\t",U.LF=`
|
|
378
|
+
`,U.VT="\v",U.FF="\f",U.CR="\r",U.SO="\x0E",U.SI="\x0F",U.DLE="\x10",U.DC1="\x11",U.DC2="\x12",U.DC3="\x13",U.DC4="\x14",U.NAK="\x15",U.SYN="\x16",U.ETB="\x17",U.CAN="\x18",U.EM="\x19",U.SUB="\x1A",U.ESC="\x1B",U.FS="\x1C",U.GS="\x1D",U.RS="\x1E",U.US="\x1F",U.SP=" ",U.DEL=""))(D0||={});var nX;((U)=>(U.PAD="",U.HOP="",U.BPH="",U.NBH="",U.IND="",U.NEL="
",U.SSA="",U.ESA="",U.HTS="",U.HTJ="",U.VTS="",U.PLD="",U.PLU="",U.RI="",U.SS2="",U.SS3="",U.DCS="",U.PU1="",U.PU2="",U.STS="",U.CCH="",U.MW="",U.SPA="",U.EPA="",U.SOS="",U.SGCI="",U.SCI="",U.CSI="",U.ST="",U.OSC="",U.PM="",U.APC=""))(nX||={});var PK;((U)=>U.ST=`${D0.ESC}\\`)(PK||={});var bJ=class{constructor(U,Z,X,Q,K,F){this._textarea=U,this._compositionView=Z,this._bufferService=X,this._optionsService=Q,this._coreService=K,this._renderService=F,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(U){this._compositionView.textContent=U.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(U){if(this._isComposing||this._isSendingComposition){if(U.keyCode===20||U.keyCode===229||U.keyCode===16||U.keyCode===17||U.keyCode===18)return!1;this._finalizeComposition(!1)}return U.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(U){if(this._compositionView.classList.remove("active"),this._isComposing=!1,U){let Z={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let X;Z.start+=this._dataAlreadySent.length,this._isComposing?X=this._textarea.value.substring(Z.start,this._compositionPosition.start):X=this._textarea.value.substring(Z.start),X.length>0&&this._coreService.triggerDataEvent(X,!0)}},0)}else{this._isSendingComposition=!1;let Z=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(Z,!0)}}_handleAnyTextareaChanges(){let U=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let Z=this._textarea.value,X=Z.replace(U,"");this._dataAlreadySent=X,Z.length>U.length?this._coreService.triggerDataEvent(X,!0):Z.length<U.length?this._coreService.triggerDataEvent(`${D0.DEL}`,!0):Z.length===U.length&&Z!==U&&this._coreService.triggerDataEvent(Z,!0)}},0)}updateCompositionElements(U){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let Z=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),X=this._renderService.dimensions.css.cell.height,Q=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,K=Z*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=K+"px",this._compositionView.style.top=Q+"px",this._compositionView.style.height=X+"px",this._compositionView.style.lineHeight=X+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let F=this._compositionView.getBoundingClientRect();this._textarea.style.left=K+"px",this._textarea.style.top=Q+"px",this._textarea.style.width=Math.max(F.width,1)+"px",this._textarea.style.height=Math.max(F.height,1)+"px",this._textarea.style.lineHeight=F.height+"px"}U||setTimeout(()=>this.updateCompositionElements(!0),0)}}};bJ=$1([c0(2,r1),c0(3,a1),c0(4,KZ),c0(5,gU)],bJ);var w1=0,y1=0,c1=0,V1=0,P$={css:"#00000000",rgba:0},F1;((U)=>{function Z(K,F,$,q){return q!==void 0?`#${XZ(K)}${XZ(F)}${XZ($)}${XZ(q)}`:`#${XZ(K)}${XZ(F)}${XZ($)}`}U.toCss=Z;function X(K,F,$,q=255){return(K<<24|F<<16|$<<8|q)>>>0}U.toRgba=X;function Q(K,F,$,q){return{css:U.toCss(K,F,$,q),rgba:U.toRgba(K,F,$,q)}}U.toColor=Q})(F1||={});var e0;((U)=>{function Z(M,z){if(V1=(z.rgba&255)/255,V1===1)return{css:z.css,rgba:z.rgba};let T=z.rgba>>24&255,A=z.rgba>>16&255,L=z.rgba>>8&255,E=M.rgba>>24&255,S=M.rgba>>16&255,j=M.rgba>>8&255;w1=E+Math.round((T-E)*V1),y1=S+Math.round((A-S)*V1),c1=j+Math.round((L-j)*V1);let k=F1.toCss(w1,y1,c1),B=F1.toRgba(w1,y1,c1);return{css:k,rgba:B}}U.blend=Z;function X(M){return(M.rgba&255)===255}U.isOpaque=X;function Q(M,z,T){let A=mX.ensureContrastRatio(M.rgba,z.rgba,T);if(A)return F1.toColor(A>>24&255,A>>16&255,A>>8&255)}U.ensureContrastRatio=Q;function K(M){let z=(M.rgba|255)>>>0;return[w1,y1,c1]=mX.toChannels(z),{css:F1.toCss(w1,y1,c1),rgba:z}}U.opaque=K;function F(M,z){return V1=Math.round(z*255),[w1,y1,c1]=mX.toChannels(M.rgba),{css:F1.toCss(w1,y1,c1,V1),rgba:F1.toRgba(w1,y1,c1,V1)}}U.opacity=F;function $(M,z){return V1=M.rgba&255,F(M,V1*z/255)}U.multiplyOpacity=$;function q(M){return[M.rgba>>24&255,M.rgba>>16&255,M.rgba>>8&255]}U.toColorRGB=q})(e0||={});var Y1;((U)=>{let Z,X;try{let K=document.createElement("canvas");K.width=1,K.height=1;let F=K.getContext("2d",{willReadFrequently:!0});F&&(Z=F,Z.globalCompositeOperation="copy",X=Z.createLinearGradient(0,0,1,1))}catch{}function Q(K){if(K.match(/#[\da-f]{3,8}/i))switch(K.length){case 4:return w1=parseInt(K.slice(1,2).repeat(2),16),y1=parseInt(K.slice(2,3).repeat(2),16),c1=parseInt(K.slice(3,4).repeat(2),16),F1.toColor(w1,y1,c1);case 5:return w1=parseInt(K.slice(1,2).repeat(2),16),y1=parseInt(K.slice(2,3).repeat(2),16),c1=parseInt(K.slice(3,4).repeat(2),16),V1=parseInt(K.slice(4,5).repeat(2),16),F1.toColor(w1,y1,c1,V1);case 7:return{css:K,rgba:(parseInt(K.slice(1),16)<<8|255)>>>0};case 9:return{css:K,rgba:parseInt(K.slice(1),16)>>>0}}let F=K.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(F)return w1=parseInt(F[1]),y1=parseInt(F[2]),c1=parseInt(F[3]),V1=Math.round((F[5]===void 0?1:parseFloat(F[5]))*255),F1.toColor(w1,y1,c1,V1);if(!Z||!X)throw Error("css.toColor: Unsupported css format");if(Z.fillStyle=X,Z.fillStyle=K,typeof Z.fillStyle!="string")throw Error("css.toColor: Unsupported css format");if(Z.fillRect(0,0,1,1),[w1,y1,c1,V1]=Z.getImageData(0,0,1,1).data,V1!==255)throw Error("css.toColor: Unsupported css format");return{rgba:F1.toRgba(w1,y1,c1,V1),css:K}}U.toColor=Q})(Y1||={});var s1;((U)=>{function Z(Q){return X(Q>>16&255,Q>>8&255,Q&255)}U.relativeLuminance=Z;function X(Q,K,F){let $=Q/255,q=K/255,M=F/255,z=$<=0.03928?$/12.92:Math.pow(($+0.055)/1.055,2.4),T=q<=0.03928?q/12.92:Math.pow((q+0.055)/1.055,2.4),A=M<=0.03928?M/12.92:Math.pow((M+0.055)/1.055,2.4);return z*0.2126+T*0.7152+A*0.0722}U.relativeLuminance2=X})(s1||={});var mX;((U)=>{function Z($,q){if(V1=(q&255)/255,V1===1)return q;let M=q>>24&255,z=q>>16&255,T=q>>8&255,A=$>>24&255,L=$>>16&255,E=$>>8&255;return w1=A+Math.round((M-A)*V1),y1=L+Math.round((z-L)*V1),c1=E+Math.round((T-E)*V1),F1.toRgba(w1,y1,c1)}U.blend=Z;function X($,q,M){let z=s1.relativeLuminance($>>8),T=s1.relativeLuminance(q>>8);if(vU(z,T)<M){if(T<z){let E=Q($,q,M),S=vU(z,s1.relativeLuminance(E>>8));if(S<M){let j=K($,q,M),k=vU(z,s1.relativeLuminance(j>>8));return S>k?E:j}return E}let A=K($,q,M),L=vU(z,s1.relativeLuminance(A>>8));if(L<M){let E=Q($,q,M),S=vU(z,s1.relativeLuminance(E>>8));return L>S?A:E}return A}}U.ensureContrastRatio=X;function Q($,q,M){let z=$>>24&255,T=$>>16&255,A=$>>8&255,L=q>>24&255,E=q>>16&255,S=q>>8&255,j=vU(s1.relativeLuminance2(L,E,S),s1.relativeLuminance2(z,T,A));for(;j<M&&(L>0||E>0||S>0);)L-=Math.max(0,Math.ceil(L*0.1)),E-=Math.max(0,Math.ceil(E*0.1)),S-=Math.max(0,Math.ceil(S*0.1)),j=vU(s1.relativeLuminance2(L,E,S),s1.relativeLuminance2(z,T,A));return(L<<24|E<<16|S<<8|255)>>>0}U.reduceLuminance=Q;function K($,q,M){let z=$>>24&255,T=$>>16&255,A=$>>8&255,L=q>>24&255,E=q>>16&255,S=q>>8&255,j=vU(s1.relativeLuminance2(L,E,S),s1.relativeLuminance2(z,T,A));for(;j<M&&(L<255||E<255||S<255);)L=Math.min(255,L+Math.ceil((255-L)*0.1)),E=Math.min(255,E+Math.ceil((255-E)*0.1)),S=Math.min(255,S+Math.ceil((255-S)*0.1)),j=vU(s1.relativeLuminance2(L,E,S),s1.relativeLuminance2(z,T,A));return(L<<24|E<<16|S<<8|255)>>>0}U.increaseLuminance=K;function F($){return[$>>24&255,$>>16&255,$>>8&255,$&255]}U.toChannels=F})(mX||={});function XZ(U){let Z=U.toString(16);return Z.length<2?"0"+Z:Z}function vU(U,Z){return U<Z?(Z+0.05)/(U+0.05):(U+0.05)/(Z+0.05)}var F8=class extends IX{constructor(U,Z,X){super();this.content=0,this.combinedData="",this.fg=U.fg,this.bg=U.bg,this.combinedData=Z,this._width=X}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(U){throw Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},eX=class{constructor(U){this._bufferService=U,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new HU}register(U){let Z={id:this._nextCharacterJoinerId++,handler:U};return this._characterJoiners.push(Z),Z.id}deregister(U){for(let Z=0;Z<this._characterJoiners.length;Z++)if(this._characterJoiners[Z].id===U)return this._characterJoiners.splice(Z,1),!0;return!1}getJoinedCharacters(U){if(this._characterJoiners.length===0)return[];let Z=this._bufferService.buffer.lines.get(U);if(!Z||Z.length===0)return[];let X=[],Q=Z.translateToString(!0),K=0,F=0,$=0,q=Z.getFg(0),M=Z.getBg(0);for(let z=0;z<Z.getTrimmedLength();z++)if(Z.loadCell(z,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==q||this._workCell.bg!==M){if(z-K>1){let T=this._getJoinedRanges(Q,$,F,Z,K);for(let A=0;A<T.length;A++)X.push(T[A])}K=z,$=F,q=this._workCell.fg,M=this._workCell.bg}F+=this._workCell.getChars().length||oU.length}if(this._bufferService.cols-K>1){let z=this._getJoinedRanges(Q,$,F,Z,K);for(let T=0;T<z.length;T++)X.push(z[T])}return X}_getJoinedRanges(U,Z,X,Q,K){let F=U.substring(Z,X),$=[];try{$=this._characterJoiners[0].handler(F)}catch(q){console.error(q)}for(let q=1;q<this._characterJoiners.length;q++)try{let M=this._characterJoiners[q].handler(F);for(let z=0;z<M.length;z++)eX._mergeRanges($,M[z])}catch(M){console.error(M)}return this._stringRangesToCellRanges($,Q,K),$}_stringRangesToCellRanges(U,Z,X){let Q=0,K=!1,F=0,$=U[Q];if($){for(let q=X;q<this._bufferService.cols;q++){let M=Z.getWidth(q),z=Z.getString(q).length||oU.length;if(M!==0){if(!K&&$[0]<=F&&($[0]=q,K=!0),$[1]<=F){if($[1]=q,$=U[++Q],!$)break;$[0]<=F?($[0]=q,K=!0):K=!1}F+=z}}$&&($[1]=this._bufferService.cols)}}static _mergeRanges(U,Z){let X=!1;for(let Q=0;Q<U.length;Q++){let K=U[Q];if(X){if(Z[1]<=K[0])return U[Q-1][1]=Z[1],U;if(Z[1]<=K[1])return U[Q-1][1]=Math.max(Z[1],K[1]),U.splice(Q,1),U;U.splice(Q,1),Q--}else{if(Z[1]<=K[0])return U.splice(Q,0,Z),U;if(Z[1]<=K[1])return K[0]=Math.min(Z[0],K[0]),U;Z[0]<K[1]&&(K[0]=Math.min(Z[0],K[0]),X=!0);continue}}return X?U[U.length-1][1]=Z[1]:U.push(Z),U}};eX=$1([c0(0,r1)],eX);function H8(U){return 57508<=U&&U<=57558}function O8(U){return 9472<=U&&U<=9631}function C8(U){return H8(U)||O8(U)}function A8(){return{css:{canvas:wX(),cell:wX()},device:{canvas:wX(),cell:wX(),char:{width:0,height:0,left:0,top:0}}}}function wX(){return{width:0,height:0}}var dJ=class{constructor(U,Z,X,Q,K,F,$){this._document=U,this._characterJoinerService=Z,this._optionsService=X,this._coreBrowserService=Q,this._coreService=K,this._decorationService=F,this._themeService=$,this._workCell=new HU,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(U,Z,X){this._selectionStart=U,this._selectionEnd=Z,this._columnSelectMode=X}createRow(U,Z,X,Q,K,F,$,q,M,z,T){let A=[],L=this._characterJoinerService.getJoinedCharacters(Z),E=this._themeService.colors,S=U.getNoBgTrimmedLength();X&&S<F+1&&(S=F+1);let j,k=0,B="",v=0,x=0,N=0,w=0,u=!1,Z0=0,V0=!1,Y0=0,b=0,i=[],Y=z!==-1&&T!==-1;for(let V=0;V<S;V++){U.loadCell(V,this._workCell);let I=this._workCell.getWidth();if(I===0)continue;let G=!1,W=V>=b,C=V,D=this._workCell;if(L.length>0&&V===L[0][0]&&W){let s=L.shift(),f0=this._isCellInSelection(s[0],Z);for(v=s[0]+1;v<s[1];v++)W&&=f0===this._isCellInSelection(v,Z);W&&=!X||F<s[0]||F>=s[1],W?(G=!0,D=new F8(this._workCell,U.translateToString(!0,s[0],s[1]),s[1]-s[0]),C=s[1]-1,I=D.getWidth()):b=s[1]}let H=this._isCellInSelection(V,Z),J=X&&V===F,O=Y&&V>=z&&V<=T,P=!1;this._decorationService.forEachDecorationAtCell(V,Z,void 0,(s)=>{P=!0});let R=D.getChars()||oU;if(R===" "&&(D.isUnderline()||D.isOverline())&&(R=" "),Y0=I*q-M.get(R,D.isBold(),D.isItalic()),!j)j=this._document.createElement("span");else if(k&&(H&&V0||!H&&!V0&&D.bg===x)&&(H&&V0&&E.selectionForeground||D.fg===N)&&D.extended.ext===w&&O===u&&Y0===Z0&&!J&&!G&&!P&&W){D.isInvisible()?B+=oU:B+=R,k++;continue}else k&&(j.textContent=B),j=this._document.createElement("span"),k=0,B="";if(x=D.bg,N=D.fg,w=D.extended.ext,u=O,Z0=Y0,V0=H,G&&F>=V&&F<=C&&(F=V),!this._coreService.isCursorHidden&&J&&this._coreService.isCursorInitialized){if(i.push("xterm-cursor"),this._coreBrowserService.isFocused)$&&i.push("xterm-cursor-blink"),i.push(Q==="bar"?"xterm-cursor-bar":Q==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(K)switch(K){case"outline":i.push("xterm-cursor-outline");break;case"block":i.push("xterm-cursor-block");break;case"bar":i.push("xterm-cursor-bar");break;case"underline":i.push("xterm-cursor-underline");break;default:break}}if(D.isBold()&&i.push("xterm-bold"),D.isItalic()&&i.push("xterm-italic"),D.isDim()&&i.push("xterm-dim"),D.isInvisible()?B=oU:B=D.getChars()||oU,D.isUnderline()&&(i.push(`xterm-underline-${D.extended.underlineStyle}`),B===" "&&(B=" "),!D.isUnderlineColorDefault()))if(D.isUnderlineColorRGB())j.style.textDecorationColor=`rgb(${IX.toColorRGB(D.getUnderlineColor()).join(",")})`;else{let s=D.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&D.isBold()&&s<8&&(s+=8),j.style.textDecorationColor=E.ansi[s].css}D.isOverline()&&(i.push("xterm-overline"),B===" "&&(B=" ")),D.isStrikethrough()&&i.push("xterm-strikethrough"),O&&(j.style.textDecoration="underline");let _=D.getFgColor(),f=D.getFgColorMode(),c=D.getBgColor(),o=D.getBgColorMode(),K0=!!D.isInverse();if(K0){let s=_;_=c,c=s;let f0=f;f=o,o=f0}let a,l,Q0=!1;this._decorationService.forEachDecorationAtCell(V,Z,void 0,(s)=>{s.options.layer!=="top"&&Q0||(s.backgroundColorRGB&&(o=50331648,c=s.backgroundColorRGB.rgba>>8&16777215,a=s.backgroundColorRGB),s.foregroundColorRGB&&(f=50331648,_=s.foregroundColorRGB.rgba>>8&16777215,l=s.foregroundColorRGB),Q0=s.options.layer==="top")}),!Q0&&H&&(a=this._coreBrowserService.isFocused?E.selectionBackgroundOpaque:E.selectionInactiveBackgroundOpaque,c=a.rgba>>8&16777215,o=50331648,Q0=!0,E.selectionForeground&&(f=50331648,_=E.selectionForeground.rgba>>8&16777215,l=E.selectionForeground)),Q0&&i.push("xterm-decoration-top");let n;switch(o){case 16777216:case 33554432:n=E.ansi[c],i.push(`xterm-bg-${c}`);break;case 50331648:n=F1.toColor(c>>16,c>>8&255,c&255),this._addStyle(j,`background-color:#${k$((c>>>0).toString(16),"0",6)}`);break;case 0:default:K0?(n=E.foreground,i.push("xterm-bg-257")):n=E.background}switch(a||D.isDim()&&(a=e0.multiplyOpacity(n,0.5)),f){case 16777216:case 33554432:D.isBold()&&_<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(_+=8),this._applyMinimumContrast(j,n,E.ansi[_],D,a,void 0)||i.push(`xterm-fg-${_}`);break;case 50331648:let s=F1.toColor(_>>16&255,_>>8&255,_&255);this._applyMinimumContrast(j,n,s,D,a,l)||this._addStyle(j,`color:#${k$(_.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(j,n,E.foreground,D,a,l)||K0&&i.push("xterm-fg-257")}i.length&&(j.className=i.join(" "),i.length=0),!J&&!G&&!P&&W?k++:j.textContent=B,Y0!==this.defaultSpacing&&(j.style.letterSpacing=`${Y0}px`),A.push(j),V=C}return j&&k&&(j.textContent=B),A}_applyMinimumContrast(U,Z,X,Q,K,F){if(this._optionsService.rawOptions.minimumContrastRatio===1||C8(Q.getCode()))return!1;let $=this._getContrastCache(Q),q;if(!K&&!F&&(q=$.getColor(Z.rgba,X.rgba)),q===void 0){let M=this._optionsService.rawOptions.minimumContrastRatio/(Q.isDim()?2:1);q=e0.ensureContrastRatio(K||Z,F||X,M),$.setColor((K||Z).rgba,(F||X).rgba,q??null)}return q?(this._addStyle(U,`color:${q.css}`),!0):!1}_getContrastCache(U){return U.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(U,Z){U.setAttribute("style",`${U.getAttribute("style")||""}${Z};`)}_isCellInSelection(U,Z){let X=this._selectionStart,Q=this._selectionEnd;return!X||!Q?!1:this._columnSelectMode?X[0]<=Q[0]?U>=X[0]&&Z>=X[1]&&U<Q[0]&&Z<=Q[1]:U<X[0]&&Z>=X[1]&&U>=Q[0]&&Z<=Q[1]:Z>X[1]&&Z<Q[1]||X[1]===Q[1]&&Z===X[1]&&U>=X[0]&&U<Q[0]||X[1]<Q[1]&&Z===Q[1]&&U<Q[0]||X[1]<Q[1]&&Z===X[1]&&U>=X[0]}};dJ=$1([c0(1,$K),c0(2,a1),c0(3,NU),c0(4,KZ),c0(5,FX),c0(6,SZ)],dJ);function k$(U,Z,X){for(;U.length<X;)U=Z+U;return U}var z8=class{constructor(U,Z){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=U.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let X=U.createElement("span");X.classList.add("xterm-char-measure-element");let Q=U.createElement("span");Q.classList.add("xterm-char-measure-element"),Q.style.fontWeight="bold";let K=U.createElement("span");K.classList.add("xterm-char-measure-element"),K.style.fontStyle="italic";let F=U.createElement("span");F.classList.add("xterm-char-measure-element"),F.style.fontWeight="bold",F.style.fontStyle="italic",this._measureElements=[X,Q,K,F],this._container.appendChild(X),this._container.appendChild(Q),this._container.appendChild(K),this._container.appendChild(F),Z.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(U,Z,X,Q){U===this._font&&Z===this._fontSize&&X===this._weight&&Q===this._weightBold||(this._font=U,this._fontSize=Z,this._weight=X,this._weightBold=Q,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${X}`,this._measureElements[1].style.fontWeight=`${Q}`,this._measureElements[2].style.fontWeight=`${X}`,this._measureElements[3].style.fontWeight=`${Q}`,this.clear())}get(U,Z,X){let Q=0;if(!Z&&!X&&U.length===1&&(Q=U.charCodeAt(0))<256){if(this._flat[Q]!==-9999)return this._flat[Q];let $=this._measure(U,0);return $>0&&(this._flat[Q]=$),$}let K=U;Z&&(K+="B"),X&&(K+="I");let F=this._holey.get(K);if(F===void 0){let $=0;Z&&($|=1),X&&($|=2),F=this._measure(U,$),F>0&&this._holey.set(K,F)}return F}_measure(U,Z){let X=this._measureElements[Z];return X.textContent=U.repeat(32),X.offsetWidth/32}},D8=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(U,Z,X,Q=!1){if(this.selectionStart=Z,this.selectionEnd=X,!Z||!X||Z[0]===X[0]&&Z[1]===X[1]){this.clear();return}let K=U.buffers.active.ydisp,F=Z[1]-K,$=X[1]-K,q=Math.max(F,0),M=Math.min($,U.rows-1);if(q>=U.rows||M<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=Q,this.viewportStartRow=F,this.viewportEndRow=$,this.viewportCappedStartRow=q,this.viewportCappedEndRow=M,this.startCol=Z[0],this.endCol=X[0]}isCellSelected(U,Z,X){return this.hasSelection?(X-=U.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?Z>=this.startCol&&X>=this.viewportCappedStartRow&&Z<this.endCol&&X<=this.viewportCappedEndRow:Z<this.startCol&&X>=this.viewportCappedStartRow&&Z>=this.endCol&&X<=this.viewportCappedEndRow:X>this.viewportStartRow&&X<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&X===this.viewportStartRow&&Z>=this.startCol&&Z<this.endCol||this.viewportStartRow<this.viewportEndRow&&X===this.viewportEndRow&&Z<this.endCol||this.viewportStartRow<this.viewportEndRow&&X===this.viewportStartRow&&Z>=this.startCol):!1}};function q8(){return new D8}var qJ="xterm-dom-renderer-owner-",IU="xterm-rows",yX="xterm-fg-",j$="xterm-bg-",sZ="xterm-focus",cX="xterm-selection",M8=1,lJ=class extends d0{constructor(U,Z,X,Q,K,F,$,q,M,z,T,A,L,E){super();this._terminal=U,this._document=Z,this._element=X,this._screenElement=Q,this._viewportElement=K,this._helperContainer=F,this._linkifier2=$,this._charSizeService=M,this._optionsService=z,this._bufferService=T,this._coreService=A,this._coreBrowserService=L,this._themeService=E,this._terminalClass=M8++,this._rowElements=[],this._selectionRenderModel=q8(),this.onRequestRedraw=this._register(new w0).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(IU),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(cX),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=A8(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors((S)=>this._injectCss(S))),this._injectCss(this._themeService.colors),this._rowFactory=q.createInstance(dJ,document),this._element.classList.add(qJ+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline((S)=>this._handleLinkHover(S))),this._register(this._linkifier2.onHideLinkUnderline((S)=>this._handleLinkLeave(S))),this._register(U1(()=>{this._element.classList.remove(qJ+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new z8(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let U=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*U,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*U),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/U),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/U),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let X of this._rowElements)X.style.width=`${this.dimensions.css.canvas.width}px`,X.style.height=`${this.dimensions.css.cell.height}px`,X.style.lineHeight=`${this.dimensions.css.cell.height}px`,X.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let Z=`${this._terminalSelector} .${IU} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=Z,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(U){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let Z=`${this._terminalSelector} .${IU} { pointer-events: none; color: ${U.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;Z+=`${this._terminalSelector} .${IU} .xterm-dim { color: ${e0.multiplyOpacity(U.foreground,0.5).css};}`,Z+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let X=`blink_underline_${this._terminalClass}`,Q=`blink_bar_${this._terminalClass}`,K=`blink_block_${this._terminalClass}`;Z+=`@keyframes ${X} { 50% { border-bottom-style: hidden; }}`,Z+=`@keyframes ${Q} { 50% { box-shadow: none; }}`,Z+=`@keyframes ${K} { 0% { background-color: ${U.cursor.css}; color: ${U.cursorAccent.css}; } 50% { background-color: inherit; color: ${U.cursor.css}; }}`,Z+=`${this._terminalSelector} .${IU}.${sZ} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${X} 1s step-end infinite;}${this._terminalSelector} .${IU}.${sZ} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${Q} 1s step-end infinite;}${this._terminalSelector} .${IU}.${sZ} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${K} 1s step-end infinite;}${this._terminalSelector} .${IU} .xterm-cursor.xterm-cursor-block { background-color: ${U.cursor.css}; color: ${U.cursorAccent.css};}${this._terminalSelector} .${IU} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${U.cursor.css} !important; color: ${U.cursorAccent.css} !important;}${this._terminalSelector} .${IU} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${U.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${IU} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${U.cursor.css} inset;}${this._terminalSelector} .${IU} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${U.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,Z+=`${this._terminalSelector} .${cX} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${cX} div { position: absolute; background-color: ${U.selectionBackgroundOpaque.css};}${this._terminalSelector} .${cX} div { position: absolute; background-color: ${U.selectionInactiveBackgroundOpaque.css};}`;for(let[F,$]of U.ansi.entries())Z+=`${this._terminalSelector} .${yX}${F} { color: ${$.css}; }${this._terminalSelector} .${yX}${F}.xterm-dim { color: ${e0.multiplyOpacity($,0.5).css}; }${this._terminalSelector} .${j$}${F} { background-color: ${$.css}; }`;Z+=`${this._terminalSelector} .${yX}257 { color: ${e0.opaque(U.background).css}; }${this._terminalSelector} .${yX}257.xterm-dim { color: ${e0.multiplyOpacity(e0.opaque(U.background),0.5).css}; }${this._terminalSelector} .${j$}257 { background-color: ${U.foreground.css}; }`,this._themeStyleElement.textContent=Z}_setDefaultSpacing(){let U=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${U}px`,this._rowFactory.defaultSpacing=U}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(U,Z){for(let X=this._rowElements.length;X<=Z;X++){let Q=this._document.createElement("div");this._rowContainer.appendChild(Q),this._rowElements.push(Q)}for(;this._rowElements.length>Z;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(U,Z){this._refreshRowElements(U,Z),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(sZ),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(sZ),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(U,Z,X){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(U,Z,X),this.renderRows(0,this._bufferService.rows-1),!U||!Z||(this._selectionRenderModel.update(this._terminal,U,Z,X),!this._selectionRenderModel.hasSelection))return;let Q=this._selectionRenderModel.viewportStartRow,K=this._selectionRenderModel.viewportEndRow,F=this._selectionRenderModel.viewportCappedStartRow,$=this._selectionRenderModel.viewportCappedEndRow,q=this._document.createDocumentFragment();if(X){let M=U[0]>Z[0];q.appendChild(this._createSelectionElement(F,M?Z[0]:U[0],M?U[0]:Z[0],$-F+1))}else{let M=Q===F?U[0]:0,z=F===K?Z[0]:this._bufferService.cols;q.appendChild(this._createSelectionElement(F,M,z));let T=$-F-1;if(q.appendChild(this._createSelectionElement(F+1,0,this._bufferService.cols,T)),F!==$){let A=K===$?Z[0]:this._bufferService.cols;q.appendChild(this._createSelectionElement($,0,A))}}this._selectionContainer.appendChild(q)}_createSelectionElement(U,Z,X,Q=1){let K=this._document.createElement("div"),F=Z*this.dimensions.css.cell.width,$=this.dimensions.css.cell.width*(X-Z);return F+$>this.dimensions.css.canvas.width&&($=this.dimensions.css.canvas.width-F),K.style.height=`${Q*this.dimensions.css.cell.height}px`,K.style.top=`${U*this.dimensions.css.cell.height}px`,K.style.left=`${F}px`,K.style.width=`${$}px`,K}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let U of this._rowElements)U.replaceChildren()}renderRows(U,Z){let X=this._bufferService.buffer,Q=X.ybase+X.y,K=Math.min(X.x,this._bufferService.cols-1),F=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,$=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,q=this._optionsService.rawOptions.cursorInactiveStyle;for(let M=U;M<=Z;M++){let z=M+X.ydisp,T=this._rowElements[M],A=X.lines.get(z);if(!T||!A)break;T.replaceChildren(...this._rowFactory.createRow(A,z,z===Q,$,q,K,F,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${qJ}${this._terminalClass}`}_handleLinkHover(U){this._setCellUnderline(U.x1,U.x2,U.y1,U.y2,U.cols,!0)}_handleLinkLeave(U){this._setCellUnderline(U.x1,U.x2,U.y1,U.y2,U.cols,!1)}_setCellUnderline(U,Z,X,Q,K,F){X<0&&(U=0),Q<0&&(Z=0);let $=this._bufferService.rows-1;X=Math.max(Math.min(X,$),0),Q=Math.max(Math.min(Q,$),0),K=Math.min(K,this._bufferService.cols);let q=this._bufferService.buffer,M=q.ybase+q.y,z=Math.min(q.x,K-1),T=this._optionsService.rawOptions.cursorBlink,A=this._optionsService.rawOptions.cursorStyle,L=this._optionsService.rawOptions.cursorInactiveStyle;for(let E=X;E<=Q;++E){let S=E+q.ydisp,j=this._rowElements[E],k=q.lines.get(S);if(!j||!k)break;j.replaceChildren(...this._rowFactory.createRow(k,S,S===M,A,L,z,T,this.dimensions.css.cell.width,this._widthCache,F?E===X?U:0:-1,F?(E===Q?Z:K)-1:-1))}}};lJ=$1([c0(7,YQ),c0(8,JY),c0(9,a1),c0(10,r1),c0(11,KZ),c0(12,NU),c0(13,SZ)],lJ);var oJ=class extends d0{constructor(U,Z,X){super();this._optionsService=X,this.width=0,this.height=0,this._onCharSizeChange=this._register(new w0),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new T8(this._optionsService))}catch{this._measureStrategy=this._register(new L8(U,Z,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let U=this._measureStrategy.measure();(U.width!==this.width||U.height!==this.height)&&(this.width=U.width,this.height=U.height,this._onCharSizeChange.fire())}};oJ=$1([c0(2,a1)],oJ);var kK=class extends d0{constructor(){super(...arguments);this._result={width:0,height:0}}_validateAndSet(U,Z){U!==void 0&&U>0&&Z!==void 0&&Z>0&&(this._result.width=U,this._result.height=Z)}},L8=class extends kK{constructor(U,Z,X){super();this._document=U,this._parentElement=Z,this._optionsService=X,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},T8=class extends kK{constructor(U){super();this._optionsService=U,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let Z=this._ctx.measureText("W");if(!(("width"in Z)&&("fontBoundingBoxAscent"in Z)&&("fontBoundingBoxDescent"in Z)))throw Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let U=this._ctx.measureText("W");return this._validateAndSet(U.width,U.fontBoundingBoxAscent+U.fontBoundingBoxDescent),this._result}},R8=class extends d0{constructor(U,Z,X){super();this._textarea=U,this._window=Z,this.mainDocument=X,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new E8(this._window)),this._onDprChange=this._register(new w0),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new w0),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange((Q)=>this._screenDprMonitor.setWindow(Q))),this._register(b1.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(u0(this._textarea,"focus",()=>this._isFocused=!0)),this._register(u0(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(U){this._window!==U&&(this._window=U,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},E8=class extends d0{constructor(U){super();this._parentWindow=U,this._windowResizeListener=this._register(new EZ),this._onDprChange=this._register(new w0),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(U1(()=>this.clearListener()))}setWindow(U){this._parentWindow=U,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=u0(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},S8=class extends d0{constructor(){super();this.linkProviders=[],this._register(U1(()=>this.linkProviders.length=0))}registerLinkProvider(U){return this.linkProviders.push(U),{dispose:()=>{let Z=this.linkProviders.indexOf(U);Z!==-1&&this.linkProviders.splice(Z,1)}}}};function IQ(U,Z,X){let Q=X.getBoundingClientRect(),K=U.getComputedStyle(X),F=parseInt(K.getPropertyValue("padding-left")),$=parseInt(K.getPropertyValue("padding-top"));return[Z.clientX-Q.left-F,Z.clientY-Q.top-$]}function P8(U,Z,X,Q,K,F,$,q,M){if(!F)return;let z=IQ(U,Z,X);if(z)return z[0]=Math.ceil((z[0]+(M?$/2:0))/$),z[1]=Math.ceil(z[1]/q),z[0]=Math.min(Math.max(z[0],1),Q+(M?1:0)),z[1]=Math.min(Math.max(z[1],1),K),z}var nJ=class{constructor(U,Z){this._renderService=U,this._charSizeService=Z}getCoords(U,Z,X,Q,K){return P8(window,U,Z,X,Q,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,K)}getMouseReportCoords(U,Z){let X=IQ(window,U,Z);if(this._charSizeService.hasValidSize)return X[0]=Math.min(Math.max(X[0],0),this._renderService.dimensions.css.canvas.width-1),X[1]=Math.min(Math.max(X[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(X[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(X[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(X[0]),y:Math.floor(X[1])}}};nJ=$1([c0(0,gU),c0(1,JY)],nJ);var k8=class{constructor(U,Z){this._renderCallback=U,this._coreBrowserService=Z,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(U){return this._refreshCallbacks.push(U),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(U,Z,X){this._rowCount=X,U=U!==void 0?U:0,Z=Z!==void 0?Z:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,U):U,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,Z):Z,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let U=Math.max(this._rowStart,0),Z=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(U,Z),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let U of this._refreshCallbacks)U(0);this._refreshCallbacks=[]}},jK={};WO(jK,{getSafariVersion:()=>v8,isChromeOS:()=>xK,isFirefox:()=>vK,isIpad:()=>_8,isIphone:()=>B8,isLegacyEdge:()=>j8,isLinux:()=>FQ,isMac:()=>UY,isNode:()=>VY,isSafari:()=>_K,isWindows:()=>BK});var VY=typeof process<"u"&&"title"in process,HX=VY?"node":navigator.userAgent,OX=VY?"node":navigator.platform,vK=HX.includes("Firefox"),j8=HX.includes("Edge"),_K=/^((?!chrome|android).)*safari/i.test(HX);function v8(){if(!_K)return 0;let U=HX.match(/Version\/(\d+)/);return U===null||U.length<2?0:parseInt(U[1])}var UY=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(OX),_8=OX==="iPad",B8=OX==="iPhone",BK=["Windows","Win16","Win32","WinCE"].includes(OX),FQ=OX.indexOf("Linux")>=0,xK=/\bCrOS\b/.test(HX),NK=class{constructor(){this._tasks=[],this._i=0}enqueue(U){this._tasks.push(U),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(U){this._idleCallback=void 0;let Z=0,X=0,Q=U.timeRemaining(),K=0;for(;this._i<this._tasks.length;){if(Z=performance.now(),this._tasks[this._i]()||this._i++,Z=Math.max(1,performance.now()-Z),X=Math.max(Z,X),K=U.timeRemaining(),X*1.5>K){Q-Z<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(Q-Z))}ms`),this._start();return}Q=K}this.clear()}},x8=class extends NK{_requestCallback(U){return setTimeout(()=>U(this._createDeadline(16)))}_cancelCallback(U){clearTimeout(U)}_createDeadline(U){let Z=performance.now()+U;return{timeRemaining:()=>Math.max(0,Z-performance.now())}}},N8=class extends NK{_requestCallback(U){return requestIdleCallback(U)}_cancelCallback(U){cancelIdleCallback(U)}},ZY=!VY&&"requestIdleCallback"in window?N8:x8,g8=class{constructor(){this._queue=new ZY}set(U){this._queue.clear(),this._queue.enqueue(U)}flush(){this._queue.flush()}},mJ=class extends d0{constructor(U,Z,X,Q,K,F,$,q,M){super();this._rowCount=U,this._optionsService=X,this._charSizeService=Q,this._coreService=K,this._coreBrowserService=q,this._renderer=this._register(new EZ),this._pausedResizeTask=new g8,this._observerDisposable=this._register(new EZ),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new w0),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new w0),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new w0),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new w0),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new k8((z,T)=>this._renderRows(z,T),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new f8(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(U1(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register($.onResize(()=>this._fullRefresh())),this._register($.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(F.onDecorationRegistered(()=>this._fullRefresh())),this._register(F.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize($.cols,$.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows($.buffer.y,$.buffer.y,!0))),this._register(M.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,Z),this._register(this._coreBrowserService.onWindowChange((z)=>this._registerIntersectionObserver(z,Z)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(U,Z){if("IntersectionObserver"in U){let X=new U.IntersectionObserver((Q)=>this._handleIntersectionChange(Q[Q.length-1]),{threshold:0});X.observe(Z),this._observerDisposable.value=U1(()=>X.disconnect())}}_handleIntersectionChange(U){this._isPaused=U.isIntersecting===void 0?U.intersectionRatio===0:!U.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(U,Z,X=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(U,Z);return}let Q=this._syncOutputHandler.flush();Q&&(U=Math.min(U,Q.start),Z=Math.max(Z,Q.end)),X||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(U,Z,this._rowCount)}_renderRows(U,Z){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(U,Z);return}U=Math.min(U,this._rowCount-1),Z=Math.min(Z,this._rowCount-1),this._renderer.value.renderRows(U,Z),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:U,end:Z}),this._onRender.fire({start:U,end:Z}),this._isNextRenderRedrawOnly=!0}}resize(U,Z){this._rowCount=Z,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(U){this._renderer.value=U,this._renderer.value&&(this._renderer.value.onRequestRedraw((Z)=>this.refreshRows(Z.start,Z.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(U){return this._renderDebouncer.addRefreshCallback(U)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(U,Z){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(U,Z)):this._renderer.value.handleResize(U,Z),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(U,Z,X){this._selectionState.start=U,this._selectionState.end=Z,this._selectionState.columnSelectMode=X,this._renderer.value?.handleSelectionChanged(U,Z,X)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};mJ=$1([c0(2,a1),c0(3,JY),c0(4,KZ),c0(5,FX),c0(6,r1),c0(7,NU),c0(8,SZ)],mJ);var f8=class{constructor(U,Z,X){this._coreBrowserService=U,this._coreService=Z,this._onTimeout=X,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(U,Z){this._isBuffering?(this._start=Math.min(this._start,U),this._end=Math.max(this._end,Z)):(this._start=U,this._end=Z,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1000))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let U={start:this._start,end:this._end};return this._isBuffering=!1,U}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function w8(U,Z,X,Q){let K=X.buffer.x,F=X.buffer.y;if(!X.buffer.hasScrollback)return p8(K,F,U,Z,X,Q)+$Y(F,Z,X,Q)+h8(K,F,U,Z,X,Q);let $;if(F===Z)return $=K>U?"D":"C",KX(Math.abs(K-U),$X($,Q));$=F>Z?"D":"C";let q=Math.abs(F-Z),M=c8(F>Z?U:K,X)+(q-1)*X.cols+1+y8(F>Z?K:U,X);return KX(M,$X($,Q))}function y8(U,Z){return U-1}function c8(U,Z){return Z.cols-U}function p8(U,Z,X,Q,K,F){return $Y(Z,Q,K,F).length===0?"":KX(fK(U,Z,U,Z-$Z(Z,K),!1,K).length,$X("D",F))}function $Y(U,Z,X,Q){let K=U-$Z(U,X),F=Z-$Z(Z,X),$=Math.abs(K-F)-u8(U,Z,X);return KX($,$X(gK(U,Z),Q))}function h8(U,Z,X,Q,K,F){let $;$Y(Z,Q,K,F).length>0?$=Q-$Z(Q,K):$=Z;let q=Q,M=b8(U,Z,X,Q,K,F);return KX(fK(U,$,X,q,M==="C",K).length,$X(M,F))}function u8(U,Z,X){let Q=0,K=U-$Z(U,X),F=Z-$Z(Z,X);for(let $=0;$<Math.abs(K-F);$++){let q=gK(U,Z)==="A"?-1:1;X.buffer.lines.get(K+q*$)?.isWrapped&&Q++}return Q}function $Z(U,Z){let X=0,Q=Z.buffer.lines.get(U),K=Q?.isWrapped;for(;K&&U>=0&&U<Z.rows;)X++,Q=Z.buffer.lines.get(--U),K=Q?.isWrapped;return X}function b8(U,Z,X,Q,K,F){let $;return $Y(X,Q,K,F).length>0?$=Q-$Z(Q,K):$=Z,U<X&&$<=Q||U>=X&&$<Q?"C":"D"}function gK(U,Z){return U>Z?"A":"B"}function fK(U,Z,X,Q,K,F){let $=U,q=Z,M="";for(;($!==X||q!==Q)&&q>=0&&q<F.buffer.lines.length;)$+=K?1:-1,K&&$>F.cols-1?(M+=F.buffer.translateBufferLineToString(q,!1,U,$),$=0,U=0,q++):!K&&$<0&&(M+=F.buffer.translateBufferLineToString(q,!1,0,U+1),$=F.cols-1,U=$,q--);return M+F.buffer.translateBufferLineToString(q,!1,U,$)}function $X(U,Z){let X=Z?"O":"[";return D0.ESC+X+U}function KX(U,Z){U=Math.floor(U);let X="";for(let Q=0;Q<U;Q++)X+=Z;return X}var d8=class{constructor(U){this._bufferService=U,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let U=this.selectionStart[0]+this.selectionStartLength;return U>this._bufferService.cols?U%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(U/this._bufferService.cols)-1]:[U%this._bufferService.cols,this.selectionStart[1]+Math.floor(U/this._bufferService.cols)]:[U,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let U=this.selectionStart[0]+this.selectionStartLength;return U>this._bufferService.cols?[U%this._bufferService.cols,this.selectionStart[1]+Math.floor(U/this._bufferService.cols)]:[Math.max(U,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let U=this.selectionStart,Z=this.selectionEnd;return!U||!Z?!1:U[1]>Z[1]||U[1]===Z[1]&&U[0]>Z[0]}handleTrim(U){return this.selectionStart&&(this.selectionStart[1]-=U),this.selectionEnd&&(this.selectionEnd[1]-=U),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function v$(U,Z){if(U.start.y>U.end.y)throw Error(`Buffer range end (${U.end.x}, ${U.end.y}) cannot be before start (${U.start.x}, ${U.start.y})`);return Z*(U.end.y-U.start.y)+(U.end.x-U.start.x+1)}var MJ=50,l8=15,o8=50,n8=500,m8=" ",s8=new RegExp(m8,"g"),sJ=class extends d0{constructor(U,Z,X,Q,K,F,$,q,M){super();this._element=U,this._screenElement=Z,this._linkifier=X,this._bufferService=Q,this._coreService=K,this._mouseService=F,this._optionsService=$,this._renderService=q,this._coreBrowserService=M,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new HU,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new w0),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new w0),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new w0),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new w0),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=(z)=>this._handleMouseMove(z),this._mouseUpListener=(z)=>this._handleMouseUp(z),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim((z)=>this._handleTrim(z)),this._register(this._bufferService.buffers.onBufferActivate((z)=>this._handleBufferActivate(z))),this.enable(),this._model=new d8(this._bufferService),this._activeSelectionMode=0,this._register(U1(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize((z)=>{z.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let U=this._model.finalSelectionStart,Z=this._model.finalSelectionEnd;return!U||!Z?!1:U[0]!==Z[0]||U[1]!==Z[1]}get selectionText(){let U=this._model.finalSelectionStart,Z=this._model.finalSelectionEnd;if(!U||!Z)return"";let X=this._bufferService.buffer,Q=[];if(this._activeSelectionMode===3){if(U[0]===Z[0])return"";let K=U[0]<Z[0]?U[0]:Z[0],F=U[0]<Z[0]?Z[0]:U[0];for(let $=U[1];$<=Z[1];$++){let q=X.translateBufferLineToString($,!0,K,F);Q.push(q)}}else{let K=U[1]===Z[1]?Z[0]:void 0;Q.push(X.translateBufferLineToString(U[1],!0,U[0],K));for(let F=U[1]+1;F<=Z[1]-1;F++){let $=X.lines.get(F),q=X.translateBufferLineToString(F,!0);$?.isWrapped?Q[Q.length-1]+=q:Q.push(q)}if(U[1]!==Z[1]){let F=X.lines.get(Z[1]),$=X.translateBufferLineToString(Z[1],!0,0,Z[0]);F&&F.isWrapped?Q[Q.length-1]+=$:Q.push($)}}return Q.map((K)=>K.replace(s8," ")).join(BK?`\r
|
|
360
379
|
`:`
|
|
361
|
-
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(U){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),HQ&&U&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(U){let Z=this._getMouseBufferCoords(U),X=this._model.finalSelectionStart,Q=this._model.finalSelectionEnd;return!X||!Q||!Z?!1:this._areCoordsInSelection(Z,X,Q)}isCellInSelection(U,Z){let X=this._model.finalSelectionStart,Q=this._model.finalSelectionEnd;return!X||!Q?!1:this._areCoordsInSelection([U,Z],X,Q)}_areCoordsInSelection(U,Z,X){return U[1]>Z[1]&&U[1]<X[1]||Z[1]===X[1]&&U[1]===Z[1]&&U[0]>=Z[0]&&U[0]<X[0]||Z[1]<X[1]&&U[1]===X[1]&&U[0]<X[0]||Z[1]<X[1]&&U[1]===Z[1]&&U[0]>=Z[0]}_selectWordAtCursor(U,Z){let X=this._linkifier.currentLink?.link?.range;if(X)return this._model.selectionStart=[X.start.x-1,X.start.y-1],this._model.selectionStartLength=v$(X,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let Q=this._getMouseBufferCoords(U);return Q?(this._selectWordAt(Q,Z),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(U,Z){this._model.clearSelection(),U=Math.max(U,0),Z=Math.min(Z,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,U],this._model.selectionEnd=[this._bufferService.cols,Z],this.refresh(),this._onSelectionChange.fire()}_handleTrim(U){this._model.handleTrim(U)&&this.refresh()}_getMouseBufferCoords(U){let Z=this._mouseService.getCoords(U,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(Z)return Z[0]--,Z[1]--,Z[1]+=this._bufferService.buffer.ydisp,Z}_getMouseEventScrollAmount(U){let Z=IQ(this._coreBrowserService.window,U,this._screenElement)[1],X=this._renderService.dimensions.css.canvas.height;return Z>=0&&Z<=X?0:(Z>X&&(Z-=X),Z=Math.min(Math.max(Z,-qJ),qJ),Z/=qJ,Z/Math.abs(Z)+Math.round(Z*(l8-1)))}shouldForceSelection(U){return UY?U.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:U.shiftKey}handleMouseDown(U){if(this._mouseDownTimeStamp=U.timeStamp,!(U.button===2&&this.hasSelection)&&U.button===0){if(!this._enabled){if(!this.shouldForceSelection(U))return;U.stopPropagation()}U.preventDefault(),this._dragScrollAmount=0,this._enabled&&U.shiftKey?this._handleIncrementalClick(U):U.detail===1?this._handleSingleClick(U):U.detail===2?this._handleDoubleClick(U):U.detail===3&&this._handleTripleClick(U),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),o8)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(U){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(U))}_handleSingleClick(U){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(U)?3:0,this._model.selectionStart=this._getMouseBufferCoords(U),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let Z=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);Z&&Z.length!==this._model.selectionStart[0]&&Z.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(U){this._selectWordAtCursor(U,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(U){let Z=this._getMouseBufferCoords(U);Z&&(this._activeSelectionMode=2,this._selectLineAt(Z[1]))}shouldColumnSelect(U){return U.altKey&&!(UY&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(U){if(U.stopImmediatePropagation(),!this._model.selectionStart)return;let Z=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(U),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(U),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let X=this._bufferService.buffer;if(this._model.selectionEnd[1]<X.lines.length){let Q=X.lines.get(this._model.selectionEnd[1]);Q&&Q.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!Z||Z[0]!==this._model.selectionEnd[0]||Z[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let U=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(U.ydisp+this._bufferService.rows,U.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=U.ydisp),this.refresh()}}_handleMouseUp(U){let Z=U.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&Z<n8&&U.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let X=this._mouseService.getCoords(U,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(X&&X[0]!==void 0&&X[1]!==void 0){let Q=w8(X[0]-1,X[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(Q,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let U=this._model.finalSelectionStart,Z=this._model.finalSelectionEnd,X=!!U&&!!Z&&(U[0]!==Z[0]||U[1]!==Z[1]);if(!X){this._oldHasSelection&&this._fireOnSelectionChange(U,Z,X);return}!U||!Z||(!this._oldSelectionStart||!this._oldSelectionEnd||U[0]!==this._oldSelectionStart[0]||U[1]!==this._oldSelectionStart[1]||Z[0]!==this._oldSelectionEnd[0]||Z[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(U,Z,X)}_fireOnSelectionChange(U,Z,X){this._oldSelectionStart=U,this._oldSelectionEnd=Z,this._oldHasSelection=X,this._onSelectionChange.fire()}_handleBufferActivate(U){this.clearSelection(),this._trimListener.dispose(),this._trimListener=U.activeBuffer.lines.onTrim((Z)=>this._handleTrim(Z))}_convertViewportColToCharacterIndex(U,Z){let X=Z;for(let Q=0;Z>=Q;Q++){let K=U.loadCell(Q,this._workCell).getChars().length;this._workCell.getWidth()===0?X--:K>1&&Z!==Q&&(X+=K-1)}return X}setSelection(U,Z,X){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[U,Z],this._model.selectionStartLength=X,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(U){this._isClickInSelection(U)||(this._selectWordAtCursor(U,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(U,Z,X=!0,Q=!0){if(U[0]>=this._bufferService.cols)return;let K=this._bufferService.buffer,H=K.lines.get(U[1]);if(!H)return;let $=K.translateBufferLineToString(U[1],!1),M=this._convertViewportColToCharacterIndex(H,U[0]),q=M,z=U[0]-M,T=0,A=0,L=0,E=0;if($.charAt(M)===" "){for(;M>0&&$.charAt(M-1)===" ";)M--;for(;q<$.length&&$.charAt(q+1)===" ";)q++}else{let k=U[0],B=U[0];H.getWidth(k)===0&&(T++,k--),H.getWidth(B)===2&&(A++,B++);let v=H.getString(B).length;for(v>1&&(E+=v-1,q+=v-1);k>0&&M>0&&!this._isCharWordSeparator(H.loadCell(k-1,this._workCell));){H.loadCell(k-1,this._workCell);let x=this._workCell.getChars().length;this._workCell.getWidth()===0?(T++,k--):x>1&&(L+=x-1,M-=x-1),M--,k--}for(;B<H.length&&q+1<$.length&&!this._isCharWordSeparator(H.loadCell(B+1,this._workCell));){H.loadCell(B+1,this._workCell);let x=this._workCell.getChars().length;this._workCell.getWidth()===2?(A++,B++):x>1&&(E+=x-1,q+=x-1),q++,B++}}q++;let S=M+z-T+L,j=Math.min(this._bufferService.cols,q-M+T+A-L-E);if(!(!Z&&$.slice(M,q).trim()==="")){if(X&&S===0&&H.getCodePoint(0)!==32){let k=K.lines.get(U[1]-1);if(k&&H.isWrapped&&k.getCodePoint(this._bufferService.cols-1)!==32){let B=this._getWordAt([this._bufferService.cols-1,U[1]-1],!1,!0,!1);if(B){let v=this._bufferService.cols-B.start;S-=v,j+=v}}}if(Q&&S+j===this._bufferService.cols&&H.getCodePoint(this._bufferService.cols-1)!==32){let k=K.lines.get(U[1]+1);if(k?.isWrapped&&k.getCodePoint(0)!==32){let B=this._getWordAt([0,U[1]+1],!1,!1,!0);B&&(j+=B.length)}}return{start:S,length:j}}}_selectWordAt(U,Z){let X=this._getWordAt(U,Z);if(X){for(;X.start<0;)X.start+=this._bufferService.cols,U[1]--;this._model.selectionStart=[X.start,U[1]],this._model.selectionStartLength=X.length}}_selectToWordAt(U){let Z=this._getWordAt(U,!0);if(Z){let X=U[1];for(;Z.start<0;)Z.start+=this._bufferService.cols,X--;if(!this._model.areSelectionValuesReversed())for(;Z.start+Z.length>this._bufferService.cols;)Z.length-=this._bufferService.cols,X++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?Z.start:Z.start+Z.length,X]}}_isCharWordSeparator(U){return U.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(U.getChars())>=0}_selectLineAt(U){let Z=this._bufferService.buffer.getWrappedRangeForLine(U),X={start:{x:0,y:Z.first},end:{x:this._bufferService.cols-1,y:Z.last}};this._model.selectionStart=[0,Z.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=v$(X,this._bufferService.cols)}};sJ=$1([c0(3,r1),c0(4,KZ),c0(5,JQ),c0(6,a1),c0(7,gU),c0(8,NU)],sJ);var _$=class{constructor(){this._data={}}set(U,Z,X){this._data[U]||(this._data[U]={}),this._data[U][Z]=X}get(U,Z){return this._data[U]?this._data[U][Z]:void 0}clear(){this._data={}}},B$=class{constructor(){this._color=new _$,this._css=new _$}setCss(U,Z,X){this._css.set(U,Z,X)}getCss(U,Z){return this._css.get(U,Z)}setColor(U,Z,X){this._color.set(U,Z,X)}getColor(U,Z){return this._color.get(U,Z)}clear(){this._color.clear(),this._css.clear()}},k1=Object.freeze((()=>{let U=[Y1.toColor("#2e3436"),Y1.toColor("#cc0000"),Y1.toColor("#4e9a06"),Y1.toColor("#c4a000"),Y1.toColor("#3465a4"),Y1.toColor("#75507b"),Y1.toColor("#06989a"),Y1.toColor("#d3d7cf"),Y1.toColor("#555753"),Y1.toColor("#ef2929"),Y1.toColor("#8ae234"),Y1.toColor("#fce94f"),Y1.toColor("#729fcf"),Y1.toColor("#ad7fa8"),Y1.toColor("#34e2e2"),Y1.toColor("#eeeeec")],Z=[0,95,135,175,215,255];for(let X=0;X<216;X++){let Q=Z[X/36%6|0],K=Z[X/6%6|0],H=Z[X%6];U.push({css:H1.toCss(Q,K,H),rgba:H1.toRgba(Q,K,H)})}for(let X=0;X<24;X++){let Q=8+X*10;U.push({css:H1.toCss(Q,Q,Q),rgba:H1.toRgba(Q,Q,Q)})}return U})()),YZ=Y1.toColor("#ffffff"),ZX=Y1.toColor("#000000"),x$=Y1.toColor("#ffffff"),N$=ZX,rZ={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},r8=YZ,rJ=class extends d0{constructor(U){super();this._optionsService=U,this._contrastCache=new B$,this._halfContrastCache=new B$,this._onChangeColors=this._register(new w0),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:YZ,background:ZX,cursor:x$,cursorAccent:N$,selectionForeground:void 0,selectionBackgroundTransparent:rZ,selectionBackgroundOpaque:e0.blend(ZX,rZ),selectionInactiveBackgroundTransparent:rZ,selectionInactiveBackgroundOpaque:e0.blend(ZX,rZ),scrollbarSliderBackground:e0.opacity(YZ,0.2),scrollbarSliderHoverBackground:e0.opacity(YZ,0.4),scrollbarSliderActiveBackground:e0.opacity(YZ,0.5),overviewRulerBorder:YZ,ansi:k1.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(U={}){let Z=this._colors;if(Z.foreground=a0(U.foreground,YZ),Z.background=a0(U.background,ZX),Z.cursor=e0.blend(Z.background,a0(U.cursor,x$)),Z.cursorAccent=e0.blend(Z.background,a0(U.cursorAccent,N$)),Z.selectionBackgroundTransparent=a0(U.selectionBackground,rZ),Z.selectionBackgroundOpaque=e0.blend(Z.background,Z.selectionBackgroundTransparent),Z.selectionInactiveBackgroundTransparent=a0(U.selectionInactiveBackground,Z.selectionBackgroundTransparent),Z.selectionInactiveBackgroundOpaque=e0.blend(Z.background,Z.selectionInactiveBackgroundTransparent),Z.selectionForeground=U.selectionForeground?a0(U.selectionForeground,P$):void 0,Z.selectionForeground===P$&&(Z.selectionForeground=void 0),e0.isOpaque(Z.selectionBackgroundTransparent)&&(Z.selectionBackgroundTransparent=e0.opacity(Z.selectionBackgroundTransparent,0.3)),e0.isOpaque(Z.selectionInactiveBackgroundTransparent)&&(Z.selectionInactiveBackgroundTransparent=e0.opacity(Z.selectionInactiveBackgroundTransparent,0.3)),Z.scrollbarSliderBackground=a0(U.scrollbarSliderBackground,e0.opacity(Z.foreground,0.2)),Z.scrollbarSliderHoverBackground=a0(U.scrollbarSliderHoverBackground,e0.opacity(Z.foreground,0.4)),Z.scrollbarSliderActiveBackground=a0(U.scrollbarSliderActiveBackground,e0.opacity(Z.foreground,0.5)),Z.overviewRulerBorder=a0(U.overviewRulerBorder,r8),Z.ansi=k1.slice(),Z.ansi[0]=a0(U.black,k1[0]),Z.ansi[1]=a0(U.red,k1[1]),Z.ansi[2]=a0(U.green,k1[2]),Z.ansi[3]=a0(U.yellow,k1[3]),Z.ansi[4]=a0(U.blue,k1[4]),Z.ansi[5]=a0(U.magenta,k1[5]),Z.ansi[6]=a0(U.cyan,k1[6]),Z.ansi[7]=a0(U.white,k1[7]),Z.ansi[8]=a0(U.brightBlack,k1[8]),Z.ansi[9]=a0(U.brightRed,k1[9]),Z.ansi[10]=a0(U.brightGreen,k1[10]),Z.ansi[11]=a0(U.brightYellow,k1[11]),Z.ansi[12]=a0(U.brightBlue,k1[12]),Z.ansi[13]=a0(U.brightMagenta,k1[13]),Z.ansi[14]=a0(U.brightCyan,k1[14]),Z.ansi[15]=a0(U.brightWhite,k1[15]),U.extendedAnsi){let X=Math.min(Z.ansi.length-16,U.extendedAnsi.length);for(let Q=0;Q<X;Q++)Z.ansi[Q+16]=a0(U.extendedAnsi[Q],k1[Q+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(U){this._restoreColor(U),this._onChangeColors.fire(this.colors)}_restoreColor(U){if(U===void 0){for(let Z=0;Z<this._restoreColors.ansi.length;++Z)this._colors.ansi[Z]=this._restoreColors.ansi[Z];return}switch(U){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[U]=this._restoreColors.ansi[U]}}modifyColors(U){U(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};rJ=$1([c0(0,a1)],rJ);function a0(U,Z){if(U!==void 0)try{return Y1.toColor(U)}catch{}return Z}var a8=class{constructor(...U){this._entries=new Map;for(let[Z,X]of U)this.set(Z,X)}set(U,Z){let X=this._entries.get(U);return this._entries.set(U,Z),X}forEach(U){for(let[Z,X]of this._entries.entries())U(Z,X)}has(U){return this._entries.has(U)}get(U){return this._entries.get(U)}},t8=class{constructor(){this._services=new a8,this._services.set(YQ,this)}setService(U,Z){this._services.set(U,Z)}getService(U){return this._services.get(U)}createInstance(U,...Z){let X=zO(U).sort((H,$)=>H.index-$.index),Q=[];for(let H of X){let $=this._services.get(H.id);if(!$)throw Error(`[createInstance] ${U.name} depends on UNKNOWN service ${H.id._id}.`);Q.push($)}let K=X.length>0?X[0].index:Z.length;if(Z.length!==K)throw Error(`[createInstance] First service dependency of ${U.name} at position ${K+1} conflicts with ${Z.length} static arguments`);return new U(...Z,...Q)}},i8={trace:0,debug:1,info:2,warn:3,error:4,off:5},e8="xterm.js: ",aJ=class extends d0{constructor(U){super();this._optionsService=U,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),UC=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=i8[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(U){for(let Z=0;Z<U.length;Z++)typeof U[Z]=="function"&&(U[Z]=U[Z]())}_log(U,Z,X){this._evalLazyOptionalParams(X),U.call(console,(this._optionsService.options.logger?"":e8)+Z,...X)}trace(U,...Z){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,U,Z)}debug(U,...Z){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,U,Z)}info(U,...Z){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,U,Z)}warn(U,...Z){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,U,Z)}error(U,...Z){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,U,Z)}};aJ=$1([c0(0,a1)],aJ);var UC,g$=class extends d0{constructor(U){super();this._maxLength=U,this.onDeleteEmitter=this._register(new w0),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new w0),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new w0),this.onTrim=this.onTrimEmitter.event,this._array=Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(U){if(this._maxLength===U)return;let Z=Array(U);for(let X=0;X<Math.min(U,this.length);X++)Z[X]=this._array[this._getCyclicIndex(X)];this._array=Z,this._maxLength=U,this._startIndex=0}get length(){return this._length}set length(U){if(U>this._length)for(let Z=this._length;Z<U;Z++)this._array[Z]=void 0;this._length=U}get(U){return this._array[this._getCyclicIndex(U)]}set(U,Z){this._array[this._getCyclicIndex(U)]=Z}push(U){this._array[this._getCyclicIndex(this._length)]=U,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(U,Z,...X){if(Z){for(let Q=U;Q<this._length-Z;Q++)this._array[this._getCyclicIndex(Q)]=this._array[this._getCyclicIndex(Q+Z)];this._length-=Z,this.onDeleteEmitter.fire({index:U,amount:Z})}for(let Q=this._length-1;Q>=U;Q--)this._array[this._getCyclicIndex(Q+X.length)]=this._array[this._getCyclicIndex(Q)];for(let Q=0;Q<X.length;Q++)this._array[this._getCyclicIndex(U+Q)]=X[Q];if(X.length&&this.onInsertEmitter.fire({index:U,amount:X.length}),this._length+X.length>this._maxLength){let Q=this._length+X.length-this._maxLength;this._startIndex+=Q,this._length=this._maxLength,this.onTrimEmitter.fire(Q)}else this._length+=X.length}trimStart(U){U>this._length&&(U=this._length),this._startIndex+=U,this._length-=U,this.onTrimEmitter.fire(U)}shiftElements(U,Z,X){if(!(Z<=0)){if(U<0||U>=this._length)throw Error("start argument out of range");if(U+X<0)throw Error("Cannot shift elements in list beyond index 0");if(X>0){for(let K=Z-1;K>=0;K--)this.set(U+K+X,this.get(U+K));let Q=U+Z+X-this._length;if(Q>0)for(this._length+=Q;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let Q=0;Q<Z;Q++)this.set(U+Q+X,this.get(U+Q))}}_getCyclicIndex(U){return(this._startIndex+U)%this._maxLength}},n0=3,I1=Object.freeze(new IX),pX=0,LJ=2,XX=class U{constructor(Z,X,Q=!1){this.isWrapped=Q,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(Z*n0);let K=X||FU.fromCharData([0,JK,1,0]);for(let H=0;H<Z;++H)this.setCell(H,K);this.length=Z}get(Z){let X=this._data[Z*n0+0],Q=X&2097151;return[this._data[Z*n0+1],X&2097152?this._combined[Z]:Q?lU(Q):"",X>>22,X&2097152?this._combined[Z].charCodeAt(this._combined[Z].length-1):Q]}set(Z,X){this._data[Z*n0+1]=X[0],X[1].length>1?(this._combined[Z]=X[1],this._data[Z*n0+0]=Z|2097152|X[2]<<22):this._data[Z*n0+0]=X[1].charCodeAt(0)|X[2]<<22}getWidth(Z){return this._data[Z*n0+0]>>22}hasWidth(Z){return this._data[Z*n0+0]&12582912}getFg(Z){return this._data[Z*n0+1]}getBg(Z){return this._data[Z*n0+2]}hasContent(Z){return this._data[Z*n0+0]&4194303}getCodePoint(Z){let X=this._data[Z*n0+0];return X&2097152?this._combined[Z].charCodeAt(this._combined[Z].length-1):X&2097151}isCombined(Z){return this._data[Z*n0+0]&2097152}getString(Z){let X=this._data[Z*n0+0];return X&2097152?this._combined[Z]:X&2097151?lU(X&2097151):""}isProtected(Z){return this._data[Z*n0+2]&536870912}loadCell(Z,X){return pX=Z*n0,X.content=this._data[pX+0],X.fg=this._data[pX+1],X.bg=this._data[pX+2],X.content&2097152&&(X.combinedData=this._combined[Z]),X.bg&268435456&&(X.extended=this._extendedAttrs[Z]),X}setCell(Z,X){X.content&2097152&&(this._combined[Z]=X.combinedData),X.bg&268435456&&(this._extendedAttrs[Z]=X.extended),this._data[Z*n0+0]=X.content,this._data[Z*n0+1]=X.fg,this._data[Z*n0+2]=X.bg}setCellFromCodepoint(Z,X,Q,K){K.bg&268435456&&(this._extendedAttrs[Z]=K.extended),this._data[Z*n0+0]=X|Q<<22,this._data[Z*n0+1]=K.fg,this._data[Z*n0+2]=K.bg}addCodepointToCell(Z,X,Q){let K=this._data[Z*n0+0];K&2097152?this._combined[Z]+=lU(X):K&2097151?(this._combined[Z]=lU(K&2097151)+lU(X),K&=-2097152,K|=2097152):K=X|4194304,Q&&(K&=-12582913,K|=Q<<22),this._data[Z*n0+0]=K}insertCells(Z,X,Q){if(Z%=this.length,Z&&this.getWidth(Z-1)===2&&this.setCellFromCodepoint(Z-1,0,1,Q),X<this.length-Z){let K=new FU;for(let H=this.length-Z-X-1;H>=0;--H)this.setCell(Z+X+H,this.loadCell(Z+H,K));for(let H=0;H<X;++H)this.setCell(Z+H,Q)}else for(let K=Z;K<this.length;++K)this.setCell(K,Q);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,Q)}deleteCells(Z,X,Q){if(Z%=this.length,X<this.length-Z){let K=new FU;for(let H=0;H<this.length-Z-X;++H)this.setCell(Z+H,this.loadCell(Z+X+H,K));for(let H=this.length-X;H<this.length;++H)this.setCell(H,Q)}else for(let K=Z;K<this.length;++K)this.setCell(K,Q);Z&&this.getWidth(Z-1)===2&&this.setCellFromCodepoint(Z-1,0,1,Q),this.getWidth(Z)===0&&!this.hasContent(Z)&&this.setCellFromCodepoint(Z,0,1,Q)}replaceCells(Z,X,Q,K=!1){if(K){for(Z&&this.getWidth(Z-1)===2&&!this.isProtected(Z-1)&&this.setCellFromCodepoint(Z-1,0,1,Q),X<this.length&&this.getWidth(X-1)===2&&!this.isProtected(X)&&this.setCellFromCodepoint(X,0,1,Q);Z<X&&Z<this.length;)this.isProtected(Z)||this.setCell(Z,Q),Z++;return}for(Z&&this.getWidth(Z-1)===2&&this.setCellFromCodepoint(Z-1,0,1,Q),X<this.length&&this.getWidth(X-1)===2&&this.setCellFromCodepoint(X,0,1,Q);Z<X&&Z<this.length;)this.setCell(Z++,Q)}resize(Z,X){if(Z===this.length)return this._data.length*4*LJ<this._data.buffer.byteLength;let Q=Z*n0;if(Z>this.length){if(this._data.buffer.byteLength>=Q*4)this._data=new Uint32Array(this._data.buffer,0,Q);else{let K=new Uint32Array(Q);K.set(this._data),this._data=K}for(let K=this.length;K<Z;++K)this.setCell(K,X)}else{this._data=this._data.subarray(0,Q);let K=Object.keys(this._combined);for(let $=0;$<K.length;$++){let M=parseInt(K[$],10);M>=Z&&delete this._combined[M]}let H=Object.keys(this._extendedAttrs);for(let $=0;$<H.length;$++){let M=parseInt(H[$],10);M>=Z&&delete this._extendedAttrs[M]}}return this.length=Z,Q*4*LJ<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*LJ<this._data.buffer.byteLength){let Z=new Uint32Array(this._data.length);return Z.set(this._data),this._data=Z,1}return 0}fill(Z,X=!1){if(X){for(let Q=0;Q<this.length;++Q)this.isProtected(Q)||this.setCell(Q,Z);return}this._combined={},this._extendedAttrs={};for(let Q=0;Q<this.length;++Q)this.setCell(Q,Z)}copyFrom(Z){this.length!==Z.length?this._data=new Uint32Array(Z._data):this._data.set(Z._data),this.length=Z.length,this._combined={};for(let X in Z._combined)this._combined[X]=Z._combined[X];this._extendedAttrs={};for(let X in Z._extendedAttrs)this._extendedAttrs[X]=Z._extendedAttrs[X];this.isWrapped=Z.isWrapped}clone(){let Z=new U(0);Z._data=new Uint32Array(this._data),Z.length=this.length;for(let X in this._combined)Z._combined[X]=this._combined[X];for(let X in this._extendedAttrs)Z._extendedAttrs[X]=this._extendedAttrs[X];return Z.isWrapped=this.isWrapped,Z}getTrimmedLength(){for(let Z=this.length-1;Z>=0;--Z)if(this._data[Z*n0+0]&4194303)return Z+(this._data[Z*n0+0]>>22);return 0}getNoBgTrimmedLength(){for(let Z=this.length-1;Z>=0;--Z)if(this._data[Z*n0+0]&4194303||this._data[Z*n0+2]&50331648)return Z+(this._data[Z*n0+0]>>22);return 0}copyCellsFrom(Z,X,Q,K,H){let $=Z._data;if(H)for(let q=K-1;q>=0;q--){for(let z=0;z<n0;z++)this._data[(Q+q)*n0+z]=$[(X+q)*n0+z];$[(X+q)*n0+2]&268435456&&(this._extendedAttrs[Q+q]=Z._extendedAttrs[X+q])}else for(let q=0;q<K;q++){for(let z=0;z<n0;z++)this._data[(Q+q)*n0+z]=$[(X+q)*n0+z];$[(X+q)*n0+2]&268435456&&(this._extendedAttrs[Q+q]=Z._extendedAttrs[X+q])}let M=Object.keys(Z._combined);for(let q=0;q<M.length;q++){let z=parseInt(M[q],10);z>=X&&(this._combined[z-X+Q]=Z._combined[z])}}translateToString(Z,X,Q,K){X=X??0,Q=Q??this.length,Z&&(Q=Math.min(Q,this.getTrimmedLength())),K&&(K.length=0);let H="";for(;X<Q;){let $=this._data[X*n0+0],M=$&2097151,q=$&2097152?this._combined[X]:M?lU(M):oU;if(H+=q,K)for(let z=0;z<q.length;++z)K.push(X);X+=$>>22||1}return K&&K.push(X),H}};function ZC(U,Z,X,Q,K,H){let $=[];for(let M=0;M<U.length-1;M++){let q=M,z=U.get(++q);if(!z.isWrapped)continue;let T=[U.get(M)];for(;q<U.length&&z.isWrapped;)T.push(z),z=U.get(++q);if(!H&&Q>=M&&Q<q){M+=T.length-1;continue}let A=0,L=WX(T,A,Z),E=1,S=0;for(;E<T.length;){let k=WX(T,E,Z),B=k-S,v=X-L,x=Math.min(B,v);T[A].copyCellsFrom(T[E],S,L,x,!1),L+=x,L===X&&(A++,L=0),S+=x,S===k&&(E++,S=0),L===0&&A!==0&&T[A-1].getWidth(X-1)===2&&(T[A].copyCellsFrom(T[A-1],X-1,L++,1,!1),T[A-1].setCell(X-1,K))}T[A].replaceCells(L,X,K);let j=0;for(let k=T.length-1;k>0&&(k>A||T[k].getTrimmedLength()===0);k--)j++;j>0&&($.push(M+T.length-j),$.push(j)),M+=T.length-1}return $}function XC(U,Z){let X=[],Q=0,K=Z[Q],H=0;for(let $=0;$<U.length;$++)if(K===$){let M=Z[++Q];U.onDeleteEmitter.fire({index:$-H,amount:M}),$+=M-1,H+=M,K=Z[++Q]}else X.push($);return{layout:X,countRemoved:H}}function YC(U,Z){let X=[];for(let Q=0;Q<Z.length;Q++)X.push(U.get(Z[Q]));for(let Q=0;Q<X.length;Q++)U.set(Q,X[Q]);U.length=Z.length}function JC(U,Z,X){let Q=[],K=U.map((q,z)=>WX(U,z,Z)).reduce((q,z)=>q+z),H=0,$=0,M=0;for(;M<K;){if(K-M<X){Q.push(K-M);break}H+=X;let q=WX(U,$,Z);H>q&&(H-=q,$++);let z=U[$].getWidth(H-1)===2;z&&H--;let T=z?X-1:X;Q.push(T),M+=T}return Q}function WX(U,Z,X){if(Z===U.length-1)return U[Z].getTrimmedLength();let Q=!U[Z].hasContent(X-1)&&U[Z].getWidth(X-1)===1,K=U[Z+1].getWidth(0)===2;return Q&&K?X-1:X}var wK=class U{constructor(Z){this.line=Z,this.isDisposed=!1,this._disposables=[],this._id=U._nextId++,this._onDispose=this.register(new w0),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),VZ(this._disposables),this._disposables.length=0)}register(Z){return this._disposables.push(Z),Z}};wK._nextId=1;var QC=wK,v1={},JZ=v1.B;v1[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"};v1.A={"#":"£"};v1.B=void 0;v1[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};v1.C=v1[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};v1.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};v1.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};v1.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};v1.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};v1.E=v1[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};v1.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};v1.H=v1[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};v1["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var f$=4294967295,w$=class{constructor(U,Z,X){this._hasScrollback=U,this._optionsService=Z,this._bufferService=X,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=I1.clone(),this.savedCharset=JZ,this.markers=[],this._nullCell=FU.fromCharData([0,JK,1,0]),this._whitespaceCell=FU.fromCharData([0,oU,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new ZY,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new g$(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(U){return U?(this._nullCell.fg=U.fg,this._nullCell.bg=U.bg,this._nullCell.extended=U.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new sX),this._nullCell}getWhitespaceCell(U){return U?(this._whitespaceCell.fg=U.fg,this._whitespaceCell.bg=U.bg,this._whitespaceCell.extended=U.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new sX),this._whitespaceCell}getBlankLine(U,Z){return new XX(this._bufferService.cols,this.getNullCell(U),Z)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let U=this.ybase+this.y-this.ydisp;return U>=0&&U<this._rows}_getCorrectBufferLength(U){if(!this._hasScrollback)return U;let Z=U+this._optionsService.rawOptions.scrollback;return Z>f$?f$:Z}fillViewportRows(U){if(this.lines.length===0){U===void 0&&(U=I1);let Z=this._rows;for(;Z--;)this.lines.push(this.getBlankLine(U))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new g$(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(U,Z){let X=this.getNullCell(I1),Q=0,K=this._getCorrectBufferLength(Z);if(K>this.lines.maxLength&&(this.lines.maxLength=K),this.lines.length>0){if(this._cols<U)for(let $=0;$<this.lines.length;$++)Q+=+this.lines.get($).resize(U,X);let H=0;if(this._rows<Z)for(let $=this._rows;$<Z;$++)this.lines.length<Z+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new XX(U,X)):this.ybase>0&&this.lines.length<=this.ybase+this.y+H+1?(this.ybase--,H++,this.ydisp>0&&this.ydisp--):this.lines.push(new XX(U,X)));else for(let $=this._rows;$>Z;$--)this.lines.length>Z+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(K<this.lines.maxLength){let $=this.lines.length-K;$>0&&(this.lines.trimStart($),this.ybase=Math.max(this.ybase-$,0),this.ydisp=Math.max(this.ydisp-$,0),this.savedY=Math.max(this.savedY-$,0)),this.lines.maxLength=K}this.x=Math.min(this.x,U-1),this.y=Math.min(this.y,Z-1),H&&(this.y+=H),this.savedX=Math.min(this.savedX,U-1),this.scrollTop=0}if(this.scrollBottom=Z-1,this._isReflowEnabled&&(this._reflow(U,Z),this._cols>U))for(let H=0;H<this.lines.length;H++)Q+=+this.lines.get(H).resize(U,X);this._cols=U,this._rows=Z,this._memoryCleanupQueue.clear(),Q>0.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let U=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,U=!1);let Z=0;for(;this._memoryCleanupPosition<this.lines.length;)if(Z+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),Z>100)return!0;return U}get _isReflowEnabled(){let U=this._optionsService.rawOptions.windowsPty;return U&&U.buildNumber?this._hasScrollback&&U.backend==="conpty"&&U.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(U,Z){this._cols!==U&&(U>this._cols?this._reflowLarger(U,Z):this._reflowSmaller(U,Z))}_reflowLarger(U,Z){let X=this._optionsService.rawOptions.reflowCursorLine,Q=ZC(this.lines,this._cols,U,this.ybase+this.y,this.getNullCell(I1),X);if(Q.length>0){let K=XC(this.lines,Q);YC(this.lines,K.layout),this._reflowLargerAdjustViewport(U,Z,K.countRemoved)}}_reflowLargerAdjustViewport(U,Z,X){let Q=this.getNullCell(I1),K=X;for(;K-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<Z&&this.lines.push(new XX(U,Q))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-X,0)}_reflowSmaller(U,Z){let X=this._optionsService.rawOptions.reflowCursorLine,Q=this.getNullCell(I1),K=[],H=0;for(let $=this.lines.length-1;$>=0;$--){let M=this.lines.get($);if(!M||!M.isWrapped&&M.getTrimmedLength()<=U)continue;let q=[M];for(;M.isWrapped&&$>0;)M=this.lines.get(--$),q.unshift(M);if(!X){let x=this.ybase+this.y;if(x>=$&&x<$+q.length)continue}let z=q[q.length-1].getTrimmedLength(),T=JC(q,this._cols,U),A=T.length-q.length,L;this.ybase===0&&this.y!==this.lines.length-1?L=Math.max(0,this.y-this.lines.maxLength+A):L=Math.max(0,this.lines.length-this.lines.maxLength+A);let E=[];for(let x=0;x<A;x++){let N=this.getBlankLine(I1,!0);E.push(N)}E.length>0&&(K.push({start:$+q.length+H,newLines:E}),H+=E.length),q.push(...E);let S=T.length-1,j=T[S];j===0&&(S--,j=T[S]);let k=q.length-A-1,B=z;for(;k>=0;){let x=Math.min(B,j);if(q[S]===void 0)break;if(q[S].copyCellsFrom(q[k],B-x,j-x,x,!0),j-=x,j===0&&(S--,j=T[S]),B-=x,B===0){k--;let N=Math.max(k,0);B=WX(q,N,this._cols)}}for(let x=0;x<q.length;x++)T[x]<U&&q[x].setCell(T[x],Q);let v=A-L;for(;v-- >0;)this.ybase===0?this.y<Z-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+H)-Z&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+A,this.ybase+Z-1)}if(K.length>0){let $=[],M=[];for(let j=0;j<this.lines.length;j++)M.push(this.lines.get(j));let q=this.lines.length,z=q-1,T=0,A=K[T];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+H);let L=0;for(let j=Math.min(this.lines.maxLength-1,q+H-1);j>=0;j--)if(A&&A.start>z+L){for(let k=A.newLines.length-1;k>=0;k--)this.lines.set(j--,A.newLines[k]);j++,$.push({index:z+1,amount:A.newLines.length}),L+=A.newLines.length,A=K[++T]}else this.lines.set(j,M[z--]);let E=0;for(let j=$.length-1;j>=0;j--)$[j].index+=E,this.lines.onInsertEmitter.fire($[j]),E+=$[j].amount;let S=Math.max(0,q+H-this.lines.maxLength);S>0&&this.lines.onTrimEmitter.fire(S)}}translateBufferLineToString(U,Z,X=0,Q){let K=this.lines.get(U);return K?K.translateToString(Z,X,Q):""}getWrappedRangeForLine(U){let Z=U,X=U;for(;Z>0&&this.lines.get(Z).isWrapped;)Z--;for(;X+1<this.lines.length&&this.lines.get(X+1).isWrapped;)X++;return{first:Z,last:X}}setupTabStops(U){for(U!=null?this.tabs[U]||(U=this.prevStop(U)):(this.tabs={},U=0);U<this._cols;U+=this._optionsService.rawOptions.tabStopWidth)this.tabs[U]=!0}prevStop(U){for(U==null&&(U=this.x);!this.tabs[--U]&&U>0;);return U>=this._cols?this._cols-1:U<0?0:U}nextStop(U){for(U==null&&(U=this.x);!this.tabs[++U]&&U<this._cols;);return U>=this._cols?this._cols-1:U<0?0:U}clearMarkers(U){this._isClearing=!0;for(let Z=0;Z<this.markers.length;Z++)this.markers[Z].line===U&&(this.markers[Z].dispose(),this.markers.splice(Z--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let U=0;U<this.markers.length;U++)this.markers[U].dispose();this.markers.length=0,this._isClearing=!1}addMarker(U){let Z=new QC(U);return this.markers.push(Z),Z.register(this.lines.onTrim((X)=>{Z.line-=X,Z.line<0&&Z.dispose()})),Z.register(this.lines.onInsert((X)=>{Z.line>=X.index&&(Z.line+=X.amount)})),Z.register(this.lines.onDelete((X)=>{Z.line>=X.index&&Z.line<X.index+X.amount&&Z.dispose(),Z.line>X.index&&(Z.line-=X.amount)})),Z.register(Z.onDispose(()=>this._removeMarker(Z))),Z}_removeMarker(U){this._isClearing||this.markers.splice(this.markers.indexOf(U),1)}},GC=class extends d0{constructor(U,Z){super();this._optionsService=U,this._bufferService=Z,this._onBufferActivate=this._register(new w0),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new w$(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new w$(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(U){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(U),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(U,Z){this._normal.resize(U,Z),this._alt.resize(U,Z),this.setupTabStops(U)}setupTabStops(U){this._normal.setupTabStops(U),this._alt.setupTabStops(U)}},yK=2,cK=1,tJ=class extends d0{constructor(U){super();this.isUserScrolling=!1,this._onResize=this._register(new w0),this.onResize=this._onResize.event,this._onScroll=this._register(new w0),this.onScroll=this._onScroll.event,this.cols=Math.max(U.rawOptions.cols||0,yK),this.rows=Math.max(U.rawOptions.rows||0,cK),this.buffers=this._register(new GC(U,this)),this._register(this.buffers.onBufferActivate((Z)=>{this._onScroll.fire(Z.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(U,Z){let X=this.cols!==U,Q=this.rows!==Z;this.cols=U,this.rows=Z,this.buffers.resize(U,Z),this._onResize.fire({cols:U,rows:Z,colsChanged:X,rowsChanged:Q})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(U,Z=!1){let X=this.buffer,Q;Q=this._cachedBlankLine,(!Q||Q.length!==this.cols||Q.getFg(0)!==U.fg||Q.getBg(0)!==U.bg)&&(Q=X.getBlankLine(U,Z),this._cachedBlankLine=Q),Q.isWrapped=Z;let K=X.ybase+X.scrollTop,H=X.ybase+X.scrollBottom;if(X.scrollTop===0){let $=X.lines.isFull;H===X.lines.length-1?$?X.lines.recycle().copyFrom(Q):X.lines.push(Q.clone()):X.lines.splice(H+1,0,Q.clone()),$?this.isUserScrolling&&(X.ydisp=Math.max(X.ydisp-1,0)):(X.ybase++,this.isUserScrolling||X.ydisp++)}else{let $=H-K+1;X.lines.shiftElements(K+1,$-1,-1),X.lines.set(H,Q.clone())}this.isUserScrolling||(X.ydisp=X.ybase),this._onScroll.fire(X.ydisp)}scrollLines(U,Z){let X=this.buffer;if(U<0){if(X.ydisp===0)return;this.isUserScrolling=!0}else U+X.ydisp>=X.ybase&&(this.isUserScrolling=!1);let Q=X.ydisp;X.ydisp=Math.max(Math.min(X.ydisp+U,X.ybase),0),Q!==X.ydisp&&(Z||this._onScroll.fire(X.ydisp))}};tJ=$1([c0(0,a1)],tJ);var TZ={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1000,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:UY,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},VC=["normal","bold","100","200","300","400","500","600","700","800","900"],$C=class extends d0{constructor(U){super();this._onOptionChange=this._register(new w0),this.onOptionChange=this._onOptionChange.event;let Z={...TZ};for(let X in U)if(X in Z)try{let Q=U[X];Z[X]=this._sanitizeAndValidateOption(X,Q)}catch(Q){console.error(Q)}this.rawOptions=Z,this.options={...Z},this._setupOptions(),this._register(U1(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(U,Z){return this.onOptionChange((X)=>{X===U&&Z(this.rawOptions[U])})}onMultipleOptionChange(U,Z){return this.onOptionChange((X)=>{U.indexOf(X)!==-1&&Z()})}_setupOptions(){let U=(X)=>{if(!(X in TZ))throw Error(`No option with key "${X}"`);return this.rawOptions[X]},Z=(X,Q)=>{if(!(X in TZ))throw Error(`No option with key "${X}"`);Q=this._sanitizeAndValidateOption(X,Q),this.rawOptions[X]!==Q&&(this.rawOptions[X]=Q,this._onOptionChange.fire(X))};for(let X in this.rawOptions){let Q={get:U.bind(this,X),set:Z.bind(this,X)};Object.defineProperty(this.options,X,Q)}}_sanitizeAndValidateOption(U,Z){switch(U){case"cursorStyle":if(Z||(Z=TZ[U]),!KC(Z))throw Error(`"${Z}" is not a valid value for ${U}`);break;case"wordSeparator":Z||(Z=TZ[U]);break;case"fontWeight":case"fontWeightBold":if(typeof Z=="number"&&1<=Z&&Z<=1000)break;Z=VC.includes(Z)?Z:TZ[U];break;case"cursorWidth":Z=Math.floor(Z);case"lineHeight":case"tabStopWidth":if(Z<1)throw Error(`${U} cannot be less than 1, value: ${Z}`);break;case"minimumContrastRatio":Z=Math.max(1,Math.min(21,Math.round(Z*10)/10));break;case"scrollback":if(Z=Math.min(Z,4294967295),Z<0)throw Error(`${U} cannot be less than 0, value: ${Z}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(Z<=0)throw Error(`${U} cannot be less than or equal to 0, value: ${Z}`);break;case"rows":case"cols":if(!Z&&Z!==0)throw Error(`${U} must be numeric, value: ${Z}`);break;case"windowsPty":Z=Z??{};break}return Z}};function KC(U){return U==="block"||U==="underline"||U==="bar"}function YX(U,Z=5){if(typeof U!="object")return U;let X=Array.isArray(U)?[]:{};for(let Q in U)X[Q]=Z<=1?U[Q]:U[Q]&&YX(U[Q],Z-1);return X}var y$=Object.freeze({insertMode:!1}),c$=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),iJ=class extends d0{constructor(U,Z,X){super();this._bufferService=U,this._logService=Z,this._optionsService=X,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new w0),this.onData=this._onData.event,this._onUserInput=this._register(new w0),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new w0),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new w0),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=YX(y$),this.decPrivateModes=YX(c$)}reset(){this.modes=YX(y$),this.decPrivateModes=YX(c$)}triggerDataEvent(U,Z=!1){if(this._optionsService.rawOptions.disableStdin)return;let X=this._bufferService.buffer;Z&&this._optionsService.rawOptions.scrollOnUserInput&&X.ybase!==X.ydisp&&this._onRequestScrollToBottom.fire(),Z&&this._onUserInput.fire(),this._logService.debug(`sending data "${U}"`),this._logService.trace("sending data (codes)",()=>U.split("").map((Q)=>Q.charCodeAt(0))),this._onData.fire(U)}triggerBinaryEvent(U){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${U}"`),this._logService.trace("sending binary (codes)",()=>U.split("").map((Z)=>Z.charCodeAt(0))),this._onBinary.fire(U))}};iJ=$1([c0(0,r1),c0(1,GK),c0(2,a1)],iJ);var p$={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:(U)=>U.button===4||U.action!==1?!1:(U.ctrl=!1,U.alt=!1,U.shift=!1,!0)},VT200:{events:19,restrict:(U)=>U.action!==32},DRAG:{events:23,restrict:(U)=>!(U.action===32&&U.button===3)},ANY:{events:31,restrict:(U)=>!0}};function TJ(U,Z){let X=(U.ctrl?16:0)|(U.shift?4:0)|(U.alt?8:0);return U.button===4?(X|=64,X|=U.action):(X|=U.button&3,U.button&4&&(X|=64),U.button&8&&(X|=128),U.action===32?X|=32:U.action===0&&!Z&&(X|=3)),X}var RJ=String.fromCharCode,h$={DEFAULT:(U)=>{let Z=[TJ(U,!1)+32,U.col+32,U.row+32];return Z[0]>255||Z[1]>255||Z[2]>255?"":`\x1B[M${RJ(Z[0])}${RJ(Z[1])}${RJ(Z[2])}`},SGR:(U)=>{let Z=U.action===0&&U.button!==4?"m":"M";return`\x1B[<${TJ(U,!0)};${U.col};${U.row}${Z}`},SGR_PIXELS:(U)=>{let Z=U.action===0&&U.button!==4?"m":"M";return`\x1B[<${TJ(U,!0)};${U.x};${U.y}${Z}`}},eJ=class extends d0{constructor(U,Z,X){super();this._bufferService=U,this._coreService=Z,this._optionsService=X,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new w0),this.onProtocolChange=this._onProtocolChange.event;for(let Q of Object.keys(p$))this.addProtocol(Q,p$[Q]);for(let Q of Object.keys(h$))this.addEncoding(Q,h$[Q]);this.reset()}addProtocol(U,Z){this._protocols[U]=Z}addEncoding(U,Z){this._encodings[U]=Z}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(U){if(!this._protocols[U])throw Error(`unknown protocol "${U}"`);this._activeProtocol=U,this._onProtocolChange.fire(this._protocols[U].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(U){if(!this._encodings[U])throw Error(`unknown encoding "${U}"`);this._activeEncoding=U}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(U,Z,X){if(U.deltaY===0||U.shiftKey||Z===void 0||X===void 0)return 0;let Q=Z/X,K=this._applyScrollModifier(U.deltaY,U);return U.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(K/=Q+0,Math.abs(U.deltaY)<50&&(K*=0.3),this._wheelPartialScroll+=K,K=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):U.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(K*=this._bufferService.rows),K}_applyScrollModifier(U,Z){return Z.altKey||Z.ctrlKey||Z.shiftKey?U*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:U*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(U){if(U.col<0||U.col>=this._bufferService.cols||U.row<0||U.row>=this._bufferService.rows||U.button===4&&U.action===32||U.button===3&&U.action!==32||U.button!==4&&(U.action===2||U.action===3)||(U.col++,U.row++,U.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,U,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(U))return!1;let Z=this._encodings[this._activeEncoding](U);return Z&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(Z):this._coreService.triggerDataEvent(Z,!0)),this._lastEvent=U,!0}explainEvents(U){return{down:!!(U&1),up:!!(U&2),drag:!!(U&4),move:!!(U&8),wheel:!!(U&16)}}_equalEvents(U,Z,X){if(X){if(U.x!==Z.x||U.y!==Z.y)return!1}else if(U.col!==Z.col||U.row!==Z.row)return!1;return!(U.button!==Z.button||U.action!==Z.action||U.ctrl!==Z.ctrl||U.alt!==Z.alt||U.shift!==Z.shift)}};eJ=$1([c0(0,r1),c0(1,KZ),c0(2,a1)],eJ);var EJ=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],WC=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],j1;function IC(U,Z){let X=0,Q=Z.length-1,K;if(U<Z[0][0]||U>Z[Q][1])return!1;for(;Q>=X;)if(K=X+Q>>1,U>Z[K][1])X=K+1;else if(U<Z[K][0])Q=K-1;else return!0;return!1}var HC=class{constructor(){if(this.version="6",!j1){j1=new Uint8Array(65536),j1.fill(1),j1[0]=0,j1.fill(0,1,32),j1.fill(0,127,160),j1.fill(2,4352,4448),j1[9001]=2,j1[9002]=2,j1.fill(2,11904,42192),j1[12351]=1,j1.fill(2,44032,55204),j1.fill(2,63744,64256),j1.fill(2,65040,65050),j1.fill(2,65072,65136),j1.fill(2,65280,65377),j1.fill(2,65504,65511);for(let U=0;U<EJ.length;++U)j1.fill(0,EJ[U][0],EJ[U][1]+1)}}wcwidth(U){return U<32?0:U<127?1:U<65536?j1[U]:IC(U,WC)?0:U>=131072&&U<=196605||U>=196608&&U<=262141?2:1}charProperties(U,Z){let X=this.wcwidth(U),Q=X===0&&Z!==0;if(Q){let K=QZ.extractWidth(Z);K===0?Q=!1:K>X&&(X=K)}return QZ.createPropertyValue(0,X,Q)}},QZ=class U{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new w0,this.onChange=this._onChange.event;let Z=new HC;this.register(Z),this._active=Z.version,this._activeProvider=Z}static extractShouldJoin(Z){return(Z&1)!==0}static extractWidth(Z){return Z>>1&3}static extractCharKind(Z){return Z>>3}static createPropertyValue(Z,X,Q=!1){return(Z&16777215)<<3|(X&3)<<1|(Q?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(Z){if(!this._providers[Z])throw Error(`unknown Unicode version "${Z}"`);this._active=Z,this._activeProvider=this._providers[Z],this._onChange.fire(Z)}register(Z){this._providers[Z.version]=Z}wcwidth(Z){return this._activeProvider.wcwidth(Z)}getStringCellWidth(Z){let X=0,Q=0,K=Z.length;for(let H=0;H<K;++H){let $=Z.charCodeAt(H);if(55296<=$&&$<=56319){if(++H>=K)return X+this.wcwidth($);let z=Z.charCodeAt(H);56320<=z&&z<=57343?$=($-55296)*1024+z-56320+65536:X+=this.wcwidth(z)}let M=this.charProperties($,Q),q=U.extractWidth(M);U.extractShouldJoin(M)&&(q-=U.extractWidth(Q)),X+=q,Q=M}return X}charProperties(Z,X){return this._activeProvider.charProperties(Z,X)}},FC=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(U){this.glevel=U,this.charset=this._charsets[U]}setgCharset(U,Z){this._charsets[U]=Z,this.glevel===U&&(this.charset=Z)}};function u$(U){let Z=U.buffer.lines.get(U.buffer.ybase+U.buffer.y-1)?.get(U.cols-1),X=U.buffer.lines.get(U.buffer.ybase+U.buffer.y);X&&Z&&(X.isWrapped=Z[3]!==0&&Z[3]!==32)}var aZ=2147483647,OC=256,pK=class U{constructor(Z=32,X=32){if(this.maxLength=Z,this.maxSubParamsLength=X,X>OC)throw Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(Z),this.length=0,this._subParams=new Int32Array(X),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(Z),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(Z){let X=new U;if(!Z.length)return X;for(let Q=Array.isArray(Z[0])?1:0;Q<Z.length;++Q){let K=Z[Q];if(Array.isArray(K))for(let H=0;H<K.length;++H)X.addSubParam(K[H]);else X.addParam(K)}return X}clone(){let Z=new U(this.maxLength,this.maxSubParamsLength);return Z.params.set(this.params),Z.length=this.length,Z._subParams.set(this._subParams),Z._subParamsLength=this._subParamsLength,Z._subParamsIdx.set(this._subParamsIdx),Z._rejectDigits=this._rejectDigits,Z._rejectSubDigits=this._rejectSubDigits,Z._digitIsSub=this._digitIsSub,Z}toArray(){let Z=[];for(let X=0;X<this.length;++X){Z.push(this.params[X]);let Q=this._subParamsIdx[X]>>8,K=this._subParamsIdx[X]&255;K-Q>0&&Z.push(Array.prototype.slice.call(this._subParams,Q,K))}return Z}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(Z){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(Z<-1)throw Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=Z>aZ?aZ:Z}addSubParam(Z){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(Z<-1)throw Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=Z>aZ?aZ:Z,this._subParamsIdx[this.length-1]++}}hasSubParams(Z){return(this._subParamsIdx[Z]&255)-(this._subParamsIdx[Z]>>8)>0}getSubParams(Z){let X=this._subParamsIdx[Z]>>8,Q=this._subParamsIdx[Z]&255;return Q-X>0?this._subParams.subarray(X,Q):null}getSubParamsAll(){let Z={};for(let X=0;X<this.length;++X){let Q=this._subParamsIdx[X]>>8,K=this._subParamsIdx[X]&255;K-Q>0&&(Z[X]=this._subParams.slice(Q,K))}return Z}addDigit(Z){let X;if(this._rejectDigits||!(X=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let Q=this._digitIsSub?this._subParams:this.params,K=Q[X-1];Q[X-1]=~K?Math.min(K*10+Z,aZ):Z}},tZ=[],CC=class{constructor(){this._state=0,this._active=tZ,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(U,Z){this._handlers[U]===void 0&&(this._handlers[U]=[]);let X=this._handlers[U];return X.push(Z),{dispose:()=>{let Q=X.indexOf(Z);Q!==-1&&X.splice(Q,1)}}}clearHandler(U){this._handlers[U]&&delete this._handlers[U]}setHandlerFallback(U){this._handlerFb=U}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=tZ}reset(){if(this._state===2)for(let U=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;U>=0;--U)this._active[U].end(!1);this._stack.paused=!1,this._active=tZ,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||tZ,!this._active.length)this._handlerFb(this._id,"START");else for(let U=this._active.length-1;U>=0;U--)this._active[U].start()}_put(U,Z,X){if(!this._active.length)this._handlerFb(this._id,"PUT",YY(U,Z,X));else for(let Q=this._active.length-1;Q>=0;Q--)this._active[Q].put(U,Z,X)}start(){this.reset(),this._state=1}put(U,Z,X){if(this._state!==3){if(this._state===1)for(;Z<X;){let Q=U[Z++];if(Q===59){this._state=2,this._start();break}if(Q<48||57<Q){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+Q-48}this._state===2&&X-Z>0&&this._put(U,Z,X)}}end(U,Z=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",U);else{let X=!1,Q=this._active.length-1,K=!1;if(this._stack.paused&&(Q=this._stack.loopPosition-1,X=Z,K=this._stack.fallThrough,this._stack.paused=!1),!K&&X===!1){for(;Q>=0&&(X=this._active[Q].end(U),X!==!0);Q--)if(X instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=Q,this._stack.fallThrough=!1,X;Q--}for(;Q>=0;Q--)if(X=this._active[Q].end(!1),X instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=Q,this._stack.fallThrough=!0,X}this._active=tZ,this._id=-1,this._state=0}}},GU=class{constructor(U){this._handler=U,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(U,Z,X){this._hitLimit||(this._data+=YY(U,Z,X),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(U){let Z=!1;if(this._hitLimit)Z=!1;else if(U&&(Z=this._handler(this._data),Z instanceof Promise))return Z.then((X)=>(this._data="",this._hitLimit=!1,X));return this._data="",this._hitLimit=!1,Z}},iZ=[],AC=class{constructor(){this._handlers=Object.create(null),this._active=iZ,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=iZ}registerHandler(U,Z){this._handlers[U]===void 0&&(this._handlers[U]=[]);let X=this._handlers[U];return X.push(Z),{dispose:()=>{let Q=X.indexOf(Z);Q!==-1&&X.splice(Q,1)}}}clearHandler(U){this._handlers[U]&&delete this._handlers[U]}setHandlerFallback(U){this._handlerFb=U}reset(){if(this._active.length)for(let U=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;U>=0;--U)this._active[U].unhook(!1);this._stack.paused=!1,this._active=iZ,this._ident=0}hook(U,Z){if(this.reset(),this._ident=U,this._active=this._handlers[U]||iZ,!this._active.length)this._handlerFb(this._ident,"HOOK",Z);else for(let X=this._active.length-1;X>=0;X--)this._active[X].hook(Z)}put(U,Z,X){if(!this._active.length)this._handlerFb(this._ident,"PUT",YY(U,Z,X));else for(let Q=this._active.length-1;Q>=0;Q--)this._active[Q].put(U,Z,X)}unhook(U,Z=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",U);else{let X=!1,Q=this._active.length-1,K=!1;if(this._stack.paused&&(Q=this._stack.loopPosition-1,X=Z,K=this._stack.fallThrough,this._stack.paused=!1),!K&&X===!1){for(;Q>=0&&(X=this._active[Q].unhook(U),X!==!0);Q--)if(X instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=Q,this._stack.fallThrough=!1,X;Q--}for(;Q>=0;Q--)if(X=this._active[Q].unhook(!1),X instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=Q,this._stack.fallThrough=!0,X}this._active=iZ,this._ident=0}},JX=new pK;JX.addParam(0);var b$=class{constructor(U){this._handler=U,this._data="",this._params=JX,this._hitLimit=!1}hook(U){this._params=U.length>1||U.params[0]?U.clone():JX,this._data="",this._hitLimit=!1}put(U,Z,X){this._hitLimit||(this._data+=YY(U,Z,X),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(U){let Z=!1;if(this._hitLimit)Z=!1;else if(U&&(Z=this._handler(this._data,this._params),Z instanceof Promise))return Z.then((X)=>(this._params=JX,this._data="",this._hitLimit=!1,X));return this._params=JX,this._data="",this._hitLimit=!1,Z}},zC=class{constructor(U){this.table=new Uint8Array(U)}setDefault(U,Z){this.table.fill(U<<4|Z)}add(U,Z,X,Q){this.table[Z<<8|U]=X<<4|Q}addMany(U,Z,X,Q){for(let K=0;K<U.length;K++)this.table[Z<<8|U[K]]=X<<4|Q}},HU=160,DC=function(){let U=new zC(4095),Z=Array.apply(null,Array(256)).map((M,q)=>q),X=(M,q)=>Z.slice(M,q),Q=X(32,127),K=X(0,24);K.push(25),K.push.apply(K,X(28,32));let H=X(0,14),$;U.setDefault(1,0),U.addMany(Q,0,2,0);for($ in H)U.addMany([24,26,153,154],$,3,0),U.addMany(X(128,144),$,3,0),U.addMany(X(144,152),$,3,0),U.add(156,$,0,0),U.add(27,$,11,1),U.add(157,$,4,8),U.addMany([152,158,159],$,0,7),U.add(155,$,11,3),U.add(144,$,11,9);return U.addMany(K,0,3,0),U.addMany(K,1,3,1),U.add(127,1,0,1),U.addMany(K,8,0,8),U.addMany(K,3,3,3),U.add(127,3,0,3),U.addMany(K,4,3,4),U.add(127,4,0,4),U.addMany(K,6,3,6),U.addMany(K,5,3,5),U.add(127,5,0,5),U.addMany(K,2,3,2),U.add(127,2,0,2),U.add(93,1,4,8),U.addMany(Q,8,5,8),U.add(127,8,5,8),U.addMany([156,27,24,26,7],8,6,0),U.addMany(X(28,32),8,0,8),U.addMany([88,94,95],1,0,7),U.addMany(Q,7,0,7),U.addMany(K,7,0,7),U.add(156,7,0,0),U.add(127,7,0,7),U.add(91,1,11,3),U.addMany(X(64,127),3,7,0),U.addMany(X(48,60),3,8,4),U.addMany([60,61,62,63],3,9,4),U.addMany(X(48,60),4,8,4),U.addMany(X(64,127),4,7,0),U.addMany([60,61,62,63],4,0,6),U.addMany(X(32,64),6,0,6),U.add(127,6,0,6),U.addMany(X(64,127),6,0,0),U.addMany(X(32,48),3,9,5),U.addMany(X(32,48),5,9,5),U.addMany(X(48,64),5,0,6),U.addMany(X(64,127),5,7,0),U.addMany(X(32,48),4,9,5),U.addMany(X(32,48),1,9,2),U.addMany(X(32,48),2,9,2),U.addMany(X(48,127),2,10,0),U.addMany(X(48,80),1,10,0),U.addMany(X(81,88),1,10,0),U.addMany([89,90,92],1,10,0),U.addMany(X(96,127),1,10,0),U.add(80,1,11,9),U.addMany(K,9,0,9),U.add(127,9,0,9),U.addMany(X(28,32),9,0,9),U.addMany(X(32,48),9,9,12),U.addMany(X(48,60),9,8,10),U.addMany([60,61,62,63],9,9,10),U.addMany(K,11,0,11),U.addMany(X(32,128),11,0,11),U.addMany(X(28,32),11,0,11),U.addMany(K,10,0,10),U.add(127,10,0,10),U.addMany(X(28,32),10,0,10),U.addMany(X(48,60),10,8,10),U.addMany([60,61,62,63],10,0,11),U.addMany(X(32,48),10,9,12),U.addMany(K,12,0,12),U.add(127,12,0,12),U.addMany(X(28,32),12,0,12),U.addMany(X(32,48),12,9,12),U.addMany(X(48,64),12,0,11),U.addMany(X(64,127),12,12,13),U.addMany(X(64,127),10,12,13),U.addMany(X(64,127),9,12,13),U.addMany(K,13,13,13),U.addMany(Q,13,13,13),U.add(127,13,0,13),U.addMany([27,156,24,26],13,14,0),U.add(HU,0,2,0),U.add(HU,8,5,8),U.add(HU,6,0,6),U.add(HU,11,0,11),U.add(HU,13,13,13),U}(),MC=class extends d0{constructor(U=DC){super();this._transitions=U,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new pK,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(Z,X,Q)=>{},this._executeHandlerFb=(Z)=>{},this._csiHandlerFb=(Z,X)=>{},this._escHandlerFb=(Z)=>{},this._errorHandlerFb=(Z)=>Z,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(U1(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new CC),this._dcsParser=this._register(new AC),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(U,Z=[64,126]){let X=0;if(U.prefix){if(U.prefix.length>1)throw Error("only one byte as prefix supported");if(X=U.prefix.charCodeAt(0),X&&60>X||X>63)throw Error("prefix must be in range 0x3c .. 0x3f")}if(U.intermediates){if(U.intermediates.length>2)throw Error("only two bytes as intermediates are supported");for(let K=0;K<U.intermediates.length;++K){let H=U.intermediates.charCodeAt(K);if(32>H||H>47)throw Error("intermediate must be in range 0x20 .. 0x2f");X<<=8,X|=H}}if(U.final.length!==1)throw Error("final must be a single byte");let Q=U.final.charCodeAt(0);if(Z[0]>Q||Q>Z[1])throw Error(`final must be in range ${Z[0]} .. ${Z[1]}`);return X<<=8,X|=Q,X}identToString(U){let Z=[];for(;U;)Z.push(String.fromCharCode(U&255)),U>>=8;return Z.reverse().join("")}setPrintHandler(U){this._printHandler=U}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(U,Z){let X=this._identifier(U,[48,126]);this._escHandlers[X]===void 0&&(this._escHandlers[X]=[]);let Q=this._escHandlers[X];return Q.push(Z),{dispose:()=>{let K=Q.indexOf(Z);K!==-1&&Q.splice(K,1)}}}clearEscHandler(U){this._escHandlers[this._identifier(U,[48,126])]&&delete this._escHandlers[this._identifier(U,[48,126])]}setEscHandlerFallback(U){this._escHandlerFb=U}setExecuteHandler(U,Z){this._executeHandlers[U.charCodeAt(0)]=Z}clearExecuteHandler(U){this._executeHandlers[U.charCodeAt(0)]&&delete this._executeHandlers[U.charCodeAt(0)]}setExecuteHandlerFallback(U){this._executeHandlerFb=U}registerCsiHandler(U,Z){let X=this._identifier(U);this._csiHandlers[X]===void 0&&(this._csiHandlers[X]=[]);let Q=this._csiHandlers[X];return Q.push(Z),{dispose:()=>{let K=Q.indexOf(Z);K!==-1&&Q.splice(K,1)}}}clearCsiHandler(U){this._csiHandlers[this._identifier(U)]&&delete this._csiHandlers[this._identifier(U)]}setCsiHandlerFallback(U){this._csiHandlerFb=U}registerDcsHandler(U,Z){return this._dcsParser.registerHandler(this._identifier(U),Z)}clearDcsHandler(U){this._dcsParser.clearHandler(this._identifier(U))}setDcsHandlerFallback(U){this._dcsParser.setHandlerFallback(U)}registerOscHandler(U,Z){return this._oscParser.registerHandler(U,Z)}clearOscHandler(U){this._oscParser.clearHandler(U)}setOscHandlerFallback(U){this._oscParser.setHandlerFallback(U)}setErrorHandler(U){this._errorHandler=U}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(U,Z,X,Q,K){this._parseStack.state=U,this._parseStack.handlers=Z,this._parseStack.handlerPos=X,this._parseStack.transition=Q,this._parseStack.chunkPos=K}parse(U,Z,X){let Q=0,K=0,H=0,$;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,H=this._parseStack.chunkPos+1;else{if(X===void 0||this._parseStack.state===1)throw this._parseStack.state=1,Error("improper continuation due to previous async handler, giving up parsing");let M=this._parseStack.handlers,q=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(X===!1&&q>-1){for(;q>=0&&($=M[q](this._params),$!==!0);q--)if($ instanceof Promise)return this._parseStack.handlerPos=q,$}this._parseStack.handlers=[];break;case 4:if(X===!1&&q>-1){for(;q>=0&&($=M[q](),$!==!0);q--)if($ instanceof Promise)return this._parseStack.handlerPos=q,$}this._parseStack.handlers=[];break;case 6:if(Q=U[this._parseStack.chunkPos],$=this._dcsParser.unhook(Q!==24&&Q!==26,X),$)return $;Q===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(Q=U[this._parseStack.chunkPos],$=this._oscParser.end(Q!==24&&Q!==26,X),$)return $;Q===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,H=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let M=H;M<Z;++M){switch(Q=U[M],K=this._transitions.table[this.currentState<<8|(Q<160?Q:HU)],K>>4){case 2:for(let L=M+1;;++L){if(L>=Z||(Q=U[L])<32||Q>126&&Q<HU){this._printHandler(U,M,L),M=L-1;break}if(++L>=Z||(Q=U[L])<32||Q>126&&Q<HU){this._printHandler(U,M,L),M=L-1;break}if(++L>=Z||(Q=U[L])<32||Q>126&&Q<HU){this._printHandler(U,M,L),M=L-1;break}if(++L>=Z||(Q=U[L])<32||Q>126&&Q<HU){this._printHandler(U,M,L),M=L-1;break}}break;case 3:this._executeHandlers[Q]?this._executeHandlers[Q]():this._executeHandlerFb(Q),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:M,code:Q,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let q=this._csiHandlers[this._collect<<8|Q],z=q?q.length-1:-1;for(;z>=0&&($=q[z](this._params),$!==!0);z--)if($ instanceof Promise)return this._preserveStack(3,q,z,K,M),$;z<0&&this._csiHandlerFb(this._collect<<8|Q,this._params),this.precedingJoinState=0;break;case 8:do switch(Q){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(Q-48)}while(++M<Z&&(Q=U[M])>47&&Q<60);M--;break;case 9:this._collect<<=8,this._collect|=Q;break;case 10:let T=this._escHandlers[this._collect<<8|Q],A=T?T.length-1:-1;for(;A>=0&&($=T[A](),$!==!0);A--)if($ instanceof Promise)return this._preserveStack(4,T,A,K,M),$;A<0&&this._escHandlerFb(this._collect<<8|Q),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|Q,this._params);break;case 13:for(let L=M+1;;++L)if(L>=Z||(Q=U[L])===24||Q===26||Q===27||Q>127&&Q<HU){this._dcsParser.put(U,M,L),M=L-1;break}break;case 14:if($=this._dcsParser.unhook(Q!==24&&Q!==26),$)return this._preserveStack(6,[],0,K,M),$;Q===27&&(K|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let L=M+1;;L++)if(L>=Z||(Q=U[L])<32||Q>127&&Q<HU){this._oscParser.put(U,M,L),M=L-1;break}break;case 6:if($=this._oscParser.end(Q!==24&&Q!==26),$)return this._preserveStack(5,[],0,K,M),$;Q===27&&(K|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=K&15}}},qC=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,LC=/^[\da-f]+$/;function d$(U){if(!U)return;let Z=U.toLowerCase();if(Z.indexOf("rgb:")===0){Z=Z.slice(4);let X=qC.exec(Z);if(X){let Q=X[1]?15:X[4]?255:X[7]?4095:65535;return[Math.round(parseInt(X[1]||X[4]||X[7]||X[10],16)/Q*255),Math.round(parseInt(X[2]||X[5]||X[8]||X[11],16)/Q*255),Math.round(parseInt(X[3]||X[6]||X[9]||X[12],16)/Q*255)]}}else if(Z.indexOf("#")===0&&(Z=Z.slice(1),LC.exec(Z)&&[3,6,9,12].includes(Z.length))){let X=Z.length/3,Q=[0,0,0];for(let K=0;K<3;++K){let H=parseInt(Z.slice(X*K,X*K+X),16);Q[K]=X===1?H<<4:X===2?H:X===3?H>>4:H>>8}return Q}}function SJ(U,Z){let X=U.toString(16),Q=X.length<2?"0"+X:X;switch(Z){case 4:return X[0];case 8:return Q;case 12:return(Q+Q).slice(0,3);default:return Q+Q}}function TC(U,Z=16){let[X,Q,K]=U;return`rgb:${SJ(X,Z)}/${SJ(Q,Z)}/${SJ(K,Z)}`}var RC={"(":0,")":1,"*":2,"+":3,"-":1,".":2},dU=131072,l$=10;function o$(U,Z){if(U>24)return Z.setWinLines||!1;switch(U){case 1:return!!Z.restoreWin;case 2:return!!Z.minimizeWin;case 3:return!!Z.setWinPosition;case 4:return!!Z.setWinSizePixels;case 5:return!!Z.raiseWin;case 6:return!!Z.lowerWin;case 7:return!!Z.refreshWin;case 8:return!!Z.setWinSizeChars;case 9:return!!Z.maximizeWin;case 10:return!!Z.fullscreenWin;case 11:return!!Z.getWinState;case 13:return!!Z.getWinPosition;case 14:return!!Z.getWinSizePixels;case 15:return!!Z.getScreenSizePixels;case 16:return!!Z.getCellSizePixels;case 18:return!!Z.getWinSizeChars;case 19:return!!Z.getScreenSizeChars;case 20:return!!Z.getIconTitle;case 21:return!!Z.getWinTitle;case 22:return!!Z.pushTitle;case 23:return!!Z.popTitle;case 24:return!!Z.setWinLines}return!1}var n$=5000,m$=0,EC=class extends d0{constructor(U,Z,X,Q,K,H,$,M,q=new MC){super();this._bufferService=U,this._charsetService=Z,this._coreService=X,this._logService=Q,this._optionsService=K,this._oscLinkService=H,this._coreMouseService=$,this._unicodeService=M,this._parser=q,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new CO,this._utf8Decoder=new AO,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=I1.clone(),this._eraseAttrDataInternal=I1.clone(),this._onRequestBell=this._register(new w0),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new w0),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new w0),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new w0),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new w0),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new w0),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new w0),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new w0),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new w0),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new w0),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new w0),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new w0),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new w0),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new UQ(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate((z)=>this._activeBuffer=z.activeBuffer)),this._parser.setCsiHandlerFallback((z,T)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(z),params:T.toArray()})}),this._parser.setEscHandlerFallback((z)=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(z)})}),this._parser.setExecuteHandlerFallback((z)=>{this._logService.debug("Unknown EXECUTE code: ",{code:z})}),this._parser.setOscHandlerFallback((z,T,A)=>{this._logService.debug("Unknown OSC code: ",{identifier:z,action:T,data:A})}),this._parser.setDcsHandlerFallback((z,T,A)=>{T==="HOOK"&&(A=A.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(z),action:T,payload:A})}),this._parser.setPrintHandler((z,T,A)=>this.print(z,T,A)),this._parser.registerCsiHandler({final:"@"},(z)=>this.insertChars(z)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(z)=>this.scrollLeft(z)),this._parser.registerCsiHandler({final:"A"},(z)=>this.cursorUp(z)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(z)=>this.scrollRight(z)),this._parser.registerCsiHandler({final:"B"},(z)=>this.cursorDown(z)),this._parser.registerCsiHandler({final:"C"},(z)=>this.cursorForward(z)),this._parser.registerCsiHandler({final:"D"},(z)=>this.cursorBackward(z)),this._parser.registerCsiHandler({final:"E"},(z)=>this.cursorNextLine(z)),this._parser.registerCsiHandler({final:"F"},(z)=>this.cursorPrecedingLine(z)),this._parser.registerCsiHandler({final:"G"},(z)=>this.cursorCharAbsolute(z)),this._parser.registerCsiHandler({final:"H"},(z)=>this.cursorPosition(z)),this._parser.registerCsiHandler({final:"I"},(z)=>this.cursorForwardTab(z)),this._parser.registerCsiHandler({final:"J"},(z)=>this.eraseInDisplay(z,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},(z)=>this.eraseInDisplay(z,!0)),this._parser.registerCsiHandler({final:"K"},(z)=>this.eraseInLine(z,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},(z)=>this.eraseInLine(z,!0)),this._parser.registerCsiHandler({final:"L"},(z)=>this.insertLines(z)),this._parser.registerCsiHandler({final:"M"},(z)=>this.deleteLines(z)),this._parser.registerCsiHandler({final:"P"},(z)=>this.deleteChars(z)),this._parser.registerCsiHandler({final:"S"},(z)=>this.scrollUp(z)),this._parser.registerCsiHandler({final:"T"},(z)=>this.scrollDown(z)),this._parser.registerCsiHandler({final:"X"},(z)=>this.eraseChars(z)),this._parser.registerCsiHandler({final:"Z"},(z)=>this.cursorBackwardTab(z)),this._parser.registerCsiHandler({final:"`"},(z)=>this.charPosAbsolute(z)),this._parser.registerCsiHandler({final:"a"},(z)=>this.hPositionRelative(z)),this._parser.registerCsiHandler({final:"b"},(z)=>this.repeatPrecedingCharacter(z)),this._parser.registerCsiHandler({final:"c"},(z)=>this.sendDeviceAttributesPrimary(z)),this._parser.registerCsiHandler({prefix:">",final:"c"},(z)=>this.sendDeviceAttributesSecondary(z)),this._parser.registerCsiHandler({final:"d"},(z)=>this.linePosAbsolute(z)),this._parser.registerCsiHandler({final:"e"},(z)=>this.vPositionRelative(z)),this._parser.registerCsiHandler({final:"f"},(z)=>this.hVPosition(z)),this._parser.registerCsiHandler({final:"g"},(z)=>this.tabClear(z)),this._parser.registerCsiHandler({final:"h"},(z)=>this.setMode(z)),this._parser.registerCsiHandler({prefix:"?",final:"h"},(z)=>this.setModePrivate(z)),this._parser.registerCsiHandler({final:"l"},(z)=>this.resetMode(z)),this._parser.registerCsiHandler({prefix:"?",final:"l"},(z)=>this.resetModePrivate(z)),this._parser.registerCsiHandler({final:"m"},(z)=>this.charAttributes(z)),this._parser.registerCsiHandler({final:"n"},(z)=>this.deviceStatus(z)),this._parser.registerCsiHandler({prefix:"?",final:"n"},(z)=>this.deviceStatusPrivate(z)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(z)=>this.softReset(z)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(z)=>this.setCursorStyle(z)),this._parser.registerCsiHandler({final:"r"},(z)=>this.setScrollRegion(z)),this._parser.registerCsiHandler({final:"s"},(z)=>this.saveCursor(z)),this._parser.registerCsiHandler({final:"t"},(z)=>this.windowOptions(z)),this._parser.registerCsiHandler({final:"u"},(z)=>this.restoreCursor(z)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(z)=>this.insertColumns(z)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(z)=>this.deleteColumns(z)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(z)=>this.selectProtected(z)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(z)=>this.requestMode(z,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(z)=>this.requestMode(z,!1)),this._parser.setExecuteHandler(D0.BEL,()=>this.bell()),this._parser.setExecuteHandler(D0.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(D0.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(D0.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(D0.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(D0.BS,()=>this.backspace()),this._parser.setExecuteHandler(D0.HT,()=>this.tab()),this._parser.setExecuteHandler(D0.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(D0.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(nX.IND,()=>this.index()),this._parser.setExecuteHandler(nX.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(nX.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new GU((z)=>(this.setTitle(z),this.setIconName(z),!0))),this._parser.registerOscHandler(1,new GU((z)=>this.setIconName(z))),this._parser.registerOscHandler(2,new GU((z)=>this.setTitle(z))),this._parser.registerOscHandler(4,new GU((z)=>this.setOrReportIndexedColor(z))),this._parser.registerOscHandler(8,new GU((z)=>this.setHyperlink(z))),this._parser.registerOscHandler(10,new GU((z)=>this.setOrReportFgColor(z))),this._parser.registerOscHandler(11,new GU((z)=>this.setOrReportBgColor(z))),this._parser.registerOscHandler(12,new GU((z)=>this.setOrReportCursorColor(z))),this._parser.registerOscHandler(104,new GU((z)=>this.restoreIndexedColor(z))),this._parser.registerOscHandler(110,new GU((z)=>this.restoreFgColor(z))),this._parser.registerOscHandler(111,new GU((z)=>this.restoreBgColor(z))),this._parser.registerOscHandler(112,new GU((z)=>this.restoreCursorColor(z))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let z in v1)this._parser.registerEscHandler({intermediates:"(",final:z},()=>this.selectCharset("("+z)),this._parser.registerEscHandler({intermediates:")",final:z},()=>this.selectCharset(")"+z)),this._parser.registerEscHandler({intermediates:"*",final:z},()=>this.selectCharset("*"+z)),this._parser.registerEscHandler({intermediates:"+",final:z},()=>this.selectCharset("+"+z)),this._parser.registerEscHandler({intermediates:"-",final:z},()=>this.selectCharset("-"+z)),this._parser.registerEscHandler({intermediates:".",final:z},()=>this.selectCharset("."+z)),this._parser.registerEscHandler({intermediates:"/",final:z},()=>this.selectCharset("/"+z));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler((z)=>(this._logService.error("Parsing error: ",z),z)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new b$((z,T)=>this.requestStatusString(z,T)))}getAttrData(){return this._curAttrData}_preserveStack(U,Z,X,Q){this._parseStack.paused=!0,this._parseStack.cursorStartX=U,this._parseStack.cursorStartY=Z,this._parseStack.decodedLength=X,this._parseStack.position=Q}_logSlowResolvingAsync(U){this._logService.logLevel<=3&&Promise.race([U,new Promise((Z,X)=>setTimeout(()=>X("#SLOW_TIMEOUT"),n$))]).catch((Z)=>{if(Z!=="#SLOW_TIMEOUT")throw Z;console.warn(`async parser handler taking longer than ${n$} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(U,Z){let X,Q=this._activeBuffer.x,K=this._activeBuffer.y,H=0,$=this._parseStack.paused;if($){if(X=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,Z))return this._logSlowResolvingAsync(X),X;Q=this._parseStack.cursorStartX,K=this._parseStack.cursorStartY,this._parseStack.paused=!1,U.length>dU&&(H=this._parseStack.position+dU)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof U=="string"?` "${U}"`:` "${Array.prototype.map.call(U,(z)=>String.fromCharCode(z)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof U=="string"?U.split("").map((z)=>z.charCodeAt(0)):U),this._parseBuffer.length<U.length&&this._parseBuffer.length<dU&&(this._parseBuffer=new Uint32Array(Math.min(U.length,dU))),$||this._dirtyRowTracker.clearRange(),U.length>dU)for(let z=H;z<U.length;z+=dU){let T=z+dU<U.length?z+dU:U.length,A=typeof U=="string"?this._stringDecoder.decode(U.substring(z,T),this._parseBuffer):this._utf8Decoder.decode(U.subarray(z,T),this._parseBuffer);if(X=this._parser.parse(this._parseBuffer,A))return this._preserveStack(Q,K,A,z),this._logSlowResolvingAsync(X),X}else if(!$){let z=typeof U=="string"?this._stringDecoder.decode(U,this._parseBuffer):this._utf8Decoder.decode(U,this._parseBuffer);if(X=this._parser.parse(this._parseBuffer,z))return this._preserveStack(Q,K,z,0),this._logSlowResolvingAsync(X),X}(this._activeBuffer.x!==Q||this._activeBuffer.y!==K)&&this._onCursorMove.fire();let M=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),q=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);q<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(q,this._bufferService.rows-1),end:Math.min(M,this._bufferService.rows-1)})}print(U,Z,X){let Q,K,H=this._charsetService.charset,$=this._optionsService.rawOptions.screenReaderMode,M=this._bufferService.cols,q=this._coreService.decPrivateModes.wraparound,z=this._coreService.modes.insertMode,T=this._curAttrData,A=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&X-Z>0&&A.getWidth(this._activeBuffer.x-1)===2&&A.setCellFromCodepoint(this._activeBuffer.x-1,0,1,T);let L=this._parser.precedingJoinState;for(let E=Z;E<X;++E){if(Q=U[E],Q<127&&H){let B=H[String.fromCharCode(Q)];B&&(Q=B.charCodeAt(0))}let S=this._unicodeService.charProperties(Q,L);K=QZ.extractWidth(S);let j=QZ.extractShouldJoin(S),k=j?QZ.extractWidth(L):0;if(L=S,$&&this._onA11yChar.fire(lU(Q)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+K-k>M){if(q){let B=A,v=this._activeBuffer.x-k;for(this._activeBuffer.x=k,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),A=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),k>0&&A instanceof XX&&A.copyCellsFrom(B,v,0,k,!1);v<M;)B.setCellFromCodepoint(v++,0,1,T)}else if(this._activeBuffer.x=M-1,K===2)continue}if(j&&this._activeBuffer.x){let B=A.getWidth(this._activeBuffer.x-1)?1:2;A.addCodepointToCell(this._activeBuffer.x-B,Q,K);for(let v=K-k;--v>=0;)A.setCellFromCodepoint(this._activeBuffer.x++,0,0,T);continue}if(z&&(A.insertCells(this._activeBuffer.x,K-k,this._activeBuffer.getNullCell(T)),A.getWidth(M-1)===2&&A.setCellFromCodepoint(M-1,0,1,T)),A.setCellFromCodepoint(this._activeBuffer.x++,Q,K,T),K>0)for(;--K;)A.setCellFromCodepoint(this._activeBuffer.x++,0,0,T)}this._parser.precedingJoinState=L,this._activeBuffer.x<M&&X-Z>0&&A.getWidth(this._activeBuffer.x)===0&&!A.hasContent(this._activeBuffer.x)&&A.setCellFromCodepoint(this._activeBuffer.x,0,1,T),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(U,Z){return U.final==="t"&&!U.prefix&&!U.intermediates?this._parser.registerCsiHandler(U,(X)=>o$(X.params[0],this._optionsService.rawOptions.windowOptions)?Z(X):!0):this._parser.registerCsiHandler(U,Z)}registerDcsHandler(U,Z){return this._parser.registerDcsHandler(U,new b$(Z))}registerEscHandler(U,Z){return this._parser.registerEscHandler(U,Z)}registerOscHandler(U,Z){return this._parser.registerOscHandler(U,new GU(Z))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);U.hasWidth(this._activeBuffer.x)&&!U.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let U=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-U),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(U=this._bufferService.cols-1){this._activeBuffer.x=Math.min(U,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(U,Z){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=U,this._activeBuffer.y=this._activeBuffer.scrollTop+Z):(this._activeBuffer.x=U,this._activeBuffer.y=Z),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(U,Z){this._restrictCursor(),this._setCursor(this._activeBuffer.x+U,this._activeBuffer.y+Z)}cursorUp(U){let Z=this._activeBuffer.y-this._activeBuffer.scrollTop;return Z>=0?this._moveCursor(0,-Math.min(Z,U.params[0]||1)):this._moveCursor(0,-(U.params[0]||1)),!0}cursorDown(U){let Z=this._activeBuffer.scrollBottom-this._activeBuffer.y;return Z>=0?this._moveCursor(0,Math.min(Z,U.params[0]||1)):this._moveCursor(0,U.params[0]||1),!0}cursorForward(U){return this._moveCursor(U.params[0]||1,0),!0}cursorBackward(U){return this._moveCursor(-(U.params[0]||1),0),!0}cursorNextLine(U){return this.cursorDown(U),this._activeBuffer.x=0,!0}cursorPrecedingLine(U){return this.cursorUp(U),this._activeBuffer.x=0,!0}cursorCharAbsolute(U){return this._setCursor((U.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(U){return this._setCursor(U.length>=2?(U.params[1]||1)-1:0,(U.params[0]||1)-1),!0}charPosAbsolute(U){return this._setCursor((U.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(U){return this._moveCursor(U.params[0]||1,0),!0}linePosAbsolute(U){return this._setCursor(this._activeBuffer.x,(U.params[0]||1)-1),!0}vPositionRelative(U){return this._moveCursor(0,U.params[0]||1),!0}hVPosition(U){return this.cursorPosition(U),!0}tabClear(U){let Z=U.params[0];return Z===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:Z===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(U){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let Z=U.params[0]||1;for(;Z--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(U){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let Z=U.params[0]||1;for(;Z--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(U){let Z=U.params[0];return Z===1&&(this._curAttrData.bg|=536870912),(Z===2||Z===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(U,Z,X,Q=!1,K=!1){let H=this._activeBuffer.lines.get(this._activeBuffer.ybase+U);H.replaceCells(Z,X,this._activeBuffer.getNullCell(this._eraseAttrData()),K),Q&&(H.isWrapped=!1)}_resetBufferLine(U,Z=!1){let X=this._activeBuffer.lines.get(this._activeBuffer.ybase+U);X&&(X.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),Z),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+U),X.isWrapped=!1)}eraseInDisplay(U,Z=!1){this._restrictCursor(this._bufferService.cols);let X;switch(U.params[0]){case 0:for(X=this._activeBuffer.y,this._dirtyRowTracker.markDirty(X),this._eraseInBufferLine(X++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,Z);X<this._bufferService.rows;X++)this._resetBufferLine(X,Z);this._dirtyRowTracker.markDirty(X);break;case 1:for(X=this._activeBuffer.y,this._dirtyRowTracker.markDirty(X),this._eraseInBufferLine(X,0,this._activeBuffer.x+1,!0,Z),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(X+1).isWrapped=!1);X--;)this._resetBufferLine(X,Z);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(X=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,X-1);X--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+X)?.getTrimmedLength(););for(;X>=0;X--)this._bufferService.scroll(this._eraseAttrData())}else{for(X=this._bufferService.rows,this._dirtyRowTracker.markDirty(X-1);X--;)this._resetBufferLine(X,Z);this._dirtyRowTracker.markDirty(0)}break;case 3:let Q=this._activeBuffer.lines.length-this._bufferService.rows;Q>0&&(this._activeBuffer.lines.trimStart(Q),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-Q,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-Q,0),this._onScroll.fire(0));break}return!0}eraseInLine(U,Z=!1){switch(this._restrictCursor(this._bufferService.cols),U.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,Z);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,Z);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,Z);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(U){this._restrictCursor();let Z=U.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let X=this._activeBuffer.ybase+this._activeBuffer.y,Q=this._bufferService.rows-1-this._activeBuffer.scrollBottom,K=this._bufferService.rows-1+this._activeBuffer.ybase-Q+1;for(;Z--;)this._activeBuffer.lines.splice(K-1,1),this._activeBuffer.lines.splice(X,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(U){this._restrictCursor();let Z=U.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let X=this._activeBuffer.ybase+this._activeBuffer.y,Q;for(Q=this._bufferService.rows-1-this._activeBuffer.scrollBottom,Q=this._bufferService.rows-1+this._activeBuffer.ybase-Q;Z--;)this._activeBuffer.lines.splice(X,1),this._activeBuffer.lines.splice(Q,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(U){this._restrictCursor();let Z=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return Z&&(Z.insertCells(this._activeBuffer.x,U.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(U){this._restrictCursor();let Z=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return Z&&(Z.deleteCells(this._activeBuffer.x,U.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(U){let Z=U.params[0]||1;for(;Z--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(U){let Z=U.params[0]||1;for(;Z--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(I1));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(U){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let Z=U.params[0]||1;for(let X=this._activeBuffer.scrollTop;X<=this._activeBuffer.scrollBottom;++X){let Q=this._activeBuffer.lines.get(this._activeBuffer.ybase+X);Q.deleteCells(0,Z,this._activeBuffer.getNullCell(this._eraseAttrData())),Q.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(U){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let Z=U.params[0]||1;for(let X=this._activeBuffer.scrollTop;X<=this._activeBuffer.scrollBottom;++X){let Q=this._activeBuffer.lines.get(this._activeBuffer.ybase+X);Q.insertCells(0,Z,this._activeBuffer.getNullCell(this._eraseAttrData())),Q.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(U){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let Z=U.params[0]||1;for(let X=this._activeBuffer.scrollTop;X<=this._activeBuffer.scrollBottom;++X){let Q=this._activeBuffer.lines.get(this._activeBuffer.ybase+X);Q.insertCells(this._activeBuffer.x,Z,this._activeBuffer.getNullCell(this._eraseAttrData())),Q.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(U){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let Z=U.params[0]||1;for(let X=this._activeBuffer.scrollTop;X<=this._activeBuffer.scrollBottom;++X){let Q=this._activeBuffer.lines.get(this._activeBuffer.ybase+X);Q.deleteCells(this._activeBuffer.x,Z,this._activeBuffer.getNullCell(this._eraseAttrData())),Q.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(U){this._restrictCursor();let Z=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return Z&&(Z.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(U.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(U){let Z=this._parser.precedingJoinState;if(!Z)return!0;let X=U.params[0]||1,Q=QZ.extractWidth(Z),K=this._activeBuffer.x-Q,H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(K),$=new Uint32Array(H.length*X),M=0;for(let z=0;z<H.length;){let T=H.codePointAt(z)||0;$[M++]=T,z+=T>65535?2:1}let q=M;for(let z=1;z<X;++z)$.copyWithin(q,0,M),q+=M;return this.print($,0,q),!0}sendDeviceAttributesPrimary(U){return U.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(D0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(D0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(U){return U.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(D0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(D0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(U.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(D0.ESC+"[>83;40003;0c")),!0}_is(U){return(this._optionsService.rawOptions.termName+"").indexOf(U)===0}setMode(U){for(let Z=0;Z<U.length;Z++)switch(U.params[Z]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(U){for(let Z=0;Z<U.length;Z++)switch(U.params[Z]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,JZ),this._charsetService.setgCharset(1,JZ),this._charsetService.setgCharset(2,JZ),this._charsetService.setgCharset(3,JZ);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1000:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(U){for(let Z=0;Z<U.length;Z++)switch(U.params[Z]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(U){for(let Z=0;Z<U.length;Z++)switch(U.params[Z]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1000:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),U.params[Z]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(U,Z){let X;((j)=>(j[j.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",j[j.SET=1]="SET",j[j.RESET=2]="RESET",j[j.PERMANENTLY_SET=3]="PERMANENTLY_SET",j[j.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(X||={});let Q=this._coreService.decPrivateModes,{activeProtocol:K,activeEncoding:H}=this._coreMouseService,$=this._coreService,{buffers:M,cols:q}=this._bufferService,{active:z,alt:T}=M,A=this._optionsService.rawOptions,L=(j,k)=>($.triggerDataEvent(`${D0.ESC}[${Z?"":"?"}${j};${k}$y`),!0),E=(j)=>j?1:2,S=U.params[0];return Z?S===2?L(S,4):S===4?L(S,E($.modes.insertMode)):S===12?L(S,3):S===20?L(S,E(A.convertEol)):L(S,0):S===1?L(S,E(Q.applicationCursorKeys)):S===3?L(S,A.windowOptions.setWinLines?q===80?2:q===132?1:0:0):S===6?L(S,E(Q.origin)):S===7?L(S,E(Q.wraparound)):S===8?L(S,3):S===9?L(S,E(K==="X10")):S===12?L(S,E(A.cursorBlink)):S===25?L(S,E(!$.isCursorHidden)):S===45?L(S,E(Q.reverseWraparound)):S===66?L(S,E(Q.applicationKeypad)):S===67?L(S,4):S===1000?L(S,E(K==="VT200")):S===1002?L(S,E(K==="DRAG")):S===1003?L(S,E(K==="ANY")):S===1004?L(S,E(Q.sendFocus)):S===1005?L(S,4):S===1006?L(S,E(H==="SGR")):S===1015?L(S,4):S===1016?L(S,E(H==="SGR_PIXELS")):S===1048?L(S,1):S===47||S===1047||S===1049?L(S,E(z===T)):S===2004?L(S,E(Q.bracketedPasteMode)):S===2026?L(S,E(Q.synchronizedOutput)):L(S,0)}_updateAttrColor(U,Z,X,Q,K){return Z===2?(U|=50331648,U&=-16777216,U|=IX.fromColorRGB([X,Q,K])):Z===5&&(U&=-50331904,U|=33554432|X&255),U}_extractColor(U,Z,X){let Q=[0,0,-1,0,0,0],K=0,H=0;do{if(Q[H+K]=U.params[Z+H],U.hasSubParams(Z+H)){let $=U.getSubParams(Z+H),M=0;do Q[1]===5&&(K=1),Q[H+M+1+K]=$[M];while(++M<$.length&&M+H+1+K<Q.length);break}if(Q[1]===5&&H+K>=2||Q[1]===2&&H+K>=5)break;Q[1]&&(K=1)}while(++H+Z<U.length&&H+K<Q.length);for(let $=2;$<Q.length;++$)Q[$]===-1&&(Q[$]=0);switch(Q[0]){case 38:X.fg=this._updateAttrColor(X.fg,Q[1],Q[3],Q[4],Q[5]);break;case 48:X.bg=this._updateAttrColor(X.bg,Q[1],Q[3],Q[4],Q[5]);break;case 58:X.extended=X.extended.clone(),X.extended.underlineColor=this._updateAttrColor(X.extended.underlineColor,Q[1],Q[3],Q[4],Q[5])}return H}_processUnderline(U,Z){Z.extended=Z.extended.clone(),(!~U||U>5)&&(U=1),Z.extended.underlineStyle=U,Z.fg|=268435456,U===0&&(Z.fg&=-268435457),Z.updateExtended()}_processSGR0(U){U.fg=I1.fg,U.bg=I1.bg,U.extended=U.extended.clone(),U.extended.underlineStyle=0,U.extended.underlineColor&=-67108864,U.updateExtended()}charAttributes(U){if(U.length===1&&U.params[0]===0)return this._processSGR0(this._curAttrData),!0;let Z=U.length,X,Q=this._curAttrData;for(let K=0;K<Z;K++)X=U.params[K],X>=30&&X<=37?(Q.fg&=-50331904,Q.fg|=16777216|X-30):X>=40&&X<=47?(Q.bg&=-50331904,Q.bg|=16777216|X-40):X>=90&&X<=97?(Q.fg&=-50331904,Q.fg|=16777216|X-90|8):X>=100&&X<=107?(Q.bg&=-50331904,Q.bg|=16777216|X-100|8):X===0?this._processSGR0(Q):X===1?Q.fg|=134217728:X===3?Q.bg|=67108864:X===4?(Q.fg|=268435456,this._processUnderline(U.hasSubParams(K)?U.getSubParams(K)[0]:1,Q)):X===5?Q.fg|=536870912:X===7?Q.fg|=67108864:X===8?Q.fg|=1073741824:X===9?Q.fg|=2147483648:X===2?Q.bg|=134217728:X===21?this._processUnderline(2,Q):X===22?(Q.fg&=-134217729,Q.bg&=-134217729):X===23?Q.bg&=-67108865:X===24?(Q.fg&=-268435457,this._processUnderline(0,Q)):X===25?Q.fg&=-536870913:X===27?Q.fg&=-67108865:X===28?Q.fg&=-1073741825:X===29?Q.fg&=2147483647:X===39?(Q.fg&=-67108864,Q.fg|=I1.fg&16777215):X===49?(Q.bg&=-67108864,Q.bg|=I1.bg&16777215):X===38||X===48||X===58?K+=this._extractColor(U,K,Q):X===53?Q.bg|=1073741824:X===55?Q.bg&=-1073741825:X===59?(Q.extended=Q.extended.clone(),Q.extended.underlineColor=-1,Q.updateExtended()):X===100?(Q.fg&=-67108864,Q.fg|=I1.fg&16777215,Q.bg&=-67108864,Q.bg|=I1.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",X);return!0}deviceStatus(U){switch(U.params[0]){case 5:this._coreService.triggerDataEvent(`${D0.ESC}[0n`);break;case 6:let Z=this._activeBuffer.y+1,X=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${D0.ESC}[${Z};${X}R`);break}return!0}deviceStatusPrivate(U){switch(U.params[0]){case 6:let Z=this._activeBuffer.y+1,X=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${D0.ESC}[?${Z};${X}R`);break;case 15:break;case 25:break;case 26:break;case 53:break}return!0}softReset(U){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=I1.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(U){let Z=U.length===0?1:U.params[0];if(Z===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(Z){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let X=Z%2===1;this._coreService.decPrivateModes.cursorBlink=X}return!0}setScrollRegion(U){let Z=U.params[0]||1,X;return(U.length<2||(X=U.params[1])>this._bufferService.rows||X===0)&&(X=this._bufferService.rows),X>Z&&(this._activeBuffer.scrollTop=Z-1,this._activeBuffer.scrollBottom=X-1,this._setCursor(0,0)),!0}windowOptions(U){if(!o$(U.params[0],this._optionsService.rawOptions.windowOptions))return!0;let Z=U.length>1?U.params[1]:0;switch(U.params[0]){case 14:Z!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${D0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(Z===0||Z===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>l$&&this._windowTitleStack.shift()),(Z===0||Z===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>l$&&this._iconNameStack.shift());break;case 23:(Z===0||Z===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(Z===0||Z===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(U){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(U){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(U){return this._windowTitle=U,this._onTitleChange.fire(U),!0}setIconName(U){return this._iconName=U,!0}setOrReportIndexedColor(U){let Z=[],X=U.split(";");for(;X.length>1;){let Q=X.shift(),K=X.shift();if(/^\d+$/.exec(Q)){let H=parseInt(Q);if(s$(H))if(K==="?")Z.push({type:0,index:H});else{let $=d$(K);$&&Z.push({type:1,index:H,color:$})}}}return Z.length&&this._onColor.fire(Z),!0}setHyperlink(U){let Z=U.indexOf(";");if(Z===-1)return!0;let X=U.slice(0,Z).trim(),Q=U.slice(Z+1);return Q?this._createHyperlink(X,Q):X.trim()?!1:this._finishHyperlink()}_createHyperlink(U,Z){this._getCurrentLinkId()&&this._finishHyperlink();let X=U.split(":"),Q,K=X.findIndex((H)=>H.startsWith("id="));return K!==-1&&(Q=X[K].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:Q,uri:Z}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(U,Z){let X=U.split(";");for(let Q=0;Q<X.length&&!(Z>=this._specialColors.length);++Q,++Z)if(X[Q]==="?")this._onColor.fire([{type:0,index:this._specialColors[Z]}]);else{let K=d$(X[Q]);K&&this._onColor.fire([{type:1,index:this._specialColors[Z],color:K}])}return!0}setOrReportFgColor(U){return this._setOrReportSpecialColor(U,0)}setOrReportBgColor(U){return this._setOrReportSpecialColor(U,1)}setOrReportCursorColor(U){return this._setOrReportSpecialColor(U,2)}restoreIndexedColor(U){if(!U)return this._onColor.fire([{type:2}]),!0;let Z=[],X=U.split(";");for(let Q=0;Q<X.length;++Q)if(/^\d+$/.exec(X[Q])){let K=parseInt(X[Q]);s$(K)&&Z.push({type:2,index:K})}return Z.length&&this._onColor.fire(Z),!0}restoreFgColor(U){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(U){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(U){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,JZ),!0}selectCharset(U){return U.length!==2?(this.selectDefaultCharset(),!0):(U[0]==="/"||this._charsetService.setgCharset(RC[U[0]],v1[U[1]]||JZ),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let U=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,U,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=I1.clone(),this._eraseAttrDataInternal=I1.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(U){return this._charsetService.setgLevel(U),!0}screenAlignmentPattern(){let U=new FU;U.content=4194373,U.fg=this._curAttrData.fg,U.bg=this._curAttrData.bg,this._setCursor(0,0);for(let Z=0;Z<this._bufferService.rows;++Z){let X=this._activeBuffer.ybase+this._activeBuffer.y+Z,Q=this._activeBuffer.lines.get(X);Q&&(Q.fill(U),Q.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(U,Z){let X=($)=>(this._coreService.triggerDataEvent(`${D0.ESC}${$}${D0.ESC}\\`),!0),Q=this._bufferService.buffer,K=this._optionsService.rawOptions;return X(U==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:U==='"p'?'P1$r61;1"p':U==="r"?`P1$r${Q.scrollTop+1};${Q.scrollBottom+1}r`:U==="m"?"P1$r0m":U===" q"?`P1$r${{block:2,underline:4,bar:6}[K.cursorStyle]-(K.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(U,Z){this._dirtyRowTracker.markRangeDirty(U,Z)}},UQ=class{constructor(U){this._bufferService=U,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(U){U<this.start?this.start=U:U>this.end&&(this.end=U)}markRangeDirty(U,Z){U>Z&&(m$=U,U=Z,Z=m$),U<this.start&&(this.start=U),Z>this.end&&(this.end=Z)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};UQ=$1([c0(0,r1)],UQ);function s$(U){return 0<=U&&U<256}var SC=50000000,r$=12,PC=50,kC=class extends d0{constructor(U){super();this._action=U,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new w0),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(U,Z){if(Z!==void 0&&this._syncCalls>Z){this._syncCalls=0;return}if(this._pendingData+=U.length,this._writeBuffer.push(U),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let X;for(;X=this._writeBuffer.shift();){this._action(X);let Q=this._callbacks.shift();Q&&Q()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(U,Z){if(this._pendingData>SC)throw Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=U.length,this._writeBuffer.push(U),this._callbacks.push(Z),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=U.length,this._writeBuffer.push(U),this._callbacks.push(Z)}_innerWrite(U=0,Z=!0){let X=U||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let Q=this._writeBuffer[this._bufferOffset],K=this._action(Q,Z);if(K){let $=(M)=>performance.now()-X>=r$?setTimeout(()=>this._innerWrite(0,M)):this._innerWrite(X,M);K.catch((M)=>(queueMicrotask(()=>{throw M}),Promise.resolve(!1))).then($);return}let H=this._callbacks[this._bufferOffset];if(H&&H(),this._bufferOffset++,this._pendingData-=Q.length,performance.now()-X>=r$)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>PC&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},ZQ=class{constructor(U){this._bufferService=U,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(U){let Z=this._bufferService.buffer;if(U.id===void 0){let M=Z.addMarker(Z.ybase+Z.y),q={data:U,id:this._nextId++,lines:[M]};return M.onDispose(()=>this._removeMarkerFromLink(q,M)),this._dataByLinkId.set(q.id,q),q.id}let X=U,Q=this._getEntryIdKey(X),K=this._entriesWithId.get(Q);if(K)return this.addLineToLink(K.id,Z.ybase+Z.y),K.id;let H=Z.addMarker(Z.ybase+Z.y),$={id:this._nextId++,key:this._getEntryIdKey(X),data:X,lines:[H]};return H.onDispose(()=>this._removeMarkerFromLink($,H)),this._entriesWithId.set($.key,$),this._dataByLinkId.set($.id,$),$.id}addLineToLink(U,Z){let X=this._dataByLinkId.get(U);if(X&&X.lines.every((Q)=>Q.line!==Z)){let Q=this._bufferService.buffer.addMarker(Z);X.lines.push(Q),Q.onDispose(()=>this._removeMarkerFromLink(X,Q))}}getLinkData(U){return this._dataByLinkId.get(U)?.data}_getEntryIdKey(U){return`${U.id};;${U.uri}`}_removeMarkerFromLink(U,Z){let X=U.lines.indexOf(Z);X!==-1&&(U.lines.splice(X,1),U.lines.length===0&&(U.data.id!==void 0&&this._entriesWithId.delete(U.key),this._dataByLinkId.delete(U.id)))}};ZQ=$1([c0(0,r1)],ZQ);var a$=!1,jC=class extends d0{constructor(U){super();this._windowsWrappingHeuristics=this._register(new EZ),this._onBinary=this._register(new w0),this.onBinary=this._onBinary.event,this._onData=this._register(new w0),this.onData=this._onData.event,this._onLineFeed=this._register(new w0),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new w0),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new w0),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new w0),this._instantiationService=new t8,this.optionsService=this._register(new $C(U)),this._instantiationService.setService(a1,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(tJ)),this._instantiationService.setService(r1,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(aJ)),this._instantiationService.setService(GK,this._logService),this.coreService=this._register(this._instantiationService.createInstance(iJ)),this._instantiationService.setService(KZ,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(eJ)),this._instantiationService.setService(QK,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(QZ)),this._instantiationService.setService(qO,this.unicodeService),this._charsetService=this._instantiationService.createInstance(FC),this._instantiationService.setService(MO,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(ZQ),this._instantiationService.setService(VK,this._oscLinkService),this._inputHandler=this._register(new EC(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(b1.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(b1.forward(this._bufferService.onResize,this._onResize)),this._register(b1.forward(this.coreService.onData,this._onData)),this._register(b1.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new kC((Z,X)=>this._inputHandler.parse(Z,X))),this._register(b1.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new w0),this._onScroll.event((U)=>{this._onScrollApi?.fire(U.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(U){for(let Z in U)this.optionsService.options[Z]=U[Z]}write(U,Z){this._writeBuffer.write(U,Z)}writeSync(U,Z){this._logService.logLevel<=3&&!a$&&(this._logService.warn("writeSync is unreliable and will be removed soon."),a$=!0),this._writeBuffer.writeSync(U,Z)}input(U,Z=!0){this.coreService.triggerDataEvent(U,Z)}resize(U,Z){isNaN(U)||isNaN(Z)||(U=Math.max(U,yK),Z=Math.max(Z,cK),this._bufferService.resize(U,Z))}scroll(U,Z=!1){this._bufferService.scroll(U,Z)}scrollLines(U,Z){this._bufferService.scrollLines(U,Z)}scrollPages(U){this.scrollLines(U*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(U){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(U){let Z=U-this._bufferService.buffer.ydisp;Z!==0&&this.scrollLines(Z)}registerEscHandler(U,Z){return this._inputHandler.registerEscHandler(U,Z)}registerDcsHandler(U,Z){return this._inputHandler.registerDcsHandler(U,Z)}registerCsiHandler(U,Z){return this._inputHandler.registerCsiHandler(U,Z)}registerOscHandler(U,Z){return this._inputHandler.registerOscHandler(U,Z)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let U=!1,Z=this.optionsService.rawOptions.windowsPty;Z&&Z.buildNumber!==void 0&&Z.buildNumber!==void 0?U=Z.backend==="conpty"&&Z.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(U=!0),U?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let U=[];U.push(this.onLineFeed(u$.bind(null,this._bufferService))),U.push(this.registerCsiHandler({final:"H"},()=>(u$(this._bufferService),!1))),this._windowsWrappingHeuristics.value=U1(()=>{for(let Z of U)Z.dispose()})}}},vC={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};function _C(U,Z,X,Q){let K={type:0,cancel:!1,key:void 0},H=(U.shiftKey?1:0)|(U.altKey?2:0)|(U.ctrlKey?4:0)|(U.metaKey?8:0);switch(U.keyCode){case 0:U.key==="UIKeyInputUpArrow"?Z?K.key=D0.ESC+"OA":K.key=D0.ESC+"[A":U.key==="UIKeyInputLeftArrow"?Z?K.key=D0.ESC+"OD":K.key=D0.ESC+"[D":U.key==="UIKeyInputRightArrow"?Z?K.key=D0.ESC+"OC":K.key=D0.ESC+"[C":U.key==="UIKeyInputDownArrow"&&(Z?K.key=D0.ESC+"OB":K.key=D0.ESC+"[B");break;case 8:K.key=U.ctrlKey?"\b":D0.DEL,U.altKey&&(K.key=D0.ESC+K.key);break;case 9:if(U.shiftKey){K.key=D0.ESC+"[Z";break}K.key=D0.HT,K.cancel=!0;break;case 13:K.key=U.altKey?D0.ESC+D0.CR:D0.CR,K.cancel=!0;break;case 27:K.key=D0.ESC,U.altKey&&(K.key=D0.ESC+D0.ESC),K.cancel=!0;break;case 37:if(U.metaKey)break;H?K.key=D0.ESC+"[1;"+(H+1)+"D":Z?K.key=D0.ESC+"OD":K.key=D0.ESC+"[D";break;case 39:if(U.metaKey)break;H?K.key=D0.ESC+"[1;"+(H+1)+"C":Z?K.key=D0.ESC+"OC":K.key=D0.ESC+"[C";break;case 38:if(U.metaKey)break;H?K.key=D0.ESC+"[1;"+(H+1)+"A":Z?K.key=D0.ESC+"OA":K.key=D0.ESC+"[A";break;case 40:if(U.metaKey)break;H?K.key=D0.ESC+"[1;"+(H+1)+"B":Z?K.key=D0.ESC+"OB":K.key=D0.ESC+"[B";break;case 45:!U.shiftKey&&!U.ctrlKey&&(K.key=D0.ESC+"[2~");break;case 46:H?K.key=D0.ESC+"[3;"+(H+1)+"~":K.key=D0.ESC+"[3~";break;case 36:H?K.key=D0.ESC+"[1;"+(H+1)+"H":Z?K.key=D0.ESC+"OH":K.key=D0.ESC+"[H";break;case 35:H?K.key=D0.ESC+"[1;"+(H+1)+"F":Z?K.key=D0.ESC+"OF":K.key=D0.ESC+"[F";break;case 33:U.shiftKey?K.type=2:U.ctrlKey?K.key=D0.ESC+"[5;"+(H+1)+"~":K.key=D0.ESC+"[5~";break;case 34:U.shiftKey?K.type=3:U.ctrlKey?K.key=D0.ESC+"[6;"+(H+1)+"~":K.key=D0.ESC+"[6~";break;case 112:H?K.key=D0.ESC+"[1;"+(H+1)+"P":K.key=D0.ESC+"OP";break;case 113:H?K.key=D0.ESC+"[1;"+(H+1)+"Q":K.key=D0.ESC+"OQ";break;case 114:H?K.key=D0.ESC+"[1;"+(H+1)+"R":K.key=D0.ESC+"OR";break;case 115:H?K.key=D0.ESC+"[1;"+(H+1)+"S":K.key=D0.ESC+"OS";break;case 116:H?K.key=D0.ESC+"[15;"+(H+1)+"~":K.key=D0.ESC+"[15~";break;case 117:H?K.key=D0.ESC+"[17;"+(H+1)+"~":K.key=D0.ESC+"[17~";break;case 118:H?K.key=D0.ESC+"[18;"+(H+1)+"~":K.key=D0.ESC+"[18~";break;case 119:H?K.key=D0.ESC+"[19;"+(H+1)+"~":K.key=D0.ESC+"[19~";break;case 120:H?K.key=D0.ESC+"[20;"+(H+1)+"~":K.key=D0.ESC+"[20~";break;case 121:H?K.key=D0.ESC+"[21;"+(H+1)+"~":K.key=D0.ESC+"[21~";break;case 122:H?K.key=D0.ESC+"[23;"+(H+1)+"~":K.key=D0.ESC+"[23~";break;case 123:H?K.key=D0.ESC+"[24;"+(H+1)+"~":K.key=D0.ESC+"[24~";break;default:if(U.ctrlKey&&!U.shiftKey&&!U.altKey&&!U.metaKey)U.keyCode>=65&&U.keyCode<=90?K.key=String.fromCharCode(U.keyCode-64):U.keyCode===32?K.key=D0.NUL:U.keyCode>=51&&U.keyCode<=55?K.key=String.fromCharCode(U.keyCode-51+27):U.keyCode===56?K.key=D0.DEL:U.keyCode===219?K.key=D0.ESC:U.keyCode===220?K.key=D0.FS:U.keyCode===221&&(K.key=D0.GS);else if((!X||Q)&&U.altKey&&!U.metaKey){let $=vC[U.keyCode]?.[U.shiftKey?1:0];if($)K.key=D0.ESC+$;else if(U.keyCode>=65&&U.keyCode<=90){let M=U.ctrlKey?U.keyCode-64:U.keyCode+32,q=String.fromCharCode(M);U.shiftKey&&(q=q.toUpperCase()),K.key=D0.ESC+q}else if(U.keyCode===32)K.key=D0.ESC+(U.ctrlKey?D0.NUL:" ");else if(U.key==="Dead"&&U.code.startsWith("Key")){let M=U.code.slice(3,4);U.shiftKey||(M=M.toLowerCase()),K.key=D0.ESC+M,K.cancel=!0}}else X&&!U.altKey&&!U.ctrlKey&&!U.shiftKey&&U.metaKey?U.keyCode===65&&(K.type=1):U.key&&!U.ctrlKey&&!U.altKey&&!U.metaKey&&U.keyCode>=48&&U.key.length===1?K.key=U.key:U.key&&U.ctrlKey&&(U.key==="_"&&(K.key=D0.US),U.key==="@"&&(K.key=D0.NUL));break}return K}var W1=0,BC=class{constructor(U){this._getKey=U,this._array=[],this._insertedValues=[],this._flushInsertedTask=new ZY,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new ZY,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(U){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(U)}_flushInserted(){let U=this._insertedValues.sort((K,H)=>this._getKey(K)-this._getKey(H)),Z=0,X=0,Q=Array(this._array.length+this._insertedValues.length);for(let K=0;K<Q.length;K++)X>=this._array.length||this._getKey(U[Z])<=this._getKey(this._array[X])?(Q[K]=U[Z],Z++):Q[K]=this._array[X++];this._array=Q,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(U){if(this._flushCleanupInserted(),this._array.length===0)return!1;let Z=this._getKey(U);if(Z===void 0||(W1=this._search(Z),W1===-1)||this._getKey(this._array[W1])!==Z)return!1;do if(this._array[W1]===U)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(W1),!0;while(++W1<this._array.length&&this._getKey(this._array[W1])===Z);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let U=this._deletedIndices.sort((K,H)=>K-H),Z=0,X=Array(this._array.length-U.length),Q=0;for(let K=0;K<this._array.length;K++)U[Z]===K?Z++:X[Q++]=this._array[K];this._array=X,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(U){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(W1=this._search(U),!(W1<0||W1>=this._array.length)&&this._getKey(this._array[W1])===U))do yield this._array[W1];while(++W1<this._array.length&&this._getKey(this._array[W1])===U)}forEachByKey(U,Z){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(W1=this._search(U),!(W1<0||W1>=this._array.length)&&this._getKey(this._array[W1])===U))do Z(this._array[W1]);while(++W1<this._array.length&&this._getKey(this._array[W1])===U)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(U){let Z=0,X=this._array.length-1;for(;X>=Z;){let Q=Z+X>>1,K=this._getKey(this._array[Q]);if(K>U)X=Q-1;else if(K<U)Z=Q+1;else{for(;Q>0&&this._getKey(this._array[Q-1])===U;)Q--;return Q}}return Z}},PJ=0,t$=0,xC=class extends d0{constructor(){super();this._decorations=new BC((U)=>U?.marker.line),this._onDecorationRegistered=this._register(new w0),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new w0),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(U1(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(U){if(U.marker.isDisposed)return;let Z=new NC(U);if(Z){let X=Z.marker.onDispose(()=>Z.dispose()),Q=Z.onDispose(()=>{Q.dispose(),Z&&(this._decorations.delete(Z)&&this._onDecorationRemoved.fire(Z),X.dispose())});this._decorations.insert(Z),this._onDecorationRegistered.fire(Z)}return Z}reset(){for(let U of this._decorations.values())U.dispose();this._decorations.clear()}*getDecorationsAtCell(U,Z,X){let Q=0,K=0;for(let H of this._decorations.getKeyIterator(Z))Q=H.options.x??0,K=Q+(H.options.width??1),U>=Q&&U<K&&(!X||(H.options.layer??"bottom")===X)&&(yield H)}forEachDecorationAtCell(U,Z,X,Q){this._decorations.forEachByKey(Z,(K)=>{PJ=K.options.x??0,t$=PJ+(K.options.width??1),U>=PJ&&U<t$&&(!X||(K.options.layer??"bottom")===X)&&Q(K)})}},NC=class extends nU{constructor(U){super();this.options=U,this.onRenderEmitter=this.add(new w0),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new w0),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=U.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=Y1.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Y1.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},gC=1000,fC=class{constructor(U,Z=gC){this._renderCallback=U,this._debounceThresholdMS=Z,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(U,Z,X){this._rowCount=X,U=U!==void 0?U:0,Z=Z!==void 0?Z:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,U):U,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,Z):Z;let Q=performance.now();if(Q-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=Q,this._innerRefresh();else if(!this._additionalRefreshRequested){let K=Q-this._lastRefreshMs,H=this._debounceThresholdMS-K;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},H)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let U=Math.max(this._rowStart,0),Z=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(U,Z)}},i$=20,e$=!1,XY=class extends d0{constructor(U,Z,X,Q){super();this._terminal=U,this._coreBrowserService=X,this._renderService=Q,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let K=this._coreBrowserService.mainDocument;this._accessibilityContainer=K.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=K.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let H=0;H<this._terminal.rows;H++)this._rowElements[H]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[H]);if(this._topBoundaryFocusListener=(H)=>this._handleBoundaryFocus(H,0),this._bottomBoundaryFocusListener=(H)=>this._handleBoundaryFocus(H,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=K.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new fC(this._renderRows.bind(this))),!this._terminal.element)throw Error("Cannot enable accessibility before Terminal.open");e$?(this._accessibilityContainer.classList.add("debug"),this._rowContainer.classList.add("debug"),this._debugRootContainer=K.createElement("div"),this._debugRootContainer.classList.add("xterm"),this._debugRootContainer.appendChild(K.createTextNode("------start a11y------")),this._debugRootContainer.appendChild(this._accessibilityContainer),this._debugRootContainer.appendChild(K.createTextNode("------end a11y------")),this._terminal.element.insertAdjacentElement("afterend",this._debugRootContainer)):this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize((H)=>this._handleResize(H.rows))),this._register(this._terminal.onRender((H)=>this._refreshRows(H.start,H.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar((H)=>this._handleChar(H))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
362
|
-
`))),this._register(this._terminal.onA11yTab((
|
|
363
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===i$+1&&(this._liveRegion.textContent+=jJ.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(U){this._clearLiveRegion(),/\p{Control}/u.test(U)||this._charsToConsume.push(U)}_refreshRows(U,Z){this._liveRegionDebouncer.refresh(U,Z,this._terminal.rows)}_renderRows(U,Z){let X=this._terminal.buffer,Q=X.lines.length.toString();for(let K=U;K<=Z;K++){let H=X.lines.get(X.ydisp+K),$=[],M=H?.translateToString(!0,void 0,void 0,$)||"",q=(X.ydisp+K+1).toString(),z=this._rowElements[K];z&&(M.length===0?(z.textContent=" ",this._rowColumns.set(z,[0,1])):(z.textContent=M,this._rowColumns.set(z,$)),z.setAttribute("aria-posinset",q),z.setAttribute("aria-setsize",Q),this._alignRowWidth(z))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(U,Z){let X=U.target,Q=this._rowElements[Z===0?1:this._rowElements.length-2],K=X.getAttribute("aria-posinset"),H=Z===0?"1":`${this._terminal.buffer.lines.length}`;if(K===H||U.relatedTarget!==Q)return;let $,M;if(Z===0?($=X,M=this._rowElements.pop(),this._rowContainer.removeChild(M)):($=this._rowElements.shift(),M=X,this._rowContainer.removeChild($)),$.removeEventListener("focus",this._topBoundaryFocusListener),M.removeEventListener("focus",this._bottomBoundaryFocusListener),Z===0){let q=this._createAccessibilityTreeNode();this._rowElements.unshift(q),this._rowContainer.insertAdjacentElement("afterbegin",q)}else{let q=this._createAccessibilityTreeNode();this._rowElements.push(q),this._rowContainer.appendChild(q)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(Z===0?-1:1),this._rowElements[Z===0?1:this._rowElements.length-2].focus(),U.preventDefault(),U.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let U=this._coreBrowserService.mainDocument.getSelection();if(!U)return;if(U.isCollapsed){this._rowContainer.contains(U.anchorNode)&&this._terminal.clearSelection();return}if(!U.anchorNode||!U.focusNode){console.error("anchorNode and/or focusNode are null");return}let Z={node:U.anchorNode,offset:U.anchorOffset},X={node:U.focusNode,offset:U.focusOffset};if((Z.node.compareDocumentPosition(X.node)&Node.DOCUMENT_POSITION_PRECEDING||Z.node===X.node&&Z.offset>X.offset)&&([Z,X]=[X,Z]),Z.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(Z={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(Z.node))return;let Q=this._rowElements.slice(-1)[0];if(X.node.compareDocumentPosition(Q)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(X={node:Q,offset:Q.textContent?.length??0}),!this._rowContainer.contains(X.node))return;let K=({node:M,offset:q})=>{let z=M instanceof Text?M.parentNode:M,T=parseInt(z?.getAttribute("aria-posinset"),10)-1;if(isNaN(T))return console.warn("row is invalid. Race condition?"),null;let A=this._rowColumns.get(z);if(!A)return console.warn("columns is null. Race condition?"),null;let L=q<A.length?A[q]:A.slice(-1)[0]+1;return L>=this._terminal.cols&&(++T,L=0),{row:T,column:L}},H=K(Z),$=K(X);if(!(!H||!$)){if(H.row>$.row||H.row===$.row&&H.column>=$.column)throw Error("invalid range");this._terminal.select(H.column,H.row,($.row-H.row)*this._terminal.cols-H.column+$.column)}}_handleResize(U){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let Z=this._rowContainer.children.length;Z<this._terminal.rows;Z++)this._rowElements[Z]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[Z]);for(;this._rowElements.length>U;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let U=this._coreBrowserService.mainDocument.createElement("div");return U.setAttribute("role","listitem"),U.tabIndex=-1,this._refreshRowDimensions(U),U}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let U=0;U<this._terminal.rows;U++)this._refreshRowDimensions(this._rowElements[U]),this._alignRowWidth(this._rowElements[U])}}_refreshRowDimensions(U){U.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(U){U.style.transform="";let Z=U.getBoundingClientRect().width,X=this._rowColumns.get(U)?.slice(-1)?.[0];if(!X)return;let Q=X*this._renderService.dimensions.css.cell.width;U.style.transform=`scaleX(${Q/Z})`}};XY=$1([c0(1,YQ),c0(2,NU),c0(3,gU)],XY);var XQ=class extends d0{constructor(U,Z,X,Q,K){super();this._element=U,this._mouseService=Z,this._renderService=X,this._bufferService=Q,this._linkProviderService=K,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new w0),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new w0),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(U1(()=>{VZ(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(u0(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(u0(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(u0(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(u0(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(U){this._lastMouseEvent=U;let Z=this._positionFromMouseEvent(U,this._element,this._mouseService);if(!Z)return;this._isMouseOut=!1;let X=U.composedPath();for(let Q=0;Q<X.length;Q++){let K=X[Q];if(K.classList.contains("xterm"))break;if(K.classList.contains("xterm-hover"))return}(!this._lastBufferCell||Z.x!==this._lastBufferCell.x||Z.y!==this._lastBufferCell.y)&&(this._handleHover(Z),this._lastBufferCell=Z)}_handleHover(U){if(this._activeLine!==U.y||this._wasResized){this._clearCurrentLink(),this._askForLink(U,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,U)||(this._clearCurrentLink(),this._askForLink(U,!0))}_askForLink(U,Z){(!this._activeProviderReplies||!Z)&&(this._activeProviderReplies?.forEach((Q)=>{Q?.forEach((K)=>{K.link.dispose&&K.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=U.y);let X=!1;for(let[Q,K]of this._linkProviderService.linkProviders.entries())Z?this._activeProviderReplies?.get(Q)&&(X=this._checkLinkProviderResult(Q,U,X)):K.provideLinks(U.y,(H)=>{if(this._isMouseOut)return;let $=H?.map((M)=>({link:M}));this._activeProviderReplies?.set(Q,$),X=this._checkLinkProviderResult(Q,U,X),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(U.y,this._activeProviderReplies)})}_removeIntersectingLinks(U,Z){let X=new Set;for(let Q=0;Q<Z.size;Q++){let K=Z.get(Q);if(K)for(let H=0;H<K.length;H++){let $=K[H],M=$.link.range.start.y<U?0:$.link.range.start.x,q=$.link.range.end.y>U?this._bufferService.cols:$.link.range.end.x;for(let z=M;z<=q;z++){if(X.has(z)){K.splice(H--,1);break}X.add(z)}}}}_checkLinkProviderResult(U,Z,X){if(!this._activeProviderReplies)return X;let Q=this._activeProviderReplies.get(U),K=!1;for(let H=0;H<U;H++)(!this._activeProviderReplies.has(H)||this._activeProviderReplies.get(H))&&(K=!0);if(!K&&Q){let H=Q.find(($)=>this._linkAtPosition($.link,Z));H&&(X=!0,this._handleNewLink(H))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!X)for(let H=0;H<this._activeProviderReplies.size;H++){let $=this._activeProviderReplies.get(H)?.find((M)=>this._linkAtPosition(M.link,Z));if($){X=!0,this._handleNewLink($);break}}return X}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(U){if(!this._currentLink)return;let Z=this._positionFromMouseEvent(U,this._element,this._mouseService);Z&&this._mouseDownLink&&wC(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,Z)&&this._currentLink.link.activate(U,this._currentLink.link.text)}_clearCurrentLink(U,Z){!this._currentLink||!this._lastMouseEvent||(!U||!Z||this._currentLink.link.range.start.y>=U&&this._currentLink.link.range.end.y<=Z)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,VZ(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(U){if(!this._lastMouseEvent)return;let Z=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);Z&&this._linkAtPosition(U.link,Z)&&(this._currentLink=U,this._currentLink.state={decorations:{underline:U.link.decorations===void 0?!0:U.link.decorations.underline,pointerCursor:U.link.decorations===void 0?!0:U.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,U.link,this._lastMouseEvent),U.link.decorations={},Object.defineProperties(U.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:(X)=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==X&&(this._currentLink.state.decorations.pointerCursor=X,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",X))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:(X)=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==X&&(this._currentLink.state.decorations.underline=X,this._currentLink.state.isHovered&&this._fireUnderlineEvent(U.link,X))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((X)=>{if(!this._currentLink)return;let Q=X.start===0?0:X.start+1+this._bufferService.buffer.ydisp,K=this._bufferService.buffer.ydisp+1+X.end;if(this._currentLink.link.range.start.y>=Q&&this._currentLink.link.range.end.y<=K&&(this._clearCurrentLink(Q,K),this._lastMouseEvent)){let H=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);H&&this._askForLink(H,!1)}})))}_linkHover(U,Z,X){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(Z,!0),this._currentLink.state.decorations.pointerCursor&&U.classList.add("xterm-cursor-pointer")),Z.hover&&Z.hover(X,Z.text)}_fireUnderlineEvent(U,Z){let X=U.range,Q=this._bufferService.buffer.ydisp,K=this._createLinkUnderlineEvent(X.start.x-1,X.start.y-Q-1,X.end.x,X.end.y-Q-1,void 0);(Z?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(K)}_linkLeave(U,Z,X){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(Z,!1),this._currentLink.state.decorations.pointerCursor&&U.classList.remove("xterm-cursor-pointer")),Z.leave&&Z.leave(X,Z.text)}_linkAtPosition(U,Z){let X=U.range.start.y*this._bufferService.cols+U.range.start.x,Q=U.range.end.y*this._bufferService.cols+U.range.end.x,K=Z.y*this._bufferService.cols+Z.x;return X<=K&&K<=Q}_positionFromMouseEvent(U,Z,X){let Q=X.getCoords(U,Z,this._bufferService.cols,this._bufferService.rows);if(Q)return{x:Q[0],y:Q[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(U,Z,X,Q,K){return{x1:U,y1:Z,x2:X,y2:Q,cols:this._bufferService.cols,fg:K}}};XQ=$1([c0(1,JQ),c0(2,gU),c0(3,r1),c0(4,KK)],XQ);function wC(U,Z){return U.text===Z.text&&U.range.start.x===Z.range.start.x&&U.range.start.y===Z.range.start.y&&U.range.end.x===Z.range.end.x&&U.range.end.y===Z.range.end.y}var yC=class extends jC{constructor(U={}){super(U);this._linkifier=this._register(new EZ),this.browser=jK,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new EZ),this._onCursorMove=this._register(new w0),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new w0),this.onKey=this._onKey.event,this._onRender=this._register(new w0),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new w0),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new w0),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new w0),this.onBell=this._onBell.event,this._onFocus=this._register(new w0),this._onBlur=this._register(new w0),this._onA11yCharEmitter=this._register(new w0),this._onA11yTabEmitter=this._register(new w0),this._onWillOpen=this._register(new w0),this._setup(),this._decorationService=this._instantiationService.createInstance(xC),this._instantiationService.setService(HX,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(S8),this._instantiationService.setService(KK,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(_J)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows((Z)=>this.refresh(Z?.start??0,Z?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport((Z)=>this._reportWindowsOptions(Z))),this._register(this._inputHandler.onColor((Z)=>this._handleColorEvent(Z))),this._register(b1.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(b1.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(b1.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(b1.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize((Z)=>this._afterResize(Z.cols,Z.rows))),this._register(U1(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(U){if(this._themeService)for(let Z of U){let X,Q="";switch(Z.index){case 256:X="foreground",Q="10";break;case 257:X="background",Q="11";break;case 258:X="cursor",Q="12";break;default:X="ansi",Q="4;"+Z.index}switch(Z.type){case 0:let K=e0.toColorRGB(X==="ansi"?this._themeService.colors.ansi[Z.index]:this._themeService.colors[X]);this.coreService.triggerDataEvent(`${D0.ESC}]${Q};${TC(K)}${PK.ST}`);break;case 1:if(X==="ansi")this._themeService.modifyColors((H)=>H.ansi[Z.index]=H1.toColor(...Z.color));else{let H=X;this._themeService.modifyColors(($)=>$[H]=H1.toColor(...Z.color))}break;case 2:this._themeService.restoreColor(Z.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(U){U?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(XY,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(U){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(D0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(D0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let U=this.buffer.ybase+this.buffer.y,Z=this.buffer.lines.get(U);if(!Z)return;let X=Math.min(this.buffer.x,this.cols-1),Q=this._renderService.dimensions.css.cell.height,K=Z.getWidth(X),H=this._renderService.dimensions.css.cell.width*K,$=this.buffer.y*this._renderService.dimensions.css.cell.height,M=X*this._renderService.dimensions.css.cell.width;this.textarea.style.left=M+"px",this.textarea.style.top=$+"px",this.textarea.style.width=H+"px",this.textarea.style.height=Q+"px",this.textarea.style.lineHeight=Q+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(u0(this.element,"copy",(Z)=>{this.hasSelection()&&FO(Z,this._selectionService)}));let U=(Z)=>OO(Z,this.textarea,this.coreService,this.optionsService);this._register(u0(this.textarea,"paste",U)),this._register(u0(this.element,"paste",U)),vK?this._register(u0(this.element,"mousedown",(Z)=>{Z.button===2&&U$(Z,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(u0(this.element,"contextmenu",(Z)=>{U$(Z,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),HQ&&this._register(u0(this.element,"auxclick",(Z)=>{Z.button===1&&YK(Z,this.textarea,this.screenElement)}))}_bindKeys(){this._register(u0(this.textarea,"keyup",(U)=>this._keyUp(U),!0)),this._register(u0(this.textarea,"keydown",(U)=>this._keyDown(U),!0)),this._register(u0(this.textarea,"keypress",(U)=>this._keyPress(U),!0)),this._register(u0(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(u0(this.textarea,"compositionupdate",(U)=>this._compositionHelper.compositionupdate(U))),this._register(u0(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(u0(this.textarea,"input",(U)=>this._inputEvent(U),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(U){if(!U)throw Error("Terminal requires a parent element.");if(U.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=U.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),U.appendChild(this.element);let Z=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),Z.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(u0(this.screenElement,"mousemove",(K)=>this.updateCursorStyle(K))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),Z.appendChild(this.screenElement);let X=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",kJ.get()),xK||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>X.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(R8,this.textarea,U.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(NU,this._coreBrowserService),this._register(u0(this.textarea,"focus",(K)=>this._handleTextAreaFocus(K))),this._register(u0(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(oJ,this._document,this._helperContainer),this._instantiationService.setService(JY,this._charSizeService),this._themeService=this._instantiationService.createInstance(rJ),this._instantiationService.setService(SZ,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(eX),this._instantiationService.setService($K,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(mJ,this.rows,this.screenElement)),this._instantiationService.setService(gU,this._renderService),this._register(this._renderService.onRenderedViewportChange((K)=>this._onRender.fire(K))),this.onResize((K)=>this._renderService.resize(K.cols,K.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(bJ,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(nJ),this._instantiationService.setService(JQ,this._mouseService);let Q=this._linkifier.value=this._register(this._instantiationService.createInstance(XQ,this.screenElement));this.element.appendChild(Z);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(hJ,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines((K)=>{super.scrollLines(K,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(sJ,this.element,this.screenElement,Q)),this._instantiationService.setService(TO,this._selectionService),this._register(this._selectionService.onRequestScrollLines((K)=>this.scrollLines(K.amount,K.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw((K)=>this._renderService.handleSelectionChanged(K.start,K.end,K.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection((K)=>{this.textarea.value=K,this.textarea.focus(),this.textarea.select()})),this._register(b1.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(uJ,this.screenElement)),this._register(u0(this.element,"mousedown",(K)=>this._selectionService.handleMouseDown(K))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(XY,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",(K)=>this._handleScreenReaderModeOptionChange(K))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(iX,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",(K)=>{!this._overviewRulerRenderer&&K&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(iX,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(lJ,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let U=this,Z=this.element;function X(H){let $=U._mouseService.getMouseReportCoords(H,U.screenElement);if(!$)return!1;let M,q;switch(H.overrideType||H.type){case"mousemove":q=32,H.buttons===void 0?(M=3,H.button!==void 0&&(M=H.button<3?H.button:3)):M=H.buttons&1?0:H.buttons&4?1:H.buttons&2?2:3;break;case"mouseup":q=0,M=H.button<3?H.button:3;break;case"mousedown":q=1,M=H.button<3?H.button:3;break;case"wheel":if(U._customWheelEventHandler&&U._customWheelEventHandler(H)===!1)return!1;let z=H.deltaY;if(z===0||U.coreMouseService.consumeWheelEvent(H,U._renderService?.dimensions?.device?.cell?.height,U._coreBrowserService?.dpr)===0)return!1;q=z<0?0:1,M=4;break;default:return!1}return q===void 0||M===void 0||M>4?!1:U.coreMouseService.triggerMouseEvent({col:$.col,row:$.row,x:$.x,y:$.y,button:M,action:q,ctrl:H.ctrlKey,alt:H.altKey,shift:H.shiftKey})}let Q={mouseup:null,wheel:null,mousedrag:null,mousemove:null},K={mouseup:(H)=>(X(H),H.buttons||(this._document.removeEventListener("mouseup",Q.mouseup),Q.mousedrag&&this._document.removeEventListener("mousemove",Q.mousedrag)),this.cancel(H)),wheel:(H)=>(X(H),this.cancel(H,!0)),mousedrag:(H)=>{H.buttons&&X(H)},mousemove:(H)=>{H.buttons||X(H)}};this._register(this.coreMouseService.onProtocolChange((H)=>{H?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(H)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),H&8?Q.mousemove||(Z.addEventListener("mousemove",K.mousemove),Q.mousemove=K.mousemove):(Z.removeEventListener("mousemove",Q.mousemove),Q.mousemove=null),H&16?Q.wheel||(Z.addEventListener("wheel",K.wheel,{passive:!1}),Q.wheel=K.wheel):(Z.removeEventListener("wheel",Q.wheel),Q.wheel=null),H&2?Q.mouseup||(Q.mouseup=K.mouseup):(this._document.removeEventListener("mouseup",Q.mouseup),Q.mouseup=null),H&4?Q.mousedrag||(Q.mousedrag=K.mousedrag):(this._document.removeEventListener("mousemove",Q.mousedrag),Q.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(u0(Z,"mousedown",(H)=>{if(H.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(H)))return X(H),Q.mouseup&&this._document.addEventListener("mouseup",Q.mouseup),Q.mousedrag&&this._document.addEventListener("mousemove",Q.mousedrag),this.cancel(H)})),this._register(u0(Z,"wheel",(H)=>{if(!Q.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(H)===!1)return!1;if(!this.buffer.hasScrollback){if(H.deltaY===0)return!1;if(U.coreMouseService.consumeWheelEvent(H,U._renderService?.dimensions?.device?.cell?.height,U._coreBrowserService?.dpr)===0)return this.cancel(H,!0);let $=D0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(H.deltaY<0?"A":"B");return this.coreService.triggerDataEvent($,!0),this.cancel(H,!0)}}},{passive:!1}))}refresh(U,Z){this._renderService?.refreshRows(U,Z)}updateCursorStyle(U){this._selectionService?.shouldColumnSelect(U)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(U,Z){this._viewport?this._viewport.scrollLines(U):super.scrollLines(U,Z),this.refresh(0,this.rows-1)}scrollPages(U){this.scrollLines(U*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(U){U&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(U){let Z=U-this._bufferService.buffer.ydisp;Z!==0&&this.scrollLines(Z)}paste(U){XK(U,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(U){this._customKeyEventHandler=U}attachCustomWheelEventHandler(U){this._customWheelEventHandler=U}registerLinkProvider(U){return this._linkProviderService.registerLinkProvider(U)}registerCharacterJoiner(U){if(!this._characterJoinerService)throw Error("Terminal must be opened first");let Z=this._characterJoinerService.register(U);return this.refresh(0,this.rows-1),Z}deregisterCharacterJoiner(U){if(!this._characterJoinerService)throw Error("Terminal must be opened first");this._characterJoinerService.deregister(U)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(U){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+U)}registerDecoration(U){return this._decorationService.registerDecoration(U)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(U,Z,X){this._selectionService.setSelection(U,Z,X)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(U,Z){this._selectionService?.selectLines(U,Z)}_keyDown(U){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(U)===!1)return!1;let Z=this.browser.isMac&&this.options.macOptionIsMeta&&U.altKey;if(!Z&&!this._compositionHelper.keydown(U))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!Z&&(U.key==="Dead"||U.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let X=_C(U,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(U),X.type===3||X.type===2){let Q=this.rows-1;return this.scrollLines(X.type===2?-Q:Q),this.cancel(U,!0)}if(X.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,U)||(X.cancel&&this.cancel(U,!0),!X.key)||U.key&&!U.ctrlKey&&!U.altKey&&!U.metaKey&&U.key.length===1&&U.key.charCodeAt(0)>=65&&U.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((X.key===D0.ETX||X.key===D0.CR)&&(this.textarea.value=""),this._onKey.fire({key:X.key,domEvent:U}),this._showCursor(),this.coreService.triggerDataEvent(X.key,!0),!this.optionsService.rawOptions.screenReaderMode||U.altKey||U.ctrlKey)return this.cancel(U,!0);this._keyDownHandled=!0}_isThirdLevelShift(U,Z){let X=U.isMac&&!this.options.macOptionIsMeta&&Z.altKey&&!Z.ctrlKey&&!Z.metaKey||U.isWindows&&Z.altKey&&Z.ctrlKey&&!Z.metaKey||U.isWindows&&Z.getModifierState("AltGraph");return Z.type==="keypress"?X:X&&(!Z.keyCode||Z.keyCode>47)}_keyUp(U){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(U)===!1)&&(cC(U)||this.focus(),this.updateCursorStyle(U),this._keyPressHandled=!1)}_keyPress(U){let Z;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(U)===!1)return!1;if(this.cancel(U),U.charCode)Z=U.charCode;else if(U.which===null||U.which===void 0)Z=U.keyCode;else if(U.which!==0&&U.charCode!==0)Z=U.which;else return!1;return!Z||(U.altKey||U.ctrlKey||U.metaKey)&&!this._isThirdLevelShift(this.browser,U)?!1:(Z=String.fromCharCode(Z),this._onKey.fire({key:Z,domEvent:U}),this._showCursor(),this.coreService.triggerDataEvent(Z,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(U){if(U.data&&U.inputType==="insertText"&&(!U.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let Z=U.data;return this.coreService.triggerDataEvent(Z,!0),this.cancel(U),!0}return!1}resize(U,Z){if(U===this.cols&&Z===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(U,Z)}_afterResize(U,Z){this._charSizeService?.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let U=1;U<this.rows;U++)this.buffer.lines.push(this.buffer.getBlankLine(I1));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let U=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=U,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(D0.ESC+"[I"):this.coreService.triggerDataEvent(D0.ESC+"[O")}_reportWindowsOptions(U){if(this._renderService)switch(U){case 0:let Z=this._renderService.dimensions.css.canvas.width.toFixed(0),X=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${D0.ESC}[4;${X};${Z}t`);break;case 1:let Q=this._renderService.dimensions.css.cell.width.toFixed(0),K=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${D0.ESC}[6;${K};${Q}t`);break}}cancel(U,Z){if(!(!this.options.cancelEvents&&!Z))return U.preventDefault(),U.stopPropagation(),!1}};function cC(U){return U.keyCode===16||U.keyCode===17||U.keyCode===18}var pC=class{constructor(){this._addons=[]}dispose(){for(let U=this._addons.length-1;U>=0;U--)this._addons[U].instance.dispose()}loadAddon(U,Z){let X={instance:Z,dispose:Z.dispose,isDisposed:!1};this._addons.push(X),Z.dispose=()=>this._wrappedAddonDispose(X),Z.activate(U)}_wrappedAddonDispose(U){if(U.isDisposed)return;let Z=-1;for(let X=0;X<this._addons.length;X++)if(this._addons[X]===U){Z=X;break}if(Z===-1)throw Error("Could not dispose an addon that has not been loaded");U.isDisposed=!0,U.dispose.apply(U.instance),this._addons.splice(Z,1)}},hC=class{constructor(U){this._line=U}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(U,Z){if(!(U<0||U>=this._line.length))return Z?(this._line.loadCell(U,Z),Z):this._line.loadCell(U,new FU)}translateToString(U,Z,X){return this._line.translateToString(U,Z,X)}},UK=class{constructor(U,Z){this._buffer=U,this.type=Z}init(U){return this._buffer=U,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(U){let Z=this._buffer.lines.get(U);if(Z)return new hC(Z)}getNullCell(){return new FU}},uC=class extends d0{constructor(U){super();this._core=U,this._onBufferChange=this._register(new w0),this.onBufferChange=this._onBufferChange.event,this._normal=new UK(this._core.buffers.normal,"normal"),this._alternate=new UK(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},bC=class{constructor(U){this._core=U}registerCsiHandler(U,Z){return this._core.registerCsiHandler(U,(X)=>Z(X.toArray()))}addCsiHandler(U,Z){return this.registerCsiHandler(U,Z)}registerDcsHandler(U,Z){return this._core.registerDcsHandler(U,(X,Q)=>Z(X,Q.toArray()))}addDcsHandler(U,Z){return this.registerDcsHandler(U,Z)}registerEscHandler(U,Z){return this._core.registerEscHandler(U,Z)}addEscHandler(U,Z){return this.registerEscHandler(U,Z)}registerOscHandler(U,Z){return this._core.registerOscHandler(U,Z)}addOscHandler(U,Z){return this.registerOscHandler(U,Z)}},dC=class{constructor(U){this._core=U}register(U){this._core.unicodeService.register(U)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(U){this._core.unicodeService.activeVersion=U}},lC=["cols","rows"],qU=0,hK=class extends d0{constructor(U){super(),this._core=this._register(new yC(U)),this._addonManager=this._register(new pC),this._publicOptions={...this._core.options};let Z=(Q)=>this._core.options[Q],X=(Q,K)=>{this._checkReadonlyOptions(Q),this._core.options[Q]=K};for(let Q in this._core.options){let K={get:Z.bind(this,Q),set:X.bind(this,Q)};Object.defineProperty(this._publicOptions,Q,K)}}_checkReadonlyOptions(U){if(lC.includes(U))throw Error(`Option "${U}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new bC(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new dC(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this._register(new uC(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let U=this._core.coreService.decPrivateModes,Z="none";switch(this._core.coreMouseService.activeProtocol){case"X10":Z="x10";break;case"VT200":Z="vt200";break;case"DRAG":Z="drag";break;case"ANY":Z="any";break}return{applicationCursorKeysMode:U.applicationCursorKeys,applicationKeypadMode:U.applicationKeypad,bracketedPasteMode:U.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:Z,originMode:U.origin,reverseWraparoundMode:U.reverseWraparound,sendFocusMode:U.sendFocus,synchronizedOutputMode:U.synchronizedOutput,wraparoundMode:U.wraparound}}get options(){return this._publicOptions}set options(U){for(let Z in U)this._publicOptions[Z]=U[Z]}blur(){this._core.blur()}focus(){this._core.focus()}input(U,Z=!0){this._core.input(U,Z)}resize(U,Z){this._verifyIntegers(U,Z),this._core.resize(U,Z)}open(U){this._core.open(U)}attachCustomKeyEventHandler(U){this._core.attachCustomKeyEventHandler(U)}attachCustomWheelEventHandler(U){this._core.attachCustomWheelEventHandler(U)}registerLinkProvider(U){return this._core.registerLinkProvider(U)}registerCharacterJoiner(U){return this._checkProposedApi(),this._core.registerCharacterJoiner(U)}deregisterCharacterJoiner(U){this._checkProposedApi(),this._core.deregisterCharacterJoiner(U)}registerMarker(U=0){return this._verifyIntegers(U),this._core.registerMarker(U)}registerDecoration(U){return this._checkProposedApi(),this._verifyPositiveIntegers(U.x??0,U.width??0,U.height??0),this._core.registerDecoration(U)}hasSelection(){return this._core.hasSelection()}select(U,Z,X){this._verifyIntegers(U,Z,X),this._core.select(U,Z,X)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(U,Z){this._verifyIntegers(U,Z),this._core.selectLines(U,Z)}dispose(){super.dispose()}scrollLines(U){this._verifyIntegers(U),this._core.scrollLines(U)}scrollPages(U){this._verifyIntegers(U),this._core.scrollPages(U)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(U){this._verifyIntegers(U),this._core.scrollToLine(U)}clear(){this._core.clear()}write(U,Z){this._core.write(U,Z)}writeln(U,Z){this._core.write(U),this._core.write(`\r
|
|
364
|
-
`,Z)}paste(U){this._core.paste(U)}refresh(U,Z){this._verifyIntegers(U,Z),this._core.refresh(U,Z)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(U){this._addonManager.loadAddon(this,U)}static get strings(){return{get promptLabel(){return kJ.get()},set promptLabel(U){kJ.set(U)},get tooMuchOutput(){return jJ.get()},set tooMuchOutput(U){jJ.set(U)}}}_verifyIntegers(...U){for(
|
|
380
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(U){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),FQ&&U&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(U){let Z=this._getMouseBufferCoords(U),X=this._model.finalSelectionStart,Q=this._model.finalSelectionEnd;return!X||!Q||!Z?!1:this._areCoordsInSelection(Z,X,Q)}isCellInSelection(U,Z){let X=this._model.finalSelectionStart,Q=this._model.finalSelectionEnd;return!X||!Q?!1:this._areCoordsInSelection([U,Z],X,Q)}_areCoordsInSelection(U,Z,X){return U[1]>Z[1]&&U[1]<X[1]||Z[1]===X[1]&&U[1]===Z[1]&&U[0]>=Z[0]&&U[0]<X[0]||Z[1]<X[1]&&U[1]===X[1]&&U[0]<X[0]||Z[1]<X[1]&&U[1]===Z[1]&&U[0]>=Z[0]}_selectWordAtCursor(U,Z){let X=this._linkifier.currentLink?.link?.range;if(X)return this._model.selectionStart=[X.start.x-1,X.start.y-1],this._model.selectionStartLength=v$(X,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let Q=this._getMouseBufferCoords(U);return Q?(this._selectWordAt(Q,Z),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(U,Z){this._model.clearSelection(),U=Math.max(U,0),Z=Math.min(Z,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,U],this._model.selectionEnd=[this._bufferService.cols,Z],this.refresh(),this._onSelectionChange.fire()}_handleTrim(U){this._model.handleTrim(U)&&this.refresh()}_getMouseBufferCoords(U){let Z=this._mouseService.getCoords(U,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(Z)return Z[0]--,Z[1]--,Z[1]+=this._bufferService.buffer.ydisp,Z}_getMouseEventScrollAmount(U){let Z=IQ(this._coreBrowserService.window,U,this._screenElement)[1],X=this._renderService.dimensions.css.canvas.height;return Z>=0&&Z<=X?0:(Z>X&&(Z-=X),Z=Math.min(Math.max(Z,-MJ),MJ),Z/=MJ,Z/Math.abs(Z)+Math.round(Z*(l8-1)))}shouldForceSelection(U){return UY?U.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:U.shiftKey}handleMouseDown(U){if(this._mouseDownTimeStamp=U.timeStamp,!(U.button===2&&this.hasSelection)&&U.button===0){if(!this._enabled){if(!this.shouldForceSelection(U))return;U.stopPropagation()}U.preventDefault(),this._dragScrollAmount=0,this._enabled&&U.shiftKey?this._handleIncrementalClick(U):U.detail===1?this._handleSingleClick(U):U.detail===2?this._handleDoubleClick(U):U.detail===3&&this._handleTripleClick(U),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),o8)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(U){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(U))}_handleSingleClick(U){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(U)?3:0,this._model.selectionStart=this._getMouseBufferCoords(U),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let Z=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);Z&&Z.length!==this._model.selectionStart[0]&&Z.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(U){this._selectWordAtCursor(U,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(U){let Z=this._getMouseBufferCoords(U);Z&&(this._activeSelectionMode=2,this._selectLineAt(Z[1]))}shouldColumnSelect(U){return U.altKey&&!(UY&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(U){if(U.stopImmediatePropagation(),!this._model.selectionStart)return;let Z=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(U),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(U),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let X=this._bufferService.buffer;if(this._model.selectionEnd[1]<X.lines.length){let Q=X.lines.get(this._model.selectionEnd[1]);Q&&Q.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!Z||Z[0]!==this._model.selectionEnd[0]||Z[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let U=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(U.ydisp+this._bufferService.rows,U.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=U.ydisp),this.refresh()}}_handleMouseUp(U){let Z=U.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&Z<n8&&U.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let X=this._mouseService.getCoords(U,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(X&&X[0]!==void 0&&X[1]!==void 0){let Q=w8(X[0]-1,X[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(Q,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let U=this._model.finalSelectionStart,Z=this._model.finalSelectionEnd,X=!!U&&!!Z&&(U[0]!==Z[0]||U[1]!==Z[1]);if(!X){this._oldHasSelection&&this._fireOnSelectionChange(U,Z,X);return}!U||!Z||(!this._oldSelectionStart||!this._oldSelectionEnd||U[0]!==this._oldSelectionStart[0]||U[1]!==this._oldSelectionStart[1]||Z[0]!==this._oldSelectionEnd[0]||Z[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(U,Z,X)}_fireOnSelectionChange(U,Z,X){this._oldSelectionStart=U,this._oldSelectionEnd=Z,this._oldHasSelection=X,this._onSelectionChange.fire()}_handleBufferActivate(U){this.clearSelection(),this._trimListener.dispose(),this._trimListener=U.activeBuffer.lines.onTrim((Z)=>this._handleTrim(Z))}_convertViewportColToCharacterIndex(U,Z){let X=Z;for(let Q=0;Z>=Q;Q++){let K=U.loadCell(Q,this._workCell).getChars().length;this._workCell.getWidth()===0?X--:K>1&&Z!==Q&&(X+=K-1)}return X}setSelection(U,Z,X){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[U,Z],this._model.selectionStartLength=X,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(U){this._isClickInSelection(U)||(this._selectWordAtCursor(U,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(U,Z,X=!0,Q=!0){if(U[0]>=this._bufferService.cols)return;let K=this._bufferService.buffer,F=K.lines.get(U[1]);if(!F)return;let $=K.translateBufferLineToString(U[1],!1),q=this._convertViewportColToCharacterIndex(F,U[0]),M=q,z=U[0]-q,T=0,A=0,L=0,E=0;if($.charAt(q)===" "){for(;q>0&&$.charAt(q-1)===" ";)q--;for(;M<$.length&&$.charAt(M+1)===" ";)M++}else{let k=U[0],B=U[0];F.getWidth(k)===0&&(T++,k--),F.getWidth(B)===2&&(A++,B++);let v=F.getString(B).length;for(v>1&&(E+=v-1,M+=v-1);k>0&&q>0&&!this._isCharWordSeparator(F.loadCell(k-1,this._workCell));){F.loadCell(k-1,this._workCell);let x=this._workCell.getChars().length;this._workCell.getWidth()===0?(T++,k--):x>1&&(L+=x-1,q-=x-1),q--,k--}for(;B<F.length&&M+1<$.length&&!this._isCharWordSeparator(F.loadCell(B+1,this._workCell));){F.loadCell(B+1,this._workCell);let x=this._workCell.getChars().length;this._workCell.getWidth()===2?(A++,B++):x>1&&(E+=x-1,M+=x-1),M++,B++}}M++;let S=q+z-T+L,j=Math.min(this._bufferService.cols,M-q+T+A-L-E);if(!(!Z&&$.slice(q,M).trim()==="")){if(X&&S===0&&F.getCodePoint(0)!==32){let k=K.lines.get(U[1]-1);if(k&&F.isWrapped&&k.getCodePoint(this._bufferService.cols-1)!==32){let B=this._getWordAt([this._bufferService.cols-1,U[1]-1],!1,!0,!1);if(B){let v=this._bufferService.cols-B.start;S-=v,j+=v}}}if(Q&&S+j===this._bufferService.cols&&F.getCodePoint(this._bufferService.cols-1)!==32){let k=K.lines.get(U[1]+1);if(k?.isWrapped&&k.getCodePoint(0)!==32){let B=this._getWordAt([0,U[1]+1],!1,!1,!0);B&&(j+=B.length)}}return{start:S,length:j}}}_selectWordAt(U,Z){let X=this._getWordAt(U,Z);if(X){for(;X.start<0;)X.start+=this._bufferService.cols,U[1]--;this._model.selectionStart=[X.start,U[1]],this._model.selectionStartLength=X.length}}_selectToWordAt(U){let Z=this._getWordAt(U,!0);if(Z){let X=U[1];for(;Z.start<0;)Z.start+=this._bufferService.cols,X--;if(!this._model.areSelectionValuesReversed())for(;Z.start+Z.length>this._bufferService.cols;)Z.length-=this._bufferService.cols,X++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?Z.start:Z.start+Z.length,X]}}_isCharWordSeparator(U){return U.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(U.getChars())>=0}_selectLineAt(U){let Z=this._bufferService.buffer.getWrappedRangeForLine(U),X={start:{x:0,y:Z.first},end:{x:this._bufferService.cols-1,y:Z.last}};this._model.selectionStart=[0,Z.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=v$(X,this._bufferService.cols)}};sJ=$1([c0(3,r1),c0(4,KZ),c0(5,JQ),c0(6,a1),c0(7,gU),c0(8,NU)],sJ);var _$=class{constructor(){this._data={}}set(U,Z,X){this._data[U]||(this._data[U]={}),this._data[U][Z]=X}get(U,Z){return this._data[U]?this._data[U][Z]:void 0}clear(){this._data={}}},B$=class{constructor(){this._color=new _$,this._css=new _$}setCss(U,Z,X){this._css.set(U,Z,X)}getCss(U,Z){return this._css.get(U,Z)}setColor(U,Z,X){this._color.set(U,Z,X)}getColor(U,Z){return this._color.get(U,Z)}clear(){this._color.clear(),this._css.clear()}},k1=Object.freeze((()=>{let U=[Y1.toColor("#2e3436"),Y1.toColor("#cc0000"),Y1.toColor("#4e9a06"),Y1.toColor("#c4a000"),Y1.toColor("#3465a4"),Y1.toColor("#75507b"),Y1.toColor("#06989a"),Y1.toColor("#d3d7cf"),Y1.toColor("#555753"),Y1.toColor("#ef2929"),Y1.toColor("#8ae234"),Y1.toColor("#fce94f"),Y1.toColor("#729fcf"),Y1.toColor("#ad7fa8"),Y1.toColor("#34e2e2"),Y1.toColor("#eeeeec")],Z=[0,95,135,175,215,255];for(let X=0;X<216;X++){let Q=Z[X/36%6|0],K=Z[X/6%6|0],F=Z[X%6];U.push({css:F1.toCss(Q,K,F),rgba:F1.toRgba(Q,K,F)})}for(let X=0;X<24;X++){let Q=8+X*10;U.push({css:F1.toCss(Q,Q,Q),rgba:F1.toRgba(Q,Q,Q)})}return U})()),YZ=Y1.toColor("#ffffff"),ZX=Y1.toColor("#000000"),x$=Y1.toColor("#ffffff"),N$=ZX,rZ={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},r8=YZ,rJ=class extends d0{constructor(U){super();this._optionsService=U,this._contrastCache=new B$,this._halfContrastCache=new B$,this._onChangeColors=this._register(new w0),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:YZ,background:ZX,cursor:x$,cursorAccent:N$,selectionForeground:void 0,selectionBackgroundTransparent:rZ,selectionBackgroundOpaque:e0.blend(ZX,rZ),selectionInactiveBackgroundTransparent:rZ,selectionInactiveBackgroundOpaque:e0.blend(ZX,rZ),scrollbarSliderBackground:e0.opacity(YZ,0.2),scrollbarSliderHoverBackground:e0.opacity(YZ,0.4),scrollbarSliderActiveBackground:e0.opacity(YZ,0.5),overviewRulerBorder:YZ,ansi:k1.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(U={}){let Z=this._colors;if(Z.foreground=a0(U.foreground,YZ),Z.background=a0(U.background,ZX),Z.cursor=e0.blend(Z.background,a0(U.cursor,x$)),Z.cursorAccent=e0.blend(Z.background,a0(U.cursorAccent,N$)),Z.selectionBackgroundTransparent=a0(U.selectionBackground,rZ),Z.selectionBackgroundOpaque=e0.blend(Z.background,Z.selectionBackgroundTransparent),Z.selectionInactiveBackgroundTransparent=a0(U.selectionInactiveBackground,Z.selectionBackgroundTransparent),Z.selectionInactiveBackgroundOpaque=e0.blend(Z.background,Z.selectionInactiveBackgroundTransparent),Z.selectionForeground=U.selectionForeground?a0(U.selectionForeground,P$):void 0,Z.selectionForeground===P$&&(Z.selectionForeground=void 0),e0.isOpaque(Z.selectionBackgroundTransparent)&&(Z.selectionBackgroundTransparent=e0.opacity(Z.selectionBackgroundTransparent,0.3)),e0.isOpaque(Z.selectionInactiveBackgroundTransparent)&&(Z.selectionInactiveBackgroundTransparent=e0.opacity(Z.selectionInactiveBackgroundTransparent,0.3)),Z.scrollbarSliderBackground=a0(U.scrollbarSliderBackground,e0.opacity(Z.foreground,0.2)),Z.scrollbarSliderHoverBackground=a0(U.scrollbarSliderHoverBackground,e0.opacity(Z.foreground,0.4)),Z.scrollbarSliderActiveBackground=a0(U.scrollbarSliderActiveBackground,e0.opacity(Z.foreground,0.5)),Z.overviewRulerBorder=a0(U.overviewRulerBorder,r8),Z.ansi=k1.slice(),Z.ansi[0]=a0(U.black,k1[0]),Z.ansi[1]=a0(U.red,k1[1]),Z.ansi[2]=a0(U.green,k1[2]),Z.ansi[3]=a0(U.yellow,k1[3]),Z.ansi[4]=a0(U.blue,k1[4]),Z.ansi[5]=a0(U.magenta,k1[5]),Z.ansi[6]=a0(U.cyan,k1[6]),Z.ansi[7]=a0(U.white,k1[7]),Z.ansi[8]=a0(U.brightBlack,k1[8]),Z.ansi[9]=a0(U.brightRed,k1[9]),Z.ansi[10]=a0(U.brightGreen,k1[10]),Z.ansi[11]=a0(U.brightYellow,k1[11]),Z.ansi[12]=a0(U.brightBlue,k1[12]),Z.ansi[13]=a0(U.brightMagenta,k1[13]),Z.ansi[14]=a0(U.brightCyan,k1[14]),Z.ansi[15]=a0(U.brightWhite,k1[15]),U.extendedAnsi){let X=Math.min(Z.ansi.length-16,U.extendedAnsi.length);for(let Q=0;Q<X;Q++)Z.ansi[Q+16]=a0(U.extendedAnsi[Q],k1[Q+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(U){this._restoreColor(U),this._onChangeColors.fire(this.colors)}_restoreColor(U){if(U===void 0){for(let Z=0;Z<this._restoreColors.ansi.length;++Z)this._colors.ansi[Z]=this._restoreColors.ansi[Z];return}switch(U){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[U]=this._restoreColors.ansi[U]}}modifyColors(U){U(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};rJ=$1([c0(0,a1)],rJ);function a0(U,Z){if(U!==void 0)try{return Y1.toColor(U)}catch{}return Z}var a8=class{constructor(...U){this._entries=new Map;for(let[Z,X]of U)this.set(Z,X)}set(U,Z){let X=this._entries.get(U);return this._entries.set(U,Z),X}forEach(U){for(let[Z,X]of this._entries.entries())U(Z,X)}has(U){return this._entries.has(U)}get(U){return this._entries.get(U)}},t8=class{constructor(){this._services=new a8,this._services.set(YQ,this)}setService(U,Z){this._services.set(U,Z)}getService(U){return this._services.get(U)}createInstance(U,...Z){let X=zO(U).sort((F,$)=>F.index-$.index),Q=[];for(let F of X){let $=this._services.get(F.id);if(!$)throw Error(`[createInstance] ${U.name} depends on UNKNOWN service ${F.id._id}.`);Q.push($)}let K=X.length>0?X[0].index:Z.length;if(Z.length!==K)throw Error(`[createInstance] First service dependency of ${U.name} at position ${K+1} conflicts with ${Z.length} static arguments`);return new U(...Z,...Q)}},i8={trace:0,debug:1,info:2,warn:3,error:4,off:5},e8="xterm.js: ",aJ=class extends d0{constructor(U){super();this._optionsService=U,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),UC=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=i8[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(U){for(let Z=0;Z<U.length;Z++)typeof U[Z]=="function"&&(U[Z]=U[Z]())}_log(U,Z,X){this._evalLazyOptionalParams(X),U.call(console,(this._optionsService.options.logger?"":e8)+Z,...X)}trace(U,...Z){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,U,Z)}debug(U,...Z){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,U,Z)}info(U,...Z){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,U,Z)}warn(U,...Z){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,U,Z)}error(U,...Z){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,U,Z)}};aJ=$1([c0(0,a1)],aJ);var UC,g$=class extends d0{constructor(U){super();this._maxLength=U,this.onDeleteEmitter=this._register(new w0),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new w0),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new w0),this.onTrim=this.onTrimEmitter.event,this._array=Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(U){if(this._maxLength===U)return;let Z=Array(U);for(let X=0;X<Math.min(U,this.length);X++)Z[X]=this._array[this._getCyclicIndex(X)];this._array=Z,this._maxLength=U,this._startIndex=0}get length(){return this._length}set length(U){if(U>this._length)for(let Z=this._length;Z<U;Z++)this._array[Z]=void 0;this._length=U}get(U){return this._array[this._getCyclicIndex(U)]}set(U,Z){this._array[this._getCyclicIndex(U)]=Z}push(U){this._array[this._getCyclicIndex(this._length)]=U,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(U,Z,...X){if(Z){for(let Q=U;Q<this._length-Z;Q++)this._array[this._getCyclicIndex(Q)]=this._array[this._getCyclicIndex(Q+Z)];this._length-=Z,this.onDeleteEmitter.fire({index:U,amount:Z})}for(let Q=this._length-1;Q>=U;Q--)this._array[this._getCyclicIndex(Q+X.length)]=this._array[this._getCyclicIndex(Q)];for(let Q=0;Q<X.length;Q++)this._array[this._getCyclicIndex(U+Q)]=X[Q];if(X.length&&this.onInsertEmitter.fire({index:U,amount:X.length}),this._length+X.length>this._maxLength){let Q=this._length+X.length-this._maxLength;this._startIndex+=Q,this._length=this._maxLength,this.onTrimEmitter.fire(Q)}else this._length+=X.length}trimStart(U){U>this._length&&(U=this._length),this._startIndex+=U,this._length-=U,this.onTrimEmitter.fire(U)}shiftElements(U,Z,X){if(!(Z<=0)){if(U<0||U>=this._length)throw Error("start argument out of range");if(U+X<0)throw Error("Cannot shift elements in list beyond index 0");if(X>0){for(let K=Z-1;K>=0;K--)this.set(U+K+X,this.get(U+K));let Q=U+Z+X-this._length;if(Q>0)for(this._length+=Q;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let Q=0;Q<Z;Q++)this.set(U+Q+X,this.get(U+Q))}}_getCyclicIndex(U){return(this._startIndex+U)%this._maxLength}},n0=3,I1=Object.freeze(new IX),pX=0,LJ=2,XX=class U{constructor(Z,X,Q=!1){this.isWrapped=Q,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(Z*n0);let K=X||HU.fromCharData([0,JK,1,0]);for(let F=0;F<Z;++F)this.setCell(F,K);this.length=Z}get(Z){let X=this._data[Z*n0+0],Q=X&2097151;return[this._data[Z*n0+1],X&2097152?this._combined[Z]:Q?lU(Q):"",X>>22,X&2097152?this._combined[Z].charCodeAt(this._combined[Z].length-1):Q]}set(Z,X){this._data[Z*n0+1]=X[0],X[1].length>1?(this._combined[Z]=X[1],this._data[Z*n0+0]=Z|2097152|X[2]<<22):this._data[Z*n0+0]=X[1].charCodeAt(0)|X[2]<<22}getWidth(Z){return this._data[Z*n0+0]>>22}hasWidth(Z){return this._data[Z*n0+0]&12582912}getFg(Z){return this._data[Z*n0+1]}getBg(Z){return this._data[Z*n0+2]}hasContent(Z){return this._data[Z*n0+0]&4194303}getCodePoint(Z){let X=this._data[Z*n0+0];return X&2097152?this._combined[Z].charCodeAt(this._combined[Z].length-1):X&2097151}isCombined(Z){return this._data[Z*n0+0]&2097152}getString(Z){let X=this._data[Z*n0+0];return X&2097152?this._combined[Z]:X&2097151?lU(X&2097151):""}isProtected(Z){return this._data[Z*n0+2]&536870912}loadCell(Z,X){return pX=Z*n0,X.content=this._data[pX+0],X.fg=this._data[pX+1],X.bg=this._data[pX+2],X.content&2097152&&(X.combinedData=this._combined[Z]),X.bg&268435456&&(X.extended=this._extendedAttrs[Z]),X}setCell(Z,X){X.content&2097152&&(this._combined[Z]=X.combinedData),X.bg&268435456&&(this._extendedAttrs[Z]=X.extended),this._data[Z*n0+0]=X.content,this._data[Z*n0+1]=X.fg,this._data[Z*n0+2]=X.bg}setCellFromCodepoint(Z,X,Q,K){K.bg&268435456&&(this._extendedAttrs[Z]=K.extended),this._data[Z*n0+0]=X|Q<<22,this._data[Z*n0+1]=K.fg,this._data[Z*n0+2]=K.bg}addCodepointToCell(Z,X,Q){let K=this._data[Z*n0+0];K&2097152?this._combined[Z]+=lU(X):K&2097151?(this._combined[Z]=lU(K&2097151)+lU(X),K&=-2097152,K|=2097152):K=X|4194304,Q&&(K&=-12582913,K|=Q<<22),this._data[Z*n0+0]=K}insertCells(Z,X,Q){if(Z%=this.length,Z&&this.getWidth(Z-1)===2&&this.setCellFromCodepoint(Z-1,0,1,Q),X<this.length-Z){let K=new HU;for(let F=this.length-Z-X-1;F>=0;--F)this.setCell(Z+X+F,this.loadCell(Z+F,K));for(let F=0;F<X;++F)this.setCell(Z+F,Q)}else for(let K=Z;K<this.length;++K)this.setCell(K,Q);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,Q)}deleteCells(Z,X,Q){if(Z%=this.length,X<this.length-Z){let K=new HU;for(let F=0;F<this.length-Z-X;++F)this.setCell(Z+F,this.loadCell(Z+X+F,K));for(let F=this.length-X;F<this.length;++F)this.setCell(F,Q)}else for(let K=Z;K<this.length;++K)this.setCell(K,Q);Z&&this.getWidth(Z-1)===2&&this.setCellFromCodepoint(Z-1,0,1,Q),this.getWidth(Z)===0&&!this.hasContent(Z)&&this.setCellFromCodepoint(Z,0,1,Q)}replaceCells(Z,X,Q,K=!1){if(K){for(Z&&this.getWidth(Z-1)===2&&!this.isProtected(Z-1)&&this.setCellFromCodepoint(Z-1,0,1,Q),X<this.length&&this.getWidth(X-1)===2&&!this.isProtected(X)&&this.setCellFromCodepoint(X,0,1,Q);Z<X&&Z<this.length;)this.isProtected(Z)||this.setCell(Z,Q),Z++;return}for(Z&&this.getWidth(Z-1)===2&&this.setCellFromCodepoint(Z-1,0,1,Q),X<this.length&&this.getWidth(X-1)===2&&this.setCellFromCodepoint(X,0,1,Q);Z<X&&Z<this.length;)this.setCell(Z++,Q)}resize(Z,X){if(Z===this.length)return this._data.length*4*LJ<this._data.buffer.byteLength;let Q=Z*n0;if(Z>this.length){if(this._data.buffer.byteLength>=Q*4)this._data=new Uint32Array(this._data.buffer,0,Q);else{let K=new Uint32Array(Q);K.set(this._data),this._data=K}for(let K=this.length;K<Z;++K)this.setCell(K,X)}else{this._data=this._data.subarray(0,Q);let K=Object.keys(this._combined);for(let $=0;$<K.length;$++){let q=parseInt(K[$],10);q>=Z&&delete this._combined[q]}let F=Object.keys(this._extendedAttrs);for(let $=0;$<F.length;$++){let q=parseInt(F[$],10);q>=Z&&delete this._extendedAttrs[q]}}return this.length=Z,Q*4*LJ<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*LJ<this._data.buffer.byteLength){let Z=new Uint32Array(this._data.length);return Z.set(this._data),this._data=Z,1}return 0}fill(Z,X=!1){if(X){for(let Q=0;Q<this.length;++Q)this.isProtected(Q)||this.setCell(Q,Z);return}this._combined={},this._extendedAttrs={};for(let Q=0;Q<this.length;++Q)this.setCell(Q,Z)}copyFrom(Z){this.length!==Z.length?this._data=new Uint32Array(Z._data):this._data.set(Z._data),this.length=Z.length,this._combined={};for(let X in Z._combined)this._combined[X]=Z._combined[X];this._extendedAttrs={};for(let X in Z._extendedAttrs)this._extendedAttrs[X]=Z._extendedAttrs[X];this.isWrapped=Z.isWrapped}clone(){let Z=new U(0);Z._data=new Uint32Array(this._data),Z.length=this.length;for(let X in this._combined)Z._combined[X]=this._combined[X];for(let X in this._extendedAttrs)Z._extendedAttrs[X]=this._extendedAttrs[X];return Z.isWrapped=this.isWrapped,Z}getTrimmedLength(){for(let Z=this.length-1;Z>=0;--Z)if(this._data[Z*n0+0]&4194303)return Z+(this._data[Z*n0+0]>>22);return 0}getNoBgTrimmedLength(){for(let Z=this.length-1;Z>=0;--Z)if(this._data[Z*n0+0]&4194303||this._data[Z*n0+2]&50331648)return Z+(this._data[Z*n0+0]>>22);return 0}copyCellsFrom(Z,X,Q,K,F){let $=Z._data;if(F)for(let M=K-1;M>=0;M--){for(let z=0;z<n0;z++)this._data[(Q+M)*n0+z]=$[(X+M)*n0+z];$[(X+M)*n0+2]&268435456&&(this._extendedAttrs[Q+M]=Z._extendedAttrs[X+M])}else for(let M=0;M<K;M++){for(let z=0;z<n0;z++)this._data[(Q+M)*n0+z]=$[(X+M)*n0+z];$[(X+M)*n0+2]&268435456&&(this._extendedAttrs[Q+M]=Z._extendedAttrs[X+M])}let q=Object.keys(Z._combined);for(let M=0;M<q.length;M++){let z=parseInt(q[M],10);z>=X&&(this._combined[z-X+Q]=Z._combined[z])}}translateToString(Z,X,Q,K){X=X??0,Q=Q??this.length,Z&&(Q=Math.min(Q,this.getTrimmedLength())),K&&(K.length=0);let F="";for(;X<Q;){let $=this._data[X*n0+0],q=$&2097151,M=$&2097152?this._combined[X]:q?lU(q):oU;if(F+=M,K)for(let z=0;z<M.length;++z)K.push(X);X+=$>>22||1}return K&&K.push(X),F}};function ZC(U,Z,X,Q,K,F){let $=[];for(let q=0;q<U.length-1;q++){let M=q,z=U.get(++M);if(!z.isWrapped)continue;let T=[U.get(q)];for(;M<U.length&&z.isWrapped;)T.push(z),z=U.get(++M);if(!F&&Q>=q&&Q<M){q+=T.length-1;continue}let A=0,L=WX(T,A,Z),E=1,S=0;for(;E<T.length;){let k=WX(T,E,Z),B=k-S,v=X-L,x=Math.min(B,v);T[A].copyCellsFrom(T[E],S,L,x,!1),L+=x,L===X&&(A++,L=0),S+=x,S===k&&(E++,S=0),L===0&&A!==0&&T[A-1].getWidth(X-1)===2&&(T[A].copyCellsFrom(T[A-1],X-1,L++,1,!1),T[A-1].setCell(X-1,K))}T[A].replaceCells(L,X,K);let j=0;for(let k=T.length-1;k>0&&(k>A||T[k].getTrimmedLength()===0);k--)j++;j>0&&($.push(q+T.length-j),$.push(j)),q+=T.length-1}return $}function XC(U,Z){let X=[],Q=0,K=Z[Q],F=0;for(let $=0;$<U.length;$++)if(K===$){let q=Z[++Q];U.onDeleteEmitter.fire({index:$-F,amount:q}),$+=q-1,F+=q,K=Z[++Q]}else X.push($);return{layout:X,countRemoved:F}}function YC(U,Z){let X=[];for(let Q=0;Q<Z.length;Q++)X.push(U.get(Z[Q]));for(let Q=0;Q<X.length;Q++)U.set(Q,X[Q]);U.length=Z.length}function JC(U,Z,X){let Q=[],K=U.map((M,z)=>WX(U,z,Z)).reduce((M,z)=>M+z),F=0,$=0,q=0;for(;q<K;){if(K-q<X){Q.push(K-q);break}F+=X;let M=WX(U,$,Z);F>M&&(F-=M,$++);let z=U[$].getWidth(F-1)===2;z&&F--;let T=z?X-1:X;Q.push(T),q+=T}return Q}function WX(U,Z,X){if(Z===U.length-1)return U[Z].getTrimmedLength();let Q=!U[Z].hasContent(X-1)&&U[Z].getWidth(X-1)===1,K=U[Z+1].getWidth(0)===2;return Q&&K?X-1:X}var wK=class U{constructor(Z){this.line=Z,this.isDisposed=!1,this._disposables=[],this._id=U._nextId++,this._onDispose=this.register(new w0),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),VZ(this._disposables),this._disposables.length=0)}register(Z){return this._disposables.push(Z),Z}};wK._nextId=1;var QC=wK,v1={},JZ=v1.B;v1[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"};v1.A={"#":"£"};v1.B=void 0;v1[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};v1.C=v1[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};v1.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};v1.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};v1.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};v1.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};v1.E=v1[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};v1.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};v1.H=v1[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};v1["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var f$=4294967295,w$=class{constructor(U,Z,X){this._hasScrollback=U,this._optionsService=Z,this._bufferService=X,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=I1.clone(),this.savedCharset=JZ,this.markers=[],this._nullCell=HU.fromCharData([0,JK,1,0]),this._whitespaceCell=HU.fromCharData([0,oU,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new ZY,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new g$(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(U){return U?(this._nullCell.fg=U.fg,this._nullCell.bg=U.bg,this._nullCell.extended=U.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new sX),this._nullCell}getWhitespaceCell(U){return U?(this._whitespaceCell.fg=U.fg,this._whitespaceCell.bg=U.bg,this._whitespaceCell.extended=U.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new sX),this._whitespaceCell}getBlankLine(U,Z){return new XX(this._bufferService.cols,this.getNullCell(U),Z)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let U=this.ybase+this.y-this.ydisp;return U>=0&&U<this._rows}_getCorrectBufferLength(U){if(!this._hasScrollback)return U;let Z=U+this._optionsService.rawOptions.scrollback;return Z>f$?f$:Z}fillViewportRows(U){if(this.lines.length===0){U===void 0&&(U=I1);let Z=this._rows;for(;Z--;)this.lines.push(this.getBlankLine(U))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new g$(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(U,Z){let X=this.getNullCell(I1),Q=0,K=this._getCorrectBufferLength(Z);if(K>this.lines.maxLength&&(this.lines.maxLength=K),this.lines.length>0){if(this._cols<U)for(let $=0;$<this.lines.length;$++)Q+=+this.lines.get($).resize(U,X);let F=0;if(this._rows<Z)for(let $=this._rows;$<Z;$++)this.lines.length<Z+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new XX(U,X)):this.ybase>0&&this.lines.length<=this.ybase+this.y+F+1?(this.ybase--,F++,this.ydisp>0&&this.ydisp--):this.lines.push(new XX(U,X)));else for(let $=this._rows;$>Z;$--)this.lines.length>Z+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(K<this.lines.maxLength){let $=this.lines.length-K;$>0&&(this.lines.trimStart($),this.ybase=Math.max(this.ybase-$,0),this.ydisp=Math.max(this.ydisp-$,0),this.savedY=Math.max(this.savedY-$,0)),this.lines.maxLength=K}this.x=Math.min(this.x,U-1),this.y=Math.min(this.y,Z-1),F&&(this.y+=F),this.savedX=Math.min(this.savedX,U-1),this.scrollTop=0}if(this.scrollBottom=Z-1,this._isReflowEnabled&&(this._reflow(U,Z),this._cols>U))for(let F=0;F<this.lines.length;F++)Q+=+this.lines.get(F).resize(U,X);this._cols=U,this._rows=Z,this._memoryCleanupQueue.clear(),Q>0.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let U=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,U=!1);let Z=0;for(;this._memoryCleanupPosition<this.lines.length;)if(Z+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),Z>100)return!0;return U}get _isReflowEnabled(){let U=this._optionsService.rawOptions.windowsPty;return U&&U.buildNumber?this._hasScrollback&&U.backend==="conpty"&&U.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(U,Z){this._cols!==U&&(U>this._cols?this._reflowLarger(U,Z):this._reflowSmaller(U,Z))}_reflowLarger(U,Z){let X=this._optionsService.rawOptions.reflowCursorLine,Q=ZC(this.lines,this._cols,U,this.ybase+this.y,this.getNullCell(I1),X);if(Q.length>0){let K=XC(this.lines,Q);YC(this.lines,K.layout),this._reflowLargerAdjustViewport(U,Z,K.countRemoved)}}_reflowLargerAdjustViewport(U,Z,X){let Q=this.getNullCell(I1),K=X;for(;K-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<Z&&this.lines.push(new XX(U,Q))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-X,0)}_reflowSmaller(U,Z){let X=this._optionsService.rawOptions.reflowCursorLine,Q=this.getNullCell(I1),K=[],F=0;for(let $=this.lines.length-1;$>=0;$--){let q=this.lines.get($);if(!q||!q.isWrapped&&q.getTrimmedLength()<=U)continue;let M=[q];for(;q.isWrapped&&$>0;)q=this.lines.get(--$),M.unshift(q);if(!X){let x=this.ybase+this.y;if(x>=$&&x<$+M.length)continue}let z=M[M.length-1].getTrimmedLength(),T=JC(M,this._cols,U),A=T.length-M.length,L;this.ybase===0&&this.y!==this.lines.length-1?L=Math.max(0,this.y-this.lines.maxLength+A):L=Math.max(0,this.lines.length-this.lines.maxLength+A);let E=[];for(let x=0;x<A;x++){let N=this.getBlankLine(I1,!0);E.push(N)}E.length>0&&(K.push({start:$+M.length+F,newLines:E}),F+=E.length),M.push(...E);let S=T.length-1,j=T[S];j===0&&(S--,j=T[S]);let k=M.length-A-1,B=z;for(;k>=0;){let x=Math.min(B,j);if(M[S]===void 0)break;if(M[S].copyCellsFrom(M[k],B-x,j-x,x,!0),j-=x,j===0&&(S--,j=T[S]),B-=x,B===0){k--;let N=Math.max(k,0);B=WX(M,N,this._cols)}}for(let x=0;x<M.length;x++)T[x]<U&&M[x].setCell(T[x],Q);let v=A-L;for(;v-- >0;)this.ybase===0?this.y<Z-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+F)-Z&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+A,this.ybase+Z-1)}if(K.length>0){let $=[],q=[];for(let j=0;j<this.lines.length;j++)q.push(this.lines.get(j));let M=this.lines.length,z=M-1,T=0,A=K[T];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+F);let L=0;for(let j=Math.min(this.lines.maxLength-1,M+F-1);j>=0;j--)if(A&&A.start>z+L){for(let k=A.newLines.length-1;k>=0;k--)this.lines.set(j--,A.newLines[k]);j++,$.push({index:z+1,amount:A.newLines.length}),L+=A.newLines.length,A=K[++T]}else this.lines.set(j,q[z--]);let E=0;for(let j=$.length-1;j>=0;j--)$[j].index+=E,this.lines.onInsertEmitter.fire($[j]),E+=$[j].amount;let S=Math.max(0,M+F-this.lines.maxLength);S>0&&this.lines.onTrimEmitter.fire(S)}}translateBufferLineToString(U,Z,X=0,Q){let K=this.lines.get(U);return K?K.translateToString(Z,X,Q):""}getWrappedRangeForLine(U){let Z=U,X=U;for(;Z>0&&this.lines.get(Z).isWrapped;)Z--;for(;X+1<this.lines.length&&this.lines.get(X+1).isWrapped;)X++;return{first:Z,last:X}}setupTabStops(U){for(U!=null?this.tabs[U]||(U=this.prevStop(U)):(this.tabs={},U=0);U<this._cols;U+=this._optionsService.rawOptions.tabStopWidth)this.tabs[U]=!0}prevStop(U){for(U==null&&(U=this.x);!this.tabs[--U]&&U>0;);return U>=this._cols?this._cols-1:U<0?0:U}nextStop(U){for(U==null&&(U=this.x);!this.tabs[++U]&&U<this._cols;);return U>=this._cols?this._cols-1:U<0?0:U}clearMarkers(U){this._isClearing=!0;for(let Z=0;Z<this.markers.length;Z++)this.markers[Z].line===U&&(this.markers[Z].dispose(),this.markers.splice(Z--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let U=0;U<this.markers.length;U++)this.markers[U].dispose();this.markers.length=0,this._isClearing=!1}addMarker(U){let Z=new QC(U);return this.markers.push(Z),Z.register(this.lines.onTrim((X)=>{Z.line-=X,Z.line<0&&Z.dispose()})),Z.register(this.lines.onInsert((X)=>{Z.line>=X.index&&(Z.line+=X.amount)})),Z.register(this.lines.onDelete((X)=>{Z.line>=X.index&&Z.line<X.index+X.amount&&Z.dispose(),Z.line>X.index&&(Z.line-=X.amount)})),Z.register(Z.onDispose(()=>this._removeMarker(Z))),Z}_removeMarker(U){this._isClearing||this.markers.splice(this.markers.indexOf(U),1)}},GC=class extends d0{constructor(U,Z){super();this._optionsService=U,this._bufferService=Z,this._onBufferActivate=this._register(new w0),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new w$(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new w$(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(U){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(U),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(U,Z){this._normal.resize(U,Z),this._alt.resize(U,Z),this.setupTabStops(U)}setupTabStops(U){this._normal.setupTabStops(U),this._alt.setupTabStops(U)}},yK=2,cK=1,tJ=class extends d0{constructor(U){super();this.isUserScrolling=!1,this._onResize=this._register(new w0),this.onResize=this._onResize.event,this._onScroll=this._register(new w0),this.onScroll=this._onScroll.event,this.cols=Math.max(U.rawOptions.cols||0,yK),this.rows=Math.max(U.rawOptions.rows||0,cK),this.buffers=this._register(new GC(U,this)),this._register(this.buffers.onBufferActivate((Z)=>{this._onScroll.fire(Z.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(U,Z){let X=this.cols!==U,Q=this.rows!==Z;this.cols=U,this.rows=Z,this.buffers.resize(U,Z),this._onResize.fire({cols:U,rows:Z,colsChanged:X,rowsChanged:Q})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(U,Z=!1){let X=this.buffer,Q;Q=this._cachedBlankLine,(!Q||Q.length!==this.cols||Q.getFg(0)!==U.fg||Q.getBg(0)!==U.bg)&&(Q=X.getBlankLine(U,Z),this._cachedBlankLine=Q),Q.isWrapped=Z;let K=X.ybase+X.scrollTop,F=X.ybase+X.scrollBottom;if(X.scrollTop===0){let $=X.lines.isFull;F===X.lines.length-1?$?X.lines.recycle().copyFrom(Q):X.lines.push(Q.clone()):X.lines.splice(F+1,0,Q.clone()),$?this.isUserScrolling&&(X.ydisp=Math.max(X.ydisp-1,0)):(X.ybase++,this.isUserScrolling||X.ydisp++)}else{let $=F-K+1;X.lines.shiftElements(K+1,$-1,-1),X.lines.set(F,Q.clone())}this.isUserScrolling||(X.ydisp=X.ybase),this._onScroll.fire(X.ydisp)}scrollLines(U,Z){let X=this.buffer;if(U<0){if(X.ydisp===0)return;this.isUserScrolling=!0}else U+X.ydisp>=X.ybase&&(this.isUserScrolling=!1);let Q=X.ydisp;X.ydisp=Math.max(Math.min(X.ydisp+U,X.ybase),0),Q!==X.ydisp&&(Z||this._onScroll.fire(X.ydisp))}};tJ=$1([c0(0,a1)],tJ);var TZ={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1000,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:UY,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},VC=["normal","bold","100","200","300","400","500","600","700","800","900"],$C=class extends d0{constructor(U){super();this._onOptionChange=this._register(new w0),this.onOptionChange=this._onOptionChange.event;let Z={...TZ};for(let X in U)if(X in Z)try{let Q=U[X];Z[X]=this._sanitizeAndValidateOption(X,Q)}catch(Q){console.error(Q)}this.rawOptions=Z,this.options={...Z},this._setupOptions(),this._register(U1(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(U,Z){return this.onOptionChange((X)=>{X===U&&Z(this.rawOptions[U])})}onMultipleOptionChange(U,Z){return this.onOptionChange((X)=>{U.indexOf(X)!==-1&&Z()})}_setupOptions(){let U=(X)=>{if(!(X in TZ))throw Error(`No option with key "${X}"`);return this.rawOptions[X]},Z=(X,Q)=>{if(!(X in TZ))throw Error(`No option with key "${X}"`);Q=this._sanitizeAndValidateOption(X,Q),this.rawOptions[X]!==Q&&(this.rawOptions[X]=Q,this._onOptionChange.fire(X))};for(let X in this.rawOptions){let Q={get:U.bind(this,X),set:Z.bind(this,X)};Object.defineProperty(this.options,X,Q)}}_sanitizeAndValidateOption(U,Z){switch(U){case"cursorStyle":if(Z||(Z=TZ[U]),!KC(Z))throw Error(`"${Z}" is not a valid value for ${U}`);break;case"wordSeparator":Z||(Z=TZ[U]);break;case"fontWeight":case"fontWeightBold":if(typeof Z=="number"&&1<=Z&&Z<=1000)break;Z=VC.includes(Z)?Z:TZ[U];break;case"cursorWidth":Z=Math.floor(Z);case"lineHeight":case"tabStopWidth":if(Z<1)throw Error(`${U} cannot be less than 1, value: ${Z}`);break;case"minimumContrastRatio":Z=Math.max(1,Math.min(21,Math.round(Z*10)/10));break;case"scrollback":if(Z=Math.min(Z,4294967295),Z<0)throw Error(`${U} cannot be less than 0, value: ${Z}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(Z<=0)throw Error(`${U} cannot be less than or equal to 0, value: ${Z}`);break;case"rows":case"cols":if(!Z&&Z!==0)throw Error(`${U} must be numeric, value: ${Z}`);break;case"windowsPty":Z=Z??{};break}return Z}};function KC(U){return U==="block"||U==="underline"||U==="bar"}function YX(U,Z=5){if(typeof U!="object")return U;let X=Array.isArray(U)?[]:{};for(let Q in U)X[Q]=Z<=1?U[Q]:U[Q]&&YX(U[Q],Z-1);return X}var y$=Object.freeze({insertMode:!1}),c$=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),iJ=class extends d0{constructor(U,Z,X){super();this._bufferService=U,this._logService=Z,this._optionsService=X,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new w0),this.onData=this._onData.event,this._onUserInput=this._register(new w0),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new w0),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new w0),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=YX(y$),this.decPrivateModes=YX(c$)}reset(){this.modes=YX(y$),this.decPrivateModes=YX(c$)}triggerDataEvent(U,Z=!1){if(this._optionsService.rawOptions.disableStdin)return;let X=this._bufferService.buffer;Z&&this._optionsService.rawOptions.scrollOnUserInput&&X.ybase!==X.ydisp&&this._onRequestScrollToBottom.fire(),Z&&this._onUserInput.fire(),this._logService.debug(`sending data "${U}"`),this._logService.trace("sending data (codes)",()=>U.split("").map((Q)=>Q.charCodeAt(0))),this._onData.fire(U)}triggerBinaryEvent(U){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${U}"`),this._logService.trace("sending binary (codes)",()=>U.split("").map((Z)=>Z.charCodeAt(0))),this._onBinary.fire(U))}};iJ=$1([c0(0,r1),c0(1,GK),c0(2,a1)],iJ);var p$={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:(U)=>U.button===4||U.action!==1?!1:(U.ctrl=!1,U.alt=!1,U.shift=!1,!0)},VT200:{events:19,restrict:(U)=>U.action!==32},DRAG:{events:23,restrict:(U)=>!(U.action===32&&U.button===3)},ANY:{events:31,restrict:(U)=>!0}};function TJ(U,Z){let X=(U.ctrl?16:0)|(U.shift?4:0)|(U.alt?8:0);return U.button===4?(X|=64,X|=U.action):(X|=U.button&3,U.button&4&&(X|=64),U.button&8&&(X|=128),U.action===32?X|=32:U.action===0&&!Z&&(X|=3)),X}var RJ=String.fromCharCode,h$={DEFAULT:(U)=>{let Z=[TJ(U,!1)+32,U.col+32,U.row+32];return Z[0]>255||Z[1]>255||Z[2]>255?"":`\x1B[M${RJ(Z[0])}${RJ(Z[1])}${RJ(Z[2])}`},SGR:(U)=>{let Z=U.action===0&&U.button!==4?"m":"M";return`\x1B[<${TJ(U,!0)};${U.col};${U.row}${Z}`},SGR_PIXELS:(U)=>{let Z=U.action===0&&U.button!==4?"m":"M";return`\x1B[<${TJ(U,!0)};${U.x};${U.y}${Z}`}},eJ=class extends d0{constructor(U,Z,X){super();this._bufferService=U,this._coreService=Z,this._optionsService=X,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new w0),this.onProtocolChange=this._onProtocolChange.event;for(let Q of Object.keys(p$))this.addProtocol(Q,p$[Q]);for(let Q of Object.keys(h$))this.addEncoding(Q,h$[Q]);this.reset()}addProtocol(U,Z){this._protocols[U]=Z}addEncoding(U,Z){this._encodings[U]=Z}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(U){if(!this._protocols[U])throw Error(`unknown protocol "${U}"`);this._activeProtocol=U,this._onProtocolChange.fire(this._protocols[U].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(U){if(!this._encodings[U])throw Error(`unknown encoding "${U}"`);this._activeEncoding=U}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(U,Z,X){if(U.deltaY===0||U.shiftKey||Z===void 0||X===void 0)return 0;let Q=Z/X,K=this._applyScrollModifier(U.deltaY,U);return U.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(K/=Q+0,Math.abs(U.deltaY)<50&&(K*=0.3),this._wheelPartialScroll+=K,K=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):U.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(K*=this._bufferService.rows),K}_applyScrollModifier(U,Z){return Z.altKey||Z.ctrlKey||Z.shiftKey?U*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:U*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(U){if(U.col<0||U.col>=this._bufferService.cols||U.row<0||U.row>=this._bufferService.rows||U.button===4&&U.action===32||U.button===3&&U.action!==32||U.button!==4&&(U.action===2||U.action===3)||(U.col++,U.row++,U.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,U,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(U))return!1;let Z=this._encodings[this._activeEncoding](U);return Z&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(Z):this._coreService.triggerDataEvent(Z,!0)),this._lastEvent=U,!0}explainEvents(U){return{down:!!(U&1),up:!!(U&2),drag:!!(U&4),move:!!(U&8),wheel:!!(U&16)}}_equalEvents(U,Z,X){if(X){if(U.x!==Z.x||U.y!==Z.y)return!1}else if(U.col!==Z.col||U.row!==Z.row)return!1;return!(U.button!==Z.button||U.action!==Z.action||U.ctrl!==Z.ctrl||U.alt!==Z.alt||U.shift!==Z.shift)}};eJ=$1([c0(0,r1),c0(1,KZ),c0(2,a1)],eJ);var EJ=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],WC=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],j1;function IC(U,Z){let X=0,Q=Z.length-1,K;if(U<Z[0][0]||U>Z[Q][1])return!1;for(;Q>=X;)if(K=X+Q>>1,U>Z[K][1])X=K+1;else if(U<Z[K][0])Q=K-1;else return!0;return!1}var FC=class{constructor(){if(this.version="6",!j1){j1=new Uint8Array(65536),j1.fill(1),j1[0]=0,j1.fill(0,1,32),j1.fill(0,127,160),j1.fill(2,4352,4448),j1[9001]=2,j1[9002]=2,j1.fill(2,11904,42192),j1[12351]=1,j1.fill(2,44032,55204),j1.fill(2,63744,64256),j1.fill(2,65040,65050),j1.fill(2,65072,65136),j1.fill(2,65280,65377),j1.fill(2,65504,65511);for(let U=0;U<EJ.length;++U)j1.fill(0,EJ[U][0],EJ[U][1]+1)}}wcwidth(U){return U<32?0:U<127?1:U<65536?j1[U]:IC(U,WC)?0:U>=131072&&U<=196605||U>=196608&&U<=262141?2:1}charProperties(U,Z){let X=this.wcwidth(U),Q=X===0&&Z!==0;if(Q){let K=QZ.extractWidth(Z);K===0?Q=!1:K>X&&(X=K)}return QZ.createPropertyValue(0,X,Q)}},QZ=class U{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new w0,this.onChange=this._onChange.event;let Z=new FC;this.register(Z),this._active=Z.version,this._activeProvider=Z}static extractShouldJoin(Z){return(Z&1)!==0}static extractWidth(Z){return Z>>1&3}static extractCharKind(Z){return Z>>3}static createPropertyValue(Z,X,Q=!1){return(Z&16777215)<<3|(X&3)<<1|(Q?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(Z){if(!this._providers[Z])throw Error(`unknown Unicode version "${Z}"`);this._active=Z,this._activeProvider=this._providers[Z],this._onChange.fire(Z)}register(Z){this._providers[Z.version]=Z}wcwidth(Z){return this._activeProvider.wcwidth(Z)}getStringCellWidth(Z){let X=0,Q=0,K=Z.length;for(let F=0;F<K;++F){let $=Z.charCodeAt(F);if(55296<=$&&$<=56319){if(++F>=K)return X+this.wcwidth($);let z=Z.charCodeAt(F);56320<=z&&z<=57343?$=($-55296)*1024+z-56320+65536:X+=this.wcwidth(z)}let q=this.charProperties($,Q),M=U.extractWidth(q);U.extractShouldJoin(q)&&(M-=U.extractWidth(Q)),X+=M,Q=q}return X}charProperties(Z,X){return this._activeProvider.charProperties(Z,X)}},HC=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(U){this.glevel=U,this.charset=this._charsets[U]}setgCharset(U,Z){this._charsets[U]=Z,this.glevel===U&&(this.charset=Z)}};function u$(U){let Z=U.buffer.lines.get(U.buffer.ybase+U.buffer.y-1)?.get(U.cols-1),X=U.buffer.lines.get(U.buffer.ybase+U.buffer.y);X&&Z&&(X.isWrapped=Z[3]!==0&&Z[3]!==32)}var aZ=2147483647,OC=256,pK=class U{constructor(Z=32,X=32){if(this.maxLength=Z,this.maxSubParamsLength=X,X>OC)throw Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(Z),this.length=0,this._subParams=new Int32Array(X),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(Z),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(Z){let X=new U;if(!Z.length)return X;for(let Q=Array.isArray(Z[0])?1:0;Q<Z.length;++Q){let K=Z[Q];if(Array.isArray(K))for(let F=0;F<K.length;++F)X.addSubParam(K[F]);else X.addParam(K)}return X}clone(){let Z=new U(this.maxLength,this.maxSubParamsLength);return Z.params.set(this.params),Z.length=this.length,Z._subParams.set(this._subParams),Z._subParamsLength=this._subParamsLength,Z._subParamsIdx.set(this._subParamsIdx),Z._rejectDigits=this._rejectDigits,Z._rejectSubDigits=this._rejectSubDigits,Z._digitIsSub=this._digitIsSub,Z}toArray(){let Z=[];for(let X=0;X<this.length;++X){Z.push(this.params[X]);let Q=this._subParamsIdx[X]>>8,K=this._subParamsIdx[X]&255;K-Q>0&&Z.push(Array.prototype.slice.call(this._subParams,Q,K))}return Z}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(Z){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(Z<-1)throw Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=Z>aZ?aZ:Z}addSubParam(Z){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(Z<-1)throw Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=Z>aZ?aZ:Z,this._subParamsIdx[this.length-1]++}}hasSubParams(Z){return(this._subParamsIdx[Z]&255)-(this._subParamsIdx[Z]>>8)>0}getSubParams(Z){let X=this._subParamsIdx[Z]>>8,Q=this._subParamsIdx[Z]&255;return Q-X>0?this._subParams.subarray(X,Q):null}getSubParamsAll(){let Z={};for(let X=0;X<this.length;++X){let Q=this._subParamsIdx[X]>>8,K=this._subParamsIdx[X]&255;K-Q>0&&(Z[X]=this._subParams.slice(Q,K))}return Z}addDigit(Z){let X;if(this._rejectDigits||!(X=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let Q=this._digitIsSub?this._subParams:this.params,K=Q[X-1];Q[X-1]=~K?Math.min(K*10+Z,aZ):Z}},tZ=[],CC=class{constructor(){this._state=0,this._active=tZ,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(U,Z){this._handlers[U]===void 0&&(this._handlers[U]=[]);let X=this._handlers[U];return X.push(Z),{dispose:()=>{let Q=X.indexOf(Z);Q!==-1&&X.splice(Q,1)}}}clearHandler(U){this._handlers[U]&&delete this._handlers[U]}setHandlerFallback(U){this._handlerFb=U}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=tZ}reset(){if(this._state===2)for(let U=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;U>=0;--U)this._active[U].end(!1);this._stack.paused=!1,this._active=tZ,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||tZ,!this._active.length)this._handlerFb(this._id,"START");else for(let U=this._active.length-1;U>=0;U--)this._active[U].start()}_put(U,Z,X){if(!this._active.length)this._handlerFb(this._id,"PUT",YY(U,Z,X));else for(let Q=this._active.length-1;Q>=0;Q--)this._active[Q].put(U,Z,X)}start(){this.reset(),this._state=1}put(U,Z,X){if(this._state!==3){if(this._state===1)for(;Z<X;){let Q=U[Z++];if(Q===59){this._state=2,this._start();break}if(Q<48||57<Q){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+Q-48}this._state===2&&X-Z>0&&this._put(U,Z,X)}}end(U,Z=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",U);else{let X=!1,Q=this._active.length-1,K=!1;if(this._stack.paused&&(Q=this._stack.loopPosition-1,X=Z,K=this._stack.fallThrough,this._stack.paused=!1),!K&&X===!1){for(;Q>=0&&(X=this._active[Q].end(U),X!==!0);Q--)if(X instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=Q,this._stack.fallThrough=!1,X;Q--}for(;Q>=0;Q--)if(X=this._active[Q].end(!1),X instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=Q,this._stack.fallThrough=!0,X}this._active=tZ,this._id=-1,this._state=0}}},GU=class{constructor(U){this._handler=U,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(U,Z,X){this._hitLimit||(this._data+=YY(U,Z,X),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(U){let Z=!1;if(this._hitLimit)Z=!1;else if(U&&(Z=this._handler(this._data),Z instanceof Promise))return Z.then((X)=>(this._data="",this._hitLimit=!1,X));return this._data="",this._hitLimit=!1,Z}},iZ=[],AC=class{constructor(){this._handlers=Object.create(null),this._active=iZ,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=iZ}registerHandler(U,Z){this._handlers[U]===void 0&&(this._handlers[U]=[]);let X=this._handlers[U];return X.push(Z),{dispose:()=>{let Q=X.indexOf(Z);Q!==-1&&X.splice(Q,1)}}}clearHandler(U){this._handlers[U]&&delete this._handlers[U]}setHandlerFallback(U){this._handlerFb=U}reset(){if(this._active.length)for(let U=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;U>=0;--U)this._active[U].unhook(!1);this._stack.paused=!1,this._active=iZ,this._ident=0}hook(U,Z){if(this.reset(),this._ident=U,this._active=this._handlers[U]||iZ,!this._active.length)this._handlerFb(this._ident,"HOOK",Z);else for(let X=this._active.length-1;X>=0;X--)this._active[X].hook(Z)}put(U,Z,X){if(!this._active.length)this._handlerFb(this._ident,"PUT",YY(U,Z,X));else for(let Q=this._active.length-1;Q>=0;Q--)this._active[Q].put(U,Z,X)}unhook(U,Z=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",U);else{let X=!1,Q=this._active.length-1,K=!1;if(this._stack.paused&&(Q=this._stack.loopPosition-1,X=Z,K=this._stack.fallThrough,this._stack.paused=!1),!K&&X===!1){for(;Q>=0&&(X=this._active[Q].unhook(U),X!==!0);Q--)if(X instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=Q,this._stack.fallThrough=!1,X;Q--}for(;Q>=0;Q--)if(X=this._active[Q].unhook(!1),X instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=Q,this._stack.fallThrough=!0,X}this._active=iZ,this._ident=0}},JX=new pK;JX.addParam(0);var b$=class{constructor(U){this._handler=U,this._data="",this._params=JX,this._hitLimit=!1}hook(U){this._params=U.length>1||U.params[0]?U.clone():JX,this._data="",this._hitLimit=!1}put(U,Z,X){this._hitLimit||(this._data+=YY(U,Z,X),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(U){let Z=!1;if(this._hitLimit)Z=!1;else if(U&&(Z=this._handler(this._data,this._params),Z instanceof Promise))return Z.then((X)=>(this._params=JX,this._data="",this._hitLimit=!1,X));return this._params=JX,this._data="",this._hitLimit=!1,Z}},zC=class{constructor(U){this.table=new Uint8Array(U)}setDefault(U,Z){this.table.fill(U<<4|Z)}add(U,Z,X,Q){this.table[Z<<8|U]=X<<4|Q}addMany(U,Z,X,Q){for(let K=0;K<U.length;K++)this.table[Z<<8|U[K]]=X<<4|Q}},FU=160,DC=function(){let U=new zC(4095),Z=Array.apply(null,Array(256)).map((q,M)=>M),X=(q,M)=>Z.slice(q,M),Q=X(32,127),K=X(0,24);K.push(25),K.push.apply(K,X(28,32));let F=X(0,14),$;U.setDefault(1,0),U.addMany(Q,0,2,0);for($ in F)U.addMany([24,26,153,154],$,3,0),U.addMany(X(128,144),$,3,0),U.addMany(X(144,152),$,3,0),U.add(156,$,0,0),U.add(27,$,11,1),U.add(157,$,4,8),U.addMany([152,158,159],$,0,7),U.add(155,$,11,3),U.add(144,$,11,9);return U.addMany(K,0,3,0),U.addMany(K,1,3,1),U.add(127,1,0,1),U.addMany(K,8,0,8),U.addMany(K,3,3,3),U.add(127,3,0,3),U.addMany(K,4,3,4),U.add(127,4,0,4),U.addMany(K,6,3,6),U.addMany(K,5,3,5),U.add(127,5,0,5),U.addMany(K,2,3,2),U.add(127,2,0,2),U.add(93,1,4,8),U.addMany(Q,8,5,8),U.add(127,8,5,8),U.addMany([156,27,24,26,7],8,6,0),U.addMany(X(28,32),8,0,8),U.addMany([88,94,95],1,0,7),U.addMany(Q,7,0,7),U.addMany(K,7,0,7),U.add(156,7,0,0),U.add(127,7,0,7),U.add(91,1,11,3),U.addMany(X(64,127),3,7,0),U.addMany(X(48,60),3,8,4),U.addMany([60,61,62,63],3,9,4),U.addMany(X(48,60),4,8,4),U.addMany(X(64,127),4,7,0),U.addMany([60,61,62,63],4,0,6),U.addMany(X(32,64),6,0,6),U.add(127,6,0,6),U.addMany(X(64,127),6,0,0),U.addMany(X(32,48),3,9,5),U.addMany(X(32,48),5,9,5),U.addMany(X(48,64),5,0,6),U.addMany(X(64,127),5,7,0),U.addMany(X(32,48),4,9,5),U.addMany(X(32,48),1,9,2),U.addMany(X(32,48),2,9,2),U.addMany(X(48,127),2,10,0),U.addMany(X(48,80),1,10,0),U.addMany(X(81,88),1,10,0),U.addMany([89,90,92],1,10,0),U.addMany(X(96,127),1,10,0),U.add(80,1,11,9),U.addMany(K,9,0,9),U.add(127,9,0,9),U.addMany(X(28,32),9,0,9),U.addMany(X(32,48),9,9,12),U.addMany(X(48,60),9,8,10),U.addMany([60,61,62,63],9,9,10),U.addMany(K,11,0,11),U.addMany(X(32,128),11,0,11),U.addMany(X(28,32),11,0,11),U.addMany(K,10,0,10),U.add(127,10,0,10),U.addMany(X(28,32),10,0,10),U.addMany(X(48,60),10,8,10),U.addMany([60,61,62,63],10,0,11),U.addMany(X(32,48),10,9,12),U.addMany(K,12,0,12),U.add(127,12,0,12),U.addMany(X(28,32),12,0,12),U.addMany(X(32,48),12,9,12),U.addMany(X(48,64),12,0,11),U.addMany(X(64,127),12,12,13),U.addMany(X(64,127),10,12,13),U.addMany(X(64,127),9,12,13),U.addMany(K,13,13,13),U.addMany(Q,13,13,13),U.add(127,13,0,13),U.addMany([27,156,24,26],13,14,0),U.add(FU,0,2,0),U.add(FU,8,5,8),U.add(FU,6,0,6),U.add(FU,11,0,11),U.add(FU,13,13,13),U}(),qC=class extends d0{constructor(U=DC){super();this._transitions=U,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new pK,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(Z,X,Q)=>{},this._executeHandlerFb=(Z)=>{},this._csiHandlerFb=(Z,X)=>{},this._escHandlerFb=(Z)=>{},this._errorHandlerFb=(Z)=>Z,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(U1(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new CC),this._dcsParser=this._register(new AC),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(U,Z=[64,126]){let X=0;if(U.prefix){if(U.prefix.length>1)throw Error("only one byte as prefix supported");if(X=U.prefix.charCodeAt(0),X&&60>X||X>63)throw Error("prefix must be in range 0x3c .. 0x3f")}if(U.intermediates){if(U.intermediates.length>2)throw Error("only two bytes as intermediates are supported");for(let K=0;K<U.intermediates.length;++K){let F=U.intermediates.charCodeAt(K);if(32>F||F>47)throw Error("intermediate must be in range 0x20 .. 0x2f");X<<=8,X|=F}}if(U.final.length!==1)throw Error("final must be a single byte");let Q=U.final.charCodeAt(0);if(Z[0]>Q||Q>Z[1])throw Error(`final must be in range ${Z[0]} .. ${Z[1]}`);return X<<=8,X|=Q,X}identToString(U){let Z=[];for(;U;)Z.push(String.fromCharCode(U&255)),U>>=8;return Z.reverse().join("")}setPrintHandler(U){this._printHandler=U}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(U,Z){let X=this._identifier(U,[48,126]);this._escHandlers[X]===void 0&&(this._escHandlers[X]=[]);let Q=this._escHandlers[X];return Q.push(Z),{dispose:()=>{let K=Q.indexOf(Z);K!==-1&&Q.splice(K,1)}}}clearEscHandler(U){this._escHandlers[this._identifier(U,[48,126])]&&delete this._escHandlers[this._identifier(U,[48,126])]}setEscHandlerFallback(U){this._escHandlerFb=U}setExecuteHandler(U,Z){this._executeHandlers[U.charCodeAt(0)]=Z}clearExecuteHandler(U){this._executeHandlers[U.charCodeAt(0)]&&delete this._executeHandlers[U.charCodeAt(0)]}setExecuteHandlerFallback(U){this._executeHandlerFb=U}registerCsiHandler(U,Z){let X=this._identifier(U);this._csiHandlers[X]===void 0&&(this._csiHandlers[X]=[]);let Q=this._csiHandlers[X];return Q.push(Z),{dispose:()=>{let K=Q.indexOf(Z);K!==-1&&Q.splice(K,1)}}}clearCsiHandler(U){this._csiHandlers[this._identifier(U)]&&delete this._csiHandlers[this._identifier(U)]}setCsiHandlerFallback(U){this._csiHandlerFb=U}registerDcsHandler(U,Z){return this._dcsParser.registerHandler(this._identifier(U),Z)}clearDcsHandler(U){this._dcsParser.clearHandler(this._identifier(U))}setDcsHandlerFallback(U){this._dcsParser.setHandlerFallback(U)}registerOscHandler(U,Z){return this._oscParser.registerHandler(U,Z)}clearOscHandler(U){this._oscParser.clearHandler(U)}setOscHandlerFallback(U){this._oscParser.setHandlerFallback(U)}setErrorHandler(U){this._errorHandler=U}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(U,Z,X,Q,K){this._parseStack.state=U,this._parseStack.handlers=Z,this._parseStack.handlerPos=X,this._parseStack.transition=Q,this._parseStack.chunkPos=K}parse(U,Z,X){let Q=0,K=0,F=0,$;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,F=this._parseStack.chunkPos+1;else{if(X===void 0||this._parseStack.state===1)throw this._parseStack.state=1,Error("improper continuation due to previous async handler, giving up parsing");let q=this._parseStack.handlers,M=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(X===!1&&M>-1){for(;M>=0&&($=q[M](this._params),$!==!0);M--)if($ instanceof Promise)return this._parseStack.handlerPos=M,$}this._parseStack.handlers=[];break;case 4:if(X===!1&&M>-1){for(;M>=0&&($=q[M](),$!==!0);M--)if($ instanceof Promise)return this._parseStack.handlerPos=M,$}this._parseStack.handlers=[];break;case 6:if(Q=U[this._parseStack.chunkPos],$=this._dcsParser.unhook(Q!==24&&Q!==26,X),$)return $;Q===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(Q=U[this._parseStack.chunkPos],$=this._oscParser.end(Q!==24&&Q!==26,X),$)return $;Q===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,F=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let q=F;q<Z;++q){switch(Q=U[q],K=this._transitions.table[this.currentState<<8|(Q<160?Q:FU)],K>>4){case 2:for(let L=q+1;;++L){if(L>=Z||(Q=U[L])<32||Q>126&&Q<FU){this._printHandler(U,q,L),q=L-1;break}if(++L>=Z||(Q=U[L])<32||Q>126&&Q<FU){this._printHandler(U,q,L),q=L-1;break}if(++L>=Z||(Q=U[L])<32||Q>126&&Q<FU){this._printHandler(U,q,L),q=L-1;break}if(++L>=Z||(Q=U[L])<32||Q>126&&Q<FU){this._printHandler(U,q,L),q=L-1;break}}break;case 3:this._executeHandlers[Q]?this._executeHandlers[Q]():this._executeHandlerFb(Q),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:q,code:Q,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let M=this._csiHandlers[this._collect<<8|Q],z=M?M.length-1:-1;for(;z>=0&&($=M[z](this._params),$!==!0);z--)if($ instanceof Promise)return this._preserveStack(3,M,z,K,q),$;z<0&&this._csiHandlerFb(this._collect<<8|Q,this._params),this.precedingJoinState=0;break;case 8:do switch(Q){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(Q-48)}while(++q<Z&&(Q=U[q])>47&&Q<60);q--;break;case 9:this._collect<<=8,this._collect|=Q;break;case 10:let T=this._escHandlers[this._collect<<8|Q],A=T?T.length-1:-1;for(;A>=0&&($=T[A](),$!==!0);A--)if($ instanceof Promise)return this._preserveStack(4,T,A,K,q),$;A<0&&this._escHandlerFb(this._collect<<8|Q),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|Q,this._params);break;case 13:for(let L=q+1;;++L)if(L>=Z||(Q=U[L])===24||Q===26||Q===27||Q>127&&Q<FU){this._dcsParser.put(U,q,L),q=L-1;break}break;case 14:if($=this._dcsParser.unhook(Q!==24&&Q!==26),$)return this._preserveStack(6,[],0,K,q),$;Q===27&&(K|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let L=q+1;;L++)if(L>=Z||(Q=U[L])<32||Q>127&&Q<FU){this._oscParser.put(U,q,L),q=L-1;break}break;case 6:if($=this._oscParser.end(Q!==24&&Q!==26),$)return this._preserveStack(5,[],0,K,q),$;Q===27&&(K|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=K&15}}},MC=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,LC=/^[\da-f]+$/;function d$(U){if(!U)return;let Z=U.toLowerCase();if(Z.indexOf("rgb:")===0){Z=Z.slice(4);let X=MC.exec(Z);if(X){let Q=X[1]?15:X[4]?255:X[7]?4095:65535;return[Math.round(parseInt(X[1]||X[4]||X[7]||X[10],16)/Q*255),Math.round(parseInt(X[2]||X[5]||X[8]||X[11],16)/Q*255),Math.round(parseInt(X[3]||X[6]||X[9]||X[12],16)/Q*255)]}}else if(Z.indexOf("#")===0&&(Z=Z.slice(1),LC.exec(Z)&&[3,6,9,12].includes(Z.length))){let X=Z.length/3,Q=[0,0,0];for(let K=0;K<3;++K){let F=parseInt(Z.slice(X*K,X*K+X),16);Q[K]=X===1?F<<4:X===2?F:X===3?F>>4:F>>8}return Q}}function SJ(U,Z){let X=U.toString(16),Q=X.length<2?"0"+X:X;switch(Z){case 4:return X[0];case 8:return Q;case 12:return(Q+Q).slice(0,3);default:return Q+Q}}function TC(U,Z=16){let[X,Q,K]=U;return`rgb:${SJ(X,Z)}/${SJ(Q,Z)}/${SJ(K,Z)}`}var RC={"(":0,")":1,"*":2,"+":3,"-":1,".":2},dU=131072,l$=10;function o$(U,Z){if(U>24)return Z.setWinLines||!1;switch(U){case 1:return!!Z.restoreWin;case 2:return!!Z.minimizeWin;case 3:return!!Z.setWinPosition;case 4:return!!Z.setWinSizePixels;case 5:return!!Z.raiseWin;case 6:return!!Z.lowerWin;case 7:return!!Z.refreshWin;case 8:return!!Z.setWinSizeChars;case 9:return!!Z.maximizeWin;case 10:return!!Z.fullscreenWin;case 11:return!!Z.getWinState;case 13:return!!Z.getWinPosition;case 14:return!!Z.getWinSizePixels;case 15:return!!Z.getScreenSizePixels;case 16:return!!Z.getCellSizePixels;case 18:return!!Z.getWinSizeChars;case 19:return!!Z.getScreenSizeChars;case 20:return!!Z.getIconTitle;case 21:return!!Z.getWinTitle;case 22:return!!Z.pushTitle;case 23:return!!Z.popTitle;case 24:return!!Z.setWinLines}return!1}var n$=5000,m$=0,EC=class extends d0{constructor(U,Z,X,Q,K,F,$,q,M=new qC){super();this._bufferService=U,this._charsetService=Z,this._coreService=X,this._logService=Q,this._optionsService=K,this._oscLinkService=F,this._coreMouseService=$,this._unicodeService=q,this._parser=M,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new CO,this._utf8Decoder=new AO,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=I1.clone(),this._eraseAttrDataInternal=I1.clone(),this._onRequestBell=this._register(new w0),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new w0),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new w0),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new w0),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new w0),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new w0),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new w0),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new w0),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new w0),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new w0),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new w0),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new w0),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new w0),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new UQ(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate((z)=>this._activeBuffer=z.activeBuffer)),this._parser.setCsiHandlerFallback((z,T)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(z),params:T.toArray()})}),this._parser.setEscHandlerFallback((z)=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(z)})}),this._parser.setExecuteHandlerFallback((z)=>{this._logService.debug("Unknown EXECUTE code: ",{code:z})}),this._parser.setOscHandlerFallback((z,T,A)=>{this._logService.debug("Unknown OSC code: ",{identifier:z,action:T,data:A})}),this._parser.setDcsHandlerFallback((z,T,A)=>{T==="HOOK"&&(A=A.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(z),action:T,payload:A})}),this._parser.setPrintHandler((z,T,A)=>this.print(z,T,A)),this._parser.registerCsiHandler({final:"@"},(z)=>this.insertChars(z)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(z)=>this.scrollLeft(z)),this._parser.registerCsiHandler({final:"A"},(z)=>this.cursorUp(z)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(z)=>this.scrollRight(z)),this._parser.registerCsiHandler({final:"B"},(z)=>this.cursorDown(z)),this._parser.registerCsiHandler({final:"C"},(z)=>this.cursorForward(z)),this._parser.registerCsiHandler({final:"D"},(z)=>this.cursorBackward(z)),this._parser.registerCsiHandler({final:"E"},(z)=>this.cursorNextLine(z)),this._parser.registerCsiHandler({final:"F"},(z)=>this.cursorPrecedingLine(z)),this._parser.registerCsiHandler({final:"G"},(z)=>this.cursorCharAbsolute(z)),this._parser.registerCsiHandler({final:"H"},(z)=>this.cursorPosition(z)),this._parser.registerCsiHandler({final:"I"},(z)=>this.cursorForwardTab(z)),this._parser.registerCsiHandler({final:"J"},(z)=>this.eraseInDisplay(z,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},(z)=>this.eraseInDisplay(z,!0)),this._parser.registerCsiHandler({final:"K"},(z)=>this.eraseInLine(z,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},(z)=>this.eraseInLine(z,!0)),this._parser.registerCsiHandler({final:"L"},(z)=>this.insertLines(z)),this._parser.registerCsiHandler({final:"M"},(z)=>this.deleteLines(z)),this._parser.registerCsiHandler({final:"P"},(z)=>this.deleteChars(z)),this._parser.registerCsiHandler({final:"S"},(z)=>this.scrollUp(z)),this._parser.registerCsiHandler({final:"T"},(z)=>this.scrollDown(z)),this._parser.registerCsiHandler({final:"X"},(z)=>this.eraseChars(z)),this._parser.registerCsiHandler({final:"Z"},(z)=>this.cursorBackwardTab(z)),this._parser.registerCsiHandler({final:"`"},(z)=>this.charPosAbsolute(z)),this._parser.registerCsiHandler({final:"a"},(z)=>this.hPositionRelative(z)),this._parser.registerCsiHandler({final:"b"},(z)=>this.repeatPrecedingCharacter(z)),this._parser.registerCsiHandler({final:"c"},(z)=>this.sendDeviceAttributesPrimary(z)),this._parser.registerCsiHandler({prefix:">",final:"c"},(z)=>this.sendDeviceAttributesSecondary(z)),this._parser.registerCsiHandler({final:"d"},(z)=>this.linePosAbsolute(z)),this._parser.registerCsiHandler({final:"e"},(z)=>this.vPositionRelative(z)),this._parser.registerCsiHandler({final:"f"},(z)=>this.hVPosition(z)),this._parser.registerCsiHandler({final:"g"},(z)=>this.tabClear(z)),this._parser.registerCsiHandler({final:"h"},(z)=>this.setMode(z)),this._parser.registerCsiHandler({prefix:"?",final:"h"},(z)=>this.setModePrivate(z)),this._parser.registerCsiHandler({final:"l"},(z)=>this.resetMode(z)),this._parser.registerCsiHandler({prefix:"?",final:"l"},(z)=>this.resetModePrivate(z)),this._parser.registerCsiHandler({final:"m"},(z)=>this.charAttributes(z)),this._parser.registerCsiHandler({final:"n"},(z)=>this.deviceStatus(z)),this._parser.registerCsiHandler({prefix:"?",final:"n"},(z)=>this.deviceStatusPrivate(z)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(z)=>this.softReset(z)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(z)=>this.setCursorStyle(z)),this._parser.registerCsiHandler({final:"r"},(z)=>this.setScrollRegion(z)),this._parser.registerCsiHandler({final:"s"},(z)=>this.saveCursor(z)),this._parser.registerCsiHandler({final:"t"},(z)=>this.windowOptions(z)),this._parser.registerCsiHandler({final:"u"},(z)=>this.restoreCursor(z)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(z)=>this.insertColumns(z)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(z)=>this.deleteColumns(z)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(z)=>this.selectProtected(z)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(z)=>this.requestMode(z,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(z)=>this.requestMode(z,!1)),this._parser.setExecuteHandler(D0.BEL,()=>this.bell()),this._parser.setExecuteHandler(D0.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(D0.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(D0.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(D0.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(D0.BS,()=>this.backspace()),this._parser.setExecuteHandler(D0.HT,()=>this.tab()),this._parser.setExecuteHandler(D0.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(D0.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(nX.IND,()=>this.index()),this._parser.setExecuteHandler(nX.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(nX.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new GU((z)=>(this.setTitle(z),this.setIconName(z),!0))),this._parser.registerOscHandler(1,new GU((z)=>this.setIconName(z))),this._parser.registerOscHandler(2,new GU((z)=>this.setTitle(z))),this._parser.registerOscHandler(4,new GU((z)=>this.setOrReportIndexedColor(z))),this._parser.registerOscHandler(8,new GU((z)=>this.setHyperlink(z))),this._parser.registerOscHandler(10,new GU((z)=>this.setOrReportFgColor(z))),this._parser.registerOscHandler(11,new GU((z)=>this.setOrReportBgColor(z))),this._parser.registerOscHandler(12,new GU((z)=>this.setOrReportCursorColor(z))),this._parser.registerOscHandler(104,new GU((z)=>this.restoreIndexedColor(z))),this._parser.registerOscHandler(110,new GU((z)=>this.restoreFgColor(z))),this._parser.registerOscHandler(111,new GU((z)=>this.restoreBgColor(z))),this._parser.registerOscHandler(112,new GU((z)=>this.restoreCursorColor(z))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let z in v1)this._parser.registerEscHandler({intermediates:"(",final:z},()=>this.selectCharset("("+z)),this._parser.registerEscHandler({intermediates:")",final:z},()=>this.selectCharset(")"+z)),this._parser.registerEscHandler({intermediates:"*",final:z},()=>this.selectCharset("*"+z)),this._parser.registerEscHandler({intermediates:"+",final:z},()=>this.selectCharset("+"+z)),this._parser.registerEscHandler({intermediates:"-",final:z},()=>this.selectCharset("-"+z)),this._parser.registerEscHandler({intermediates:".",final:z},()=>this.selectCharset("."+z)),this._parser.registerEscHandler({intermediates:"/",final:z},()=>this.selectCharset("/"+z));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler((z)=>(this._logService.error("Parsing error: ",z),z)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new b$((z,T)=>this.requestStatusString(z,T)))}getAttrData(){return this._curAttrData}_preserveStack(U,Z,X,Q){this._parseStack.paused=!0,this._parseStack.cursorStartX=U,this._parseStack.cursorStartY=Z,this._parseStack.decodedLength=X,this._parseStack.position=Q}_logSlowResolvingAsync(U){this._logService.logLevel<=3&&Promise.race([U,new Promise((Z,X)=>setTimeout(()=>X("#SLOW_TIMEOUT"),n$))]).catch((Z)=>{if(Z!=="#SLOW_TIMEOUT")throw Z;console.warn(`async parser handler taking longer than ${n$} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(U,Z){let X,Q=this._activeBuffer.x,K=this._activeBuffer.y,F=0,$=this._parseStack.paused;if($){if(X=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,Z))return this._logSlowResolvingAsync(X),X;Q=this._parseStack.cursorStartX,K=this._parseStack.cursorStartY,this._parseStack.paused=!1,U.length>dU&&(F=this._parseStack.position+dU)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof U=="string"?` "${U}"`:` "${Array.prototype.map.call(U,(z)=>String.fromCharCode(z)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof U=="string"?U.split("").map((z)=>z.charCodeAt(0)):U),this._parseBuffer.length<U.length&&this._parseBuffer.length<dU&&(this._parseBuffer=new Uint32Array(Math.min(U.length,dU))),$||this._dirtyRowTracker.clearRange(),U.length>dU)for(let z=F;z<U.length;z+=dU){let T=z+dU<U.length?z+dU:U.length,A=typeof U=="string"?this._stringDecoder.decode(U.substring(z,T),this._parseBuffer):this._utf8Decoder.decode(U.subarray(z,T),this._parseBuffer);if(X=this._parser.parse(this._parseBuffer,A))return this._preserveStack(Q,K,A,z),this._logSlowResolvingAsync(X),X}else if(!$){let z=typeof U=="string"?this._stringDecoder.decode(U,this._parseBuffer):this._utf8Decoder.decode(U,this._parseBuffer);if(X=this._parser.parse(this._parseBuffer,z))return this._preserveStack(Q,K,z,0),this._logSlowResolvingAsync(X),X}(this._activeBuffer.x!==Q||this._activeBuffer.y!==K)&&this._onCursorMove.fire();let q=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),M=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);M<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(M,this._bufferService.rows-1),end:Math.min(q,this._bufferService.rows-1)})}print(U,Z,X){let Q,K,F=this._charsetService.charset,$=this._optionsService.rawOptions.screenReaderMode,q=this._bufferService.cols,M=this._coreService.decPrivateModes.wraparound,z=this._coreService.modes.insertMode,T=this._curAttrData,A=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&X-Z>0&&A.getWidth(this._activeBuffer.x-1)===2&&A.setCellFromCodepoint(this._activeBuffer.x-1,0,1,T);let L=this._parser.precedingJoinState;for(let E=Z;E<X;++E){if(Q=U[E],Q<127&&F){let B=F[String.fromCharCode(Q)];B&&(Q=B.charCodeAt(0))}let S=this._unicodeService.charProperties(Q,L);K=QZ.extractWidth(S);let j=QZ.extractShouldJoin(S),k=j?QZ.extractWidth(L):0;if(L=S,$&&this._onA11yChar.fire(lU(Q)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+K-k>q){if(M){let B=A,v=this._activeBuffer.x-k;for(this._activeBuffer.x=k,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),A=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),k>0&&A instanceof XX&&A.copyCellsFrom(B,v,0,k,!1);v<q;)B.setCellFromCodepoint(v++,0,1,T)}else if(this._activeBuffer.x=q-1,K===2)continue}if(j&&this._activeBuffer.x){let B=A.getWidth(this._activeBuffer.x-1)?1:2;A.addCodepointToCell(this._activeBuffer.x-B,Q,K);for(let v=K-k;--v>=0;)A.setCellFromCodepoint(this._activeBuffer.x++,0,0,T);continue}if(z&&(A.insertCells(this._activeBuffer.x,K-k,this._activeBuffer.getNullCell(T)),A.getWidth(q-1)===2&&A.setCellFromCodepoint(q-1,0,1,T)),A.setCellFromCodepoint(this._activeBuffer.x++,Q,K,T),K>0)for(;--K;)A.setCellFromCodepoint(this._activeBuffer.x++,0,0,T)}this._parser.precedingJoinState=L,this._activeBuffer.x<q&&X-Z>0&&A.getWidth(this._activeBuffer.x)===0&&!A.hasContent(this._activeBuffer.x)&&A.setCellFromCodepoint(this._activeBuffer.x,0,1,T),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(U,Z){return U.final==="t"&&!U.prefix&&!U.intermediates?this._parser.registerCsiHandler(U,(X)=>o$(X.params[0],this._optionsService.rawOptions.windowOptions)?Z(X):!0):this._parser.registerCsiHandler(U,Z)}registerDcsHandler(U,Z){return this._parser.registerDcsHandler(U,new b$(Z))}registerEscHandler(U,Z){return this._parser.registerEscHandler(U,Z)}registerOscHandler(U,Z){return this._parser.registerOscHandler(U,new GU(Z))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);U.hasWidth(this._activeBuffer.x)&&!U.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let U=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-U),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(U=this._bufferService.cols-1){this._activeBuffer.x=Math.min(U,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(U,Z){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=U,this._activeBuffer.y=this._activeBuffer.scrollTop+Z):(this._activeBuffer.x=U,this._activeBuffer.y=Z),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(U,Z){this._restrictCursor(),this._setCursor(this._activeBuffer.x+U,this._activeBuffer.y+Z)}cursorUp(U){let Z=this._activeBuffer.y-this._activeBuffer.scrollTop;return Z>=0?this._moveCursor(0,-Math.min(Z,U.params[0]||1)):this._moveCursor(0,-(U.params[0]||1)),!0}cursorDown(U){let Z=this._activeBuffer.scrollBottom-this._activeBuffer.y;return Z>=0?this._moveCursor(0,Math.min(Z,U.params[0]||1)):this._moveCursor(0,U.params[0]||1),!0}cursorForward(U){return this._moveCursor(U.params[0]||1,0),!0}cursorBackward(U){return this._moveCursor(-(U.params[0]||1),0),!0}cursorNextLine(U){return this.cursorDown(U),this._activeBuffer.x=0,!0}cursorPrecedingLine(U){return this.cursorUp(U),this._activeBuffer.x=0,!0}cursorCharAbsolute(U){return this._setCursor((U.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(U){return this._setCursor(U.length>=2?(U.params[1]||1)-1:0,(U.params[0]||1)-1),!0}charPosAbsolute(U){return this._setCursor((U.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(U){return this._moveCursor(U.params[0]||1,0),!0}linePosAbsolute(U){return this._setCursor(this._activeBuffer.x,(U.params[0]||1)-1),!0}vPositionRelative(U){return this._moveCursor(0,U.params[0]||1),!0}hVPosition(U){return this.cursorPosition(U),!0}tabClear(U){let Z=U.params[0];return Z===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:Z===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(U){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let Z=U.params[0]||1;for(;Z--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(U){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let Z=U.params[0]||1;for(;Z--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(U){let Z=U.params[0];return Z===1&&(this._curAttrData.bg|=536870912),(Z===2||Z===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(U,Z,X,Q=!1,K=!1){let F=this._activeBuffer.lines.get(this._activeBuffer.ybase+U);F.replaceCells(Z,X,this._activeBuffer.getNullCell(this._eraseAttrData()),K),Q&&(F.isWrapped=!1)}_resetBufferLine(U,Z=!1){let X=this._activeBuffer.lines.get(this._activeBuffer.ybase+U);X&&(X.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),Z),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+U),X.isWrapped=!1)}eraseInDisplay(U,Z=!1){this._restrictCursor(this._bufferService.cols);let X;switch(U.params[0]){case 0:for(X=this._activeBuffer.y,this._dirtyRowTracker.markDirty(X),this._eraseInBufferLine(X++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,Z);X<this._bufferService.rows;X++)this._resetBufferLine(X,Z);this._dirtyRowTracker.markDirty(X);break;case 1:for(X=this._activeBuffer.y,this._dirtyRowTracker.markDirty(X),this._eraseInBufferLine(X,0,this._activeBuffer.x+1,!0,Z),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(X+1).isWrapped=!1);X--;)this._resetBufferLine(X,Z);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(X=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,X-1);X--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+X)?.getTrimmedLength(););for(;X>=0;X--)this._bufferService.scroll(this._eraseAttrData())}else{for(X=this._bufferService.rows,this._dirtyRowTracker.markDirty(X-1);X--;)this._resetBufferLine(X,Z);this._dirtyRowTracker.markDirty(0)}break;case 3:let Q=this._activeBuffer.lines.length-this._bufferService.rows;Q>0&&(this._activeBuffer.lines.trimStart(Q),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-Q,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-Q,0),this._onScroll.fire(0));break}return!0}eraseInLine(U,Z=!1){switch(this._restrictCursor(this._bufferService.cols),U.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,Z);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,Z);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,Z);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(U){this._restrictCursor();let Z=U.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let X=this._activeBuffer.ybase+this._activeBuffer.y,Q=this._bufferService.rows-1-this._activeBuffer.scrollBottom,K=this._bufferService.rows-1+this._activeBuffer.ybase-Q+1;for(;Z--;)this._activeBuffer.lines.splice(K-1,1),this._activeBuffer.lines.splice(X,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(U){this._restrictCursor();let Z=U.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let X=this._activeBuffer.ybase+this._activeBuffer.y,Q;for(Q=this._bufferService.rows-1-this._activeBuffer.scrollBottom,Q=this._bufferService.rows-1+this._activeBuffer.ybase-Q;Z--;)this._activeBuffer.lines.splice(X,1),this._activeBuffer.lines.splice(Q,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(U){this._restrictCursor();let Z=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return Z&&(Z.insertCells(this._activeBuffer.x,U.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(U){this._restrictCursor();let Z=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return Z&&(Z.deleteCells(this._activeBuffer.x,U.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(U){let Z=U.params[0]||1;for(;Z--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(U){let Z=U.params[0]||1;for(;Z--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(I1));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(U){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let Z=U.params[0]||1;for(let X=this._activeBuffer.scrollTop;X<=this._activeBuffer.scrollBottom;++X){let Q=this._activeBuffer.lines.get(this._activeBuffer.ybase+X);Q.deleteCells(0,Z,this._activeBuffer.getNullCell(this._eraseAttrData())),Q.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(U){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let Z=U.params[0]||1;for(let X=this._activeBuffer.scrollTop;X<=this._activeBuffer.scrollBottom;++X){let Q=this._activeBuffer.lines.get(this._activeBuffer.ybase+X);Q.insertCells(0,Z,this._activeBuffer.getNullCell(this._eraseAttrData())),Q.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(U){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let Z=U.params[0]||1;for(let X=this._activeBuffer.scrollTop;X<=this._activeBuffer.scrollBottom;++X){let Q=this._activeBuffer.lines.get(this._activeBuffer.ybase+X);Q.insertCells(this._activeBuffer.x,Z,this._activeBuffer.getNullCell(this._eraseAttrData())),Q.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(U){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let Z=U.params[0]||1;for(let X=this._activeBuffer.scrollTop;X<=this._activeBuffer.scrollBottom;++X){let Q=this._activeBuffer.lines.get(this._activeBuffer.ybase+X);Q.deleteCells(this._activeBuffer.x,Z,this._activeBuffer.getNullCell(this._eraseAttrData())),Q.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(U){this._restrictCursor();let Z=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return Z&&(Z.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(U.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(U){let Z=this._parser.precedingJoinState;if(!Z)return!0;let X=U.params[0]||1,Q=QZ.extractWidth(Z),K=this._activeBuffer.x-Q,F=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(K),$=new Uint32Array(F.length*X),q=0;for(let z=0;z<F.length;){let T=F.codePointAt(z)||0;$[q++]=T,z+=T>65535?2:1}let M=q;for(let z=1;z<X;++z)$.copyWithin(M,0,q),M+=q;return this.print($,0,M),!0}sendDeviceAttributesPrimary(U){return U.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(D0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(D0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(U){return U.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(D0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(D0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(U.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(D0.ESC+"[>83;40003;0c")),!0}_is(U){return(this._optionsService.rawOptions.termName+"").indexOf(U)===0}setMode(U){for(let Z=0;Z<U.length;Z++)switch(U.params[Z]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(U){for(let Z=0;Z<U.length;Z++)switch(U.params[Z]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,JZ),this._charsetService.setgCharset(1,JZ),this._charsetService.setgCharset(2,JZ),this._charsetService.setgCharset(3,JZ);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1000:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(U){for(let Z=0;Z<U.length;Z++)switch(U.params[Z]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(U){for(let Z=0;Z<U.length;Z++)switch(U.params[Z]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1000:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),U.params[Z]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(U,Z){let X;((j)=>(j[j.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",j[j.SET=1]="SET",j[j.RESET=2]="RESET",j[j.PERMANENTLY_SET=3]="PERMANENTLY_SET",j[j.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(X||={});let Q=this._coreService.decPrivateModes,{activeProtocol:K,activeEncoding:F}=this._coreMouseService,$=this._coreService,{buffers:q,cols:M}=this._bufferService,{active:z,alt:T}=q,A=this._optionsService.rawOptions,L=(j,k)=>($.triggerDataEvent(`${D0.ESC}[${Z?"":"?"}${j};${k}$y`),!0),E=(j)=>j?1:2,S=U.params[0];return Z?S===2?L(S,4):S===4?L(S,E($.modes.insertMode)):S===12?L(S,3):S===20?L(S,E(A.convertEol)):L(S,0):S===1?L(S,E(Q.applicationCursorKeys)):S===3?L(S,A.windowOptions.setWinLines?M===80?2:M===132?1:0:0):S===6?L(S,E(Q.origin)):S===7?L(S,E(Q.wraparound)):S===8?L(S,3):S===9?L(S,E(K==="X10")):S===12?L(S,E(A.cursorBlink)):S===25?L(S,E(!$.isCursorHidden)):S===45?L(S,E(Q.reverseWraparound)):S===66?L(S,E(Q.applicationKeypad)):S===67?L(S,4):S===1000?L(S,E(K==="VT200")):S===1002?L(S,E(K==="DRAG")):S===1003?L(S,E(K==="ANY")):S===1004?L(S,E(Q.sendFocus)):S===1005?L(S,4):S===1006?L(S,E(F==="SGR")):S===1015?L(S,4):S===1016?L(S,E(F==="SGR_PIXELS")):S===1048?L(S,1):S===47||S===1047||S===1049?L(S,E(z===T)):S===2004?L(S,E(Q.bracketedPasteMode)):S===2026?L(S,E(Q.synchronizedOutput)):L(S,0)}_updateAttrColor(U,Z,X,Q,K){return Z===2?(U|=50331648,U&=-16777216,U|=IX.fromColorRGB([X,Q,K])):Z===5&&(U&=-50331904,U|=33554432|X&255),U}_extractColor(U,Z,X){let Q=[0,0,-1,0,0,0],K=0,F=0;do{if(Q[F+K]=U.params[Z+F],U.hasSubParams(Z+F)){let $=U.getSubParams(Z+F),q=0;do Q[1]===5&&(K=1),Q[F+q+1+K]=$[q];while(++q<$.length&&q+F+1+K<Q.length);break}if(Q[1]===5&&F+K>=2||Q[1]===2&&F+K>=5)break;Q[1]&&(K=1)}while(++F+Z<U.length&&F+K<Q.length);for(let $=2;$<Q.length;++$)Q[$]===-1&&(Q[$]=0);switch(Q[0]){case 38:X.fg=this._updateAttrColor(X.fg,Q[1],Q[3],Q[4],Q[5]);break;case 48:X.bg=this._updateAttrColor(X.bg,Q[1],Q[3],Q[4],Q[5]);break;case 58:X.extended=X.extended.clone(),X.extended.underlineColor=this._updateAttrColor(X.extended.underlineColor,Q[1],Q[3],Q[4],Q[5])}return F}_processUnderline(U,Z){Z.extended=Z.extended.clone(),(!~U||U>5)&&(U=1),Z.extended.underlineStyle=U,Z.fg|=268435456,U===0&&(Z.fg&=-268435457),Z.updateExtended()}_processSGR0(U){U.fg=I1.fg,U.bg=I1.bg,U.extended=U.extended.clone(),U.extended.underlineStyle=0,U.extended.underlineColor&=-67108864,U.updateExtended()}charAttributes(U){if(U.length===1&&U.params[0]===0)return this._processSGR0(this._curAttrData),!0;let Z=U.length,X,Q=this._curAttrData;for(let K=0;K<Z;K++)X=U.params[K],X>=30&&X<=37?(Q.fg&=-50331904,Q.fg|=16777216|X-30):X>=40&&X<=47?(Q.bg&=-50331904,Q.bg|=16777216|X-40):X>=90&&X<=97?(Q.fg&=-50331904,Q.fg|=16777216|X-90|8):X>=100&&X<=107?(Q.bg&=-50331904,Q.bg|=16777216|X-100|8):X===0?this._processSGR0(Q):X===1?Q.fg|=134217728:X===3?Q.bg|=67108864:X===4?(Q.fg|=268435456,this._processUnderline(U.hasSubParams(K)?U.getSubParams(K)[0]:1,Q)):X===5?Q.fg|=536870912:X===7?Q.fg|=67108864:X===8?Q.fg|=1073741824:X===9?Q.fg|=2147483648:X===2?Q.bg|=134217728:X===21?this._processUnderline(2,Q):X===22?(Q.fg&=-134217729,Q.bg&=-134217729):X===23?Q.bg&=-67108865:X===24?(Q.fg&=-268435457,this._processUnderline(0,Q)):X===25?Q.fg&=-536870913:X===27?Q.fg&=-67108865:X===28?Q.fg&=-1073741825:X===29?Q.fg&=2147483647:X===39?(Q.fg&=-67108864,Q.fg|=I1.fg&16777215):X===49?(Q.bg&=-67108864,Q.bg|=I1.bg&16777215):X===38||X===48||X===58?K+=this._extractColor(U,K,Q):X===53?Q.bg|=1073741824:X===55?Q.bg&=-1073741825:X===59?(Q.extended=Q.extended.clone(),Q.extended.underlineColor=-1,Q.updateExtended()):X===100?(Q.fg&=-67108864,Q.fg|=I1.fg&16777215,Q.bg&=-67108864,Q.bg|=I1.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",X);return!0}deviceStatus(U){switch(U.params[0]){case 5:this._coreService.triggerDataEvent(`${D0.ESC}[0n`);break;case 6:let Z=this._activeBuffer.y+1,X=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${D0.ESC}[${Z};${X}R`);break}return!0}deviceStatusPrivate(U){switch(U.params[0]){case 6:let Z=this._activeBuffer.y+1,X=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${D0.ESC}[?${Z};${X}R`);break;case 15:break;case 25:break;case 26:break;case 53:break}return!0}softReset(U){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=I1.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(U){let Z=U.length===0?1:U.params[0];if(Z===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(Z){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let X=Z%2===1;this._coreService.decPrivateModes.cursorBlink=X}return!0}setScrollRegion(U){let Z=U.params[0]||1,X;return(U.length<2||(X=U.params[1])>this._bufferService.rows||X===0)&&(X=this._bufferService.rows),X>Z&&(this._activeBuffer.scrollTop=Z-1,this._activeBuffer.scrollBottom=X-1,this._setCursor(0,0)),!0}windowOptions(U){if(!o$(U.params[0],this._optionsService.rawOptions.windowOptions))return!0;let Z=U.length>1?U.params[1]:0;switch(U.params[0]){case 14:Z!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${D0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(Z===0||Z===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>l$&&this._windowTitleStack.shift()),(Z===0||Z===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>l$&&this._iconNameStack.shift());break;case 23:(Z===0||Z===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(Z===0||Z===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(U){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(U){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(U){return this._windowTitle=U,this._onTitleChange.fire(U),!0}setIconName(U){return this._iconName=U,!0}setOrReportIndexedColor(U){let Z=[],X=U.split(";");for(;X.length>1;){let Q=X.shift(),K=X.shift();if(/^\d+$/.exec(Q)){let F=parseInt(Q);if(s$(F))if(K==="?")Z.push({type:0,index:F});else{let $=d$(K);$&&Z.push({type:1,index:F,color:$})}}}return Z.length&&this._onColor.fire(Z),!0}setHyperlink(U){let Z=U.indexOf(";");if(Z===-1)return!0;let X=U.slice(0,Z).trim(),Q=U.slice(Z+1);return Q?this._createHyperlink(X,Q):X.trim()?!1:this._finishHyperlink()}_createHyperlink(U,Z){this._getCurrentLinkId()&&this._finishHyperlink();let X=U.split(":"),Q,K=X.findIndex((F)=>F.startsWith("id="));return K!==-1&&(Q=X[K].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:Q,uri:Z}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(U,Z){let X=U.split(";");for(let Q=0;Q<X.length&&!(Z>=this._specialColors.length);++Q,++Z)if(X[Q]==="?")this._onColor.fire([{type:0,index:this._specialColors[Z]}]);else{let K=d$(X[Q]);K&&this._onColor.fire([{type:1,index:this._specialColors[Z],color:K}])}return!0}setOrReportFgColor(U){return this._setOrReportSpecialColor(U,0)}setOrReportBgColor(U){return this._setOrReportSpecialColor(U,1)}setOrReportCursorColor(U){return this._setOrReportSpecialColor(U,2)}restoreIndexedColor(U){if(!U)return this._onColor.fire([{type:2}]),!0;let Z=[],X=U.split(";");for(let Q=0;Q<X.length;++Q)if(/^\d+$/.exec(X[Q])){let K=parseInt(X[Q]);s$(K)&&Z.push({type:2,index:K})}return Z.length&&this._onColor.fire(Z),!0}restoreFgColor(U){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(U){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(U){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,JZ),!0}selectCharset(U){return U.length!==2?(this.selectDefaultCharset(),!0):(U[0]==="/"||this._charsetService.setgCharset(RC[U[0]],v1[U[1]]||JZ),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let U=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,U,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=I1.clone(),this._eraseAttrDataInternal=I1.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(U){return this._charsetService.setgLevel(U),!0}screenAlignmentPattern(){let U=new HU;U.content=4194373,U.fg=this._curAttrData.fg,U.bg=this._curAttrData.bg,this._setCursor(0,0);for(let Z=0;Z<this._bufferService.rows;++Z){let X=this._activeBuffer.ybase+this._activeBuffer.y+Z,Q=this._activeBuffer.lines.get(X);Q&&(Q.fill(U),Q.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(U,Z){let X=($)=>(this._coreService.triggerDataEvent(`${D0.ESC}${$}${D0.ESC}\\`),!0),Q=this._bufferService.buffer,K=this._optionsService.rawOptions;return X(U==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:U==='"p'?'P1$r61;1"p':U==="r"?`P1$r${Q.scrollTop+1};${Q.scrollBottom+1}r`:U==="m"?"P1$r0m":U===" q"?`P1$r${{block:2,underline:4,bar:6}[K.cursorStyle]-(K.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(U,Z){this._dirtyRowTracker.markRangeDirty(U,Z)}},UQ=class{constructor(U){this._bufferService=U,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(U){U<this.start?this.start=U:U>this.end&&(this.end=U)}markRangeDirty(U,Z){U>Z&&(m$=U,U=Z,Z=m$),U<this.start&&(this.start=U),Z>this.end&&(this.end=Z)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};UQ=$1([c0(0,r1)],UQ);function s$(U){return 0<=U&&U<256}var SC=50000000,r$=12,PC=50,kC=class extends d0{constructor(U){super();this._action=U,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new w0),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(U,Z){if(Z!==void 0&&this._syncCalls>Z){this._syncCalls=0;return}if(this._pendingData+=U.length,this._writeBuffer.push(U),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let X;for(;X=this._writeBuffer.shift();){this._action(X);let Q=this._callbacks.shift();Q&&Q()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(U,Z){if(this._pendingData>SC)throw Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=U.length,this._writeBuffer.push(U),this._callbacks.push(Z),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=U.length,this._writeBuffer.push(U),this._callbacks.push(Z)}_innerWrite(U=0,Z=!0){let X=U||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let Q=this._writeBuffer[this._bufferOffset],K=this._action(Q,Z);if(K){let $=(q)=>performance.now()-X>=r$?setTimeout(()=>this._innerWrite(0,q)):this._innerWrite(X,q);K.catch((q)=>(queueMicrotask(()=>{throw q}),Promise.resolve(!1))).then($);return}let F=this._callbacks[this._bufferOffset];if(F&&F(),this._bufferOffset++,this._pendingData-=Q.length,performance.now()-X>=r$)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>PC&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},ZQ=class{constructor(U){this._bufferService=U,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(U){let Z=this._bufferService.buffer;if(U.id===void 0){let q=Z.addMarker(Z.ybase+Z.y),M={data:U,id:this._nextId++,lines:[q]};return q.onDispose(()=>this._removeMarkerFromLink(M,q)),this._dataByLinkId.set(M.id,M),M.id}let X=U,Q=this._getEntryIdKey(X),K=this._entriesWithId.get(Q);if(K)return this.addLineToLink(K.id,Z.ybase+Z.y),K.id;let F=Z.addMarker(Z.ybase+Z.y),$={id:this._nextId++,key:this._getEntryIdKey(X),data:X,lines:[F]};return F.onDispose(()=>this._removeMarkerFromLink($,F)),this._entriesWithId.set($.key,$),this._dataByLinkId.set($.id,$),$.id}addLineToLink(U,Z){let X=this._dataByLinkId.get(U);if(X&&X.lines.every((Q)=>Q.line!==Z)){let Q=this._bufferService.buffer.addMarker(Z);X.lines.push(Q),Q.onDispose(()=>this._removeMarkerFromLink(X,Q))}}getLinkData(U){return this._dataByLinkId.get(U)?.data}_getEntryIdKey(U){return`${U.id};;${U.uri}`}_removeMarkerFromLink(U,Z){let X=U.lines.indexOf(Z);X!==-1&&(U.lines.splice(X,1),U.lines.length===0&&(U.data.id!==void 0&&this._entriesWithId.delete(U.key),this._dataByLinkId.delete(U.id)))}};ZQ=$1([c0(0,r1)],ZQ);var a$=!1,jC=class extends d0{constructor(U){super();this._windowsWrappingHeuristics=this._register(new EZ),this._onBinary=this._register(new w0),this.onBinary=this._onBinary.event,this._onData=this._register(new w0),this.onData=this._onData.event,this._onLineFeed=this._register(new w0),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new w0),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new w0),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new w0),this._instantiationService=new t8,this.optionsService=this._register(new $C(U)),this._instantiationService.setService(a1,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(tJ)),this._instantiationService.setService(r1,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(aJ)),this._instantiationService.setService(GK,this._logService),this.coreService=this._register(this._instantiationService.createInstance(iJ)),this._instantiationService.setService(KZ,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(eJ)),this._instantiationService.setService(QK,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(QZ)),this._instantiationService.setService(MO,this.unicodeService),this._charsetService=this._instantiationService.createInstance(HC),this._instantiationService.setService(qO,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(ZQ),this._instantiationService.setService(VK,this._oscLinkService),this._inputHandler=this._register(new EC(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(b1.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(b1.forward(this._bufferService.onResize,this._onResize)),this._register(b1.forward(this.coreService.onData,this._onData)),this._register(b1.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new kC((Z,X)=>this._inputHandler.parse(Z,X))),this._register(b1.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new w0),this._onScroll.event((U)=>{this._onScrollApi?.fire(U.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(U){for(let Z in U)this.optionsService.options[Z]=U[Z]}write(U,Z){this._writeBuffer.write(U,Z)}writeSync(U,Z){this._logService.logLevel<=3&&!a$&&(this._logService.warn("writeSync is unreliable and will be removed soon."),a$=!0),this._writeBuffer.writeSync(U,Z)}input(U,Z=!0){this.coreService.triggerDataEvent(U,Z)}resize(U,Z){isNaN(U)||isNaN(Z)||(U=Math.max(U,yK),Z=Math.max(Z,cK),this._bufferService.resize(U,Z))}scroll(U,Z=!1){this._bufferService.scroll(U,Z)}scrollLines(U,Z){this._bufferService.scrollLines(U,Z)}scrollPages(U){this.scrollLines(U*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(U){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(U){let Z=U-this._bufferService.buffer.ydisp;Z!==0&&this.scrollLines(Z)}registerEscHandler(U,Z){return this._inputHandler.registerEscHandler(U,Z)}registerDcsHandler(U,Z){return this._inputHandler.registerDcsHandler(U,Z)}registerCsiHandler(U,Z){return this._inputHandler.registerCsiHandler(U,Z)}registerOscHandler(U,Z){return this._inputHandler.registerOscHandler(U,Z)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let U=!1,Z=this.optionsService.rawOptions.windowsPty;Z&&Z.buildNumber!==void 0&&Z.buildNumber!==void 0?U=Z.backend==="conpty"&&Z.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(U=!0),U?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let U=[];U.push(this.onLineFeed(u$.bind(null,this._bufferService))),U.push(this.registerCsiHandler({final:"H"},()=>(u$(this._bufferService),!1))),this._windowsWrappingHeuristics.value=U1(()=>{for(let Z of U)Z.dispose()})}}},vC={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};function _C(U,Z,X,Q){let K={type:0,cancel:!1,key:void 0},F=(U.shiftKey?1:0)|(U.altKey?2:0)|(U.ctrlKey?4:0)|(U.metaKey?8:0);switch(U.keyCode){case 0:U.key==="UIKeyInputUpArrow"?Z?K.key=D0.ESC+"OA":K.key=D0.ESC+"[A":U.key==="UIKeyInputLeftArrow"?Z?K.key=D0.ESC+"OD":K.key=D0.ESC+"[D":U.key==="UIKeyInputRightArrow"?Z?K.key=D0.ESC+"OC":K.key=D0.ESC+"[C":U.key==="UIKeyInputDownArrow"&&(Z?K.key=D0.ESC+"OB":K.key=D0.ESC+"[B");break;case 8:K.key=U.ctrlKey?"\b":D0.DEL,U.altKey&&(K.key=D0.ESC+K.key);break;case 9:if(U.shiftKey){K.key=D0.ESC+"[Z";break}K.key=D0.HT,K.cancel=!0;break;case 13:K.key=U.altKey?D0.ESC+D0.CR:D0.CR,K.cancel=!0;break;case 27:K.key=D0.ESC,U.altKey&&(K.key=D0.ESC+D0.ESC),K.cancel=!0;break;case 37:if(U.metaKey)break;F?K.key=D0.ESC+"[1;"+(F+1)+"D":Z?K.key=D0.ESC+"OD":K.key=D0.ESC+"[D";break;case 39:if(U.metaKey)break;F?K.key=D0.ESC+"[1;"+(F+1)+"C":Z?K.key=D0.ESC+"OC":K.key=D0.ESC+"[C";break;case 38:if(U.metaKey)break;F?K.key=D0.ESC+"[1;"+(F+1)+"A":Z?K.key=D0.ESC+"OA":K.key=D0.ESC+"[A";break;case 40:if(U.metaKey)break;F?K.key=D0.ESC+"[1;"+(F+1)+"B":Z?K.key=D0.ESC+"OB":K.key=D0.ESC+"[B";break;case 45:!U.shiftKey&&!U.ctrlKey&&(K.key=D0.ESC+"[2~");break;case 46:F?K.key=D0.ESC+"[3;"+(F+1)+"~":K.key=D0.ESC+"[3~";break;case 36:F?K.key=D0.ESC+"[1;"+(F+1)+"H":Z?K.key=D0.ESC+"OH":K.key=D0.ESC+"[H";break;case 35:F?K.key=D0.ESC+"[1;"+(F+1)+"F":Z?K.key=D0.ESC+"OF":K.key=D0.ESC+"[F";break;case 33:U.shiftKey?K.type=2:U.ctrlKey?K.key=D0.ESC+"[5;"+(F+1)+"~":K.key=D0.ESC+"[5~";break;case 34:U.shiftKey?K.type=3:U.ctrlKey?K.key=D0.ESC+"[6;"+(F+1)+"~":K.key=D0.ESC+"[6~";break;case 112:F?K.key=D0.ESC+"[1;"+(F+1)+"P":K.key=D0.ESC+"OP";break;case 113:F?K.key=D0.ESC+"[1;"+(F+1)+"Q":K.key=D0.ESC+"OQ";break;case 114:F?K.key=D0.ESC+"[1;"+(F+1)+"R":K.key=D0.ESC+"OR";break;case 115:F?K.key=D0.ESC+"[1;"+(F+1)+"S":K.key=D0.ESC+"OS";break;case 116:F?K.key=D0.ESC+"[15;"+(F+1)+"~":K.key=D0.ESC+"[15~";break;case 117:F?K.key=D0.ESC+"[17;"+(F+1)+"~":K.key=D0.ESC+"[17~";break;case 118:F?K.key=D0.ESC+"[18;"+(F+1)+"~":K.key=D0.ESC+"[18~";break;case 119:F?K.key=D0.ESC+"[19;"+(F+1)+"~":K.key=D0.ESC+"[19~";break;case 120:F?K.key=D0.ESC+"[20;"+(F+1)+"~":K.key=D0.ESC+"[20~";break;case 121:F?K.key=D0.ESC+"[21;"+(F+1)+"~":K.key=D0.ESC+"[21~";break;case 122:F?K.key=D0.ESC+"[23;"+(F+1)+"~":K.key=D0.ESC+"[23~";break;case 123:F?K.key=D0.ESC+"[24;"+(F+1)+"~":K.key=D0.ESC+"[24~";break;default:if(U.ctrlKey&&!U.shiftKey&&!U.altKey&&!U.metaKey)U.keyCode>=65&&U.keyCode<=90?K.key=String.fromCharCode(U.keyCode-64):U.keyCode===32?K.key=D0.NUL:U.keyCode>=51&&U.keyCode<=55?K.key=String.fromCharCode(U.keyCode-51+27):U.keyCode===56?K.key=D0.DEL:U.keyCode===219?K.key=D0.ESC:U.keyCode===220?K.key=D0.FS:U.keyCode===221&&(K.key=D0.GS);else if((!X||Q)&&U.altKey&&!U.metaKey){let $=vC[U.keyCode]?.[U.shiftKey?1:0];if($)K.key=D0.ESC+$;else if(U.keyCode>=65&&U.keyCode<=90){let q=U.ctrlKey?U.keyCode-64:U.keyCode+32,M=String.fromCharCode(q);U.shiftKey&&(M=M.toUpperCase()),K.key=D0.ESC+M}else if(U.keyCode===32)K.key=D0.ESC+(U.ctrlKey?D0.NUL:" ");else if(U.key==="Dead"&&U.code.startsWith("Key")){let q=U.code.slice(3,4);U.shiftKey||(q=q.toLowerCase()),K.key=D0.ESC+q,K.cancel=!0}}else X&&!U.altKey&&!U.ctrlKey&&!U.shiftKey&&U.metaKey?U.keyCode===65&&(K.type=1):U.key&&!U.ctrlKey&&!U.altKey&&!U.metaKey&&U.keyCode>=48&&U.key.length===1?K.key=U.key:U.key&&U.ctrlKey&&(U.key==="_"&&(K.key=D0.US),U.key==="@"&&(K.key=D0.NUL));break}return K}var W1=0,BC=class{constructor(U){this._getKey=U,this._array=[],this._insertedValues=[],this._flushInsertedTask=new ZY,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new ZY,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(U){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(U)}_flushInserted(){let U=this._insertedValues.sort((K,F)=>this._getKey(K)-this._getKey(F)),Z=0,X=0,Q=Array(this._array.length+this._insertedValues.length);for(let K=0;K<Q.length;K++)X>=this._array.length||this._getKey(U[Z])<=this._getKey(this._array[X])?(Q[K]=U[Z],Z++):Q[K]=this._array[X++];this._array=Q,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(U){if(this._flushCleanupInserted(),this._array.length===0)return!1;let Z=this._getKey(U);if(Z===void 0||(W1=this._search(Z),W1===-1)||this._getKey(this._array[W1])!==Z)return!1;do if(this._array[W1]===U)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(W1),!0;while(++W1<this._array.length&&this._getKey(this._array[W1])===Z);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let U=this._deletedIndices.sort((K,F)=>K-F),Z=0,X=Array(this._array.length-U.length),Q=0;for(let K=0;K<this._array.length;K++)U[Z]===K?Z++:X[Q++]=this._array[K];this._array=X,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(U){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(W1=this._search(U),!(W1<0||W1>=this._array.length)&&this._getKey(this._array[W1])===U))do yield this._array[W1];while(++W1<this._array.length&&this._getKey(this._array[W1])===U)}forEachByKey(U,Z){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(W1=this._search(U),!(W1<0||W1>=this._array.length)&&this._getKey(this._array[W1])===U))do Z(this._array[W1]);while(++W1<this._array.length&&this._getKey(this._array[W1])===U)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(U){let Z=0,X=this._array.length-1;for(;X>=Z;){let Q=Z+X>>1,K=this._getKey(this._array[Q]);if(K>U)X=Q-1;else if(K<U)Z=Q+1;else{for(;Q>0&&this._getKey(this._array[Q-1])===U;)Q--;return Q}}return Z}},PJ=0,t$=0,xC=class extends d0{constructor(){super();this._decorations=new BC((U)=>U?.marker.line),this._onDecorationRegistered=this._register(new w0),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new w0),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(U1(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(U){if(U.marker.isDisposed)return;let Z=new NC(U);if(Z){let X=Z.marker.onDispose(()=>Z.dispose()),Q=Z.onDispose(()=>{Q.dispose(),Z&&(this._decorations.delete(Z)&&this._onDecorationRemoved.fire(Z),X.dispose())});this._decorations.insert(Z),this._onDecorationRegistered.fire(Z)}return Z}reset(){for(let U of this._decorations.values())U.dispose();this._decorations.clear()}*getDecorationsAtCell(U,Z,X){let Q=0,K=0;for(let F of this._decorations.getKeyIterator(Z))Q=F.options.x??0,K=Q+(F.options.width??1),U>=Q&&U<K&&(!X||(F.options.layer??"bottom")===X)&&(yield F)}forEachDecorationAtCell(U,Z,X,Q){this._decorations.forEachByKey(Z,(K)=>{PJ=K.options.x??0,t$=PJ+(K.options.width??1),U>=PJ&&U<t$&&(!X||(K.options.layer??"bottom")===X)&&Q(K)})}},NC=class extends nU{constructor(U){super();this.options=U,this.onRenderEmitter=this.add(new w0),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new w0),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=U.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=Y1.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Y1.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},gC=1000,fC=class{constructor(U,Z=gC){this._renderCallback=U,this._debounceThresholdMS=Z,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(U,Z,X){this._rowCount=X,U=U!==void 0?U:0,Z=Z!==void 0?Z:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,U):U,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,Z):Z;let Q=performance.now();if(Q-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=Q,this._innerRefresh();else if(!this._additionalRefreshRequested){let K=Q-this._lastRefreshMs,F=this._debounceThresholdMS-K;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},F)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let U=Math.max(this._rowStart,0),Z=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(U,Z)}},i$=20,e$=!1,XY=class extends d0{constructor(U,Z,X,Q){super();this._terminal=U,this._coreBrowserService=X,this._renderService=Q,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let K=this._coreBrowserService.mainDocument;this._accessibilityContainer=K.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=K.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let F=0;F<this._terminal.rows;F++)this._rowElements[F]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[F]);if(this._topBoundaryFocusListener=(F)=>this._handleBoundaryFocus(F,0),this._bottomBoundaryFocusListener=(F)=>this._handleBoundaryFocus(F,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=K.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new fC(this._renderRows.bind(this))),!this._terminal.element)throw Error("Cannot enable accessibility before Terminal.open");e$?(this._accessibilityContainer.classList.add("debug"),this._rowContainer.classList.add("debug"),this._debugRootContainer=K.createElement("div"),this._debugRootContainer.classList.add("xterm"),this._debugRootContainer.appendChild(K.createTextNode("------start a11y------")),this._debugRootContainer.appendChild(this._accessibilityContainer),this._debugRootContainer.appendChild(K.createTextNode("------end a11y------")),this._terminal.element.insertAdjacentElement("afterend",this._debugRootContainer)):this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize((F)=>this._handleResize(F.rows))),this._register(this._terminal.onRender((F)=>this._refreshRows(F.start,F.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar((F)=>this._handleChar(F))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
381
|
+
`))),this._register(this._terminal.onA11yTab((F)=>this._handleTab(F))),this._register(this._terminal.onKey((F)=>this._handleKey(F.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(u0(K,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(U1(()=>{e$?this._debugRootContainer.remove():this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(U){for(let Z=0;Z<U;Z++)this._handleChar(" ")}_handleChar(U){this._liveRegionLineCount<i$+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==U&&(this._charsToAnnounce+=U):this._charsToAnnounce+=U,U===`
|
|
382
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===i$+1&&(this._liveRegion.textContent+=jJ.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(U){this._clearLiveRegion(),/\p{Control}/u.test(U)||this._charsToConsume.push(U)}_refreshRows(U,Z){this._liveRegionDebouncer.refresh(U,Z,this._terminal.rows)}_renderRows(U,Z){let X=this._terminal.buffer,Q=X.lines.length.toString();for(let K=U;K<=Z;K++){let F=X.lines.get(X.ydisp+K),$=[],q=F?.translateToString(!0,void 0,void 0,$)||"",M=(X.ydisp+K+1).toString(),z=this._rowElements[K];z&&(q.length===0?(z.textContent=" ",this._rowColumns.set(z,[0,1])):(z.textContent=q,this._rowColumns.set(z,$)),z.setAttribute("aria-posinset",M),z.setAttribute("aria-setsize",Q),this._alignRowWidth(z))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(U,Z){let X=U.target,Q=this._rowElements[Z===0?1:this._rowElements.length-2],K=X.getAttribute("aria-posinset"),F=Z===0?"1":`${this._terminal.buffer.lines.length}`;if(K===F||U.relatedTarget!==Q)return;let $,q;if(Z===0?($=X,q=this._rowElements.pop(),this._rowContainer.removeChild(q)):($=this._rowElements.shift(),q=X,this._rowContainer.removeChild($)),$.removeEventListener("focus",this._topBoundaryFocusListener),q.removeEventListener("focus",this._bottomBoundaryFocusListener),Z===0){let M=this._createAccessibilityTreeNode();this._rowElements.unshift(M),this._rowContainer.insertAdjacentElement("afterbegin",M)}else{let M=this._createAccessibilityTreeNode();this._rowElements.push(M),this._rowContainer.appendChild(M)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(Z===0?-1:1),this._rowElements[Z===0?1:this._rowElements.length-2].focus(),U.preventDefault(),U.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let U=this._coreBrowserService.mainDocument.getSelection();if(!U)return;if(U.isCollapsed){this._rowContainer.contains(U.anchorNode)&&this._terminal.clearSelection();return}if(!U.anchorNode||!U.focusNode){console.error("anchorNode and/or focusNode are null");return}let Z={node:U.anchorNode,offset:U.anchorOffset},X={node:U.focusNode,offset:U.focusOffset};if((Z.node.compareDocumentPosition(X.node)&Node.DOCUMENT_POSITION_PRECEDING||Z.node===X.node&&Z.offset>X.offset)&&([Z,X]=[X,Z]),Z.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(Z={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(Z.node))return;let Q=this._rowElements.slice(-1)[0];if(X.node.compareDocumentPosition(Q)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(X={node:Q,offset:Q.textContent?.length??0}),!this._rowContainer.contains(X.node))return;let K=({node:q,offset:M})=>{let z=q instanceof Text?q.parentNode:q,T=parseInt(z?.getAttribute("aria-posinset"),10)-1;if(isNaN(T))return console.warn("row is invalid. Race condition?"),null;let A=this._rowColumns.get(z);if(!A)return console.warn("columns is null. Race condition?"),null;let L=M<A.length?A[M]:A.slice(-1)[0]+1;return L>=this._terminal.cols&&(++T,L=0),{row:T,column:L}},F=K(Z),$=K(X);if(!(!F||!$)){if(F.row>$.row||F.row===$.row&&F.column>=$.column)throw Error("invalid range");this._terminal.select(F.column,F.row,($.row-F.row)*this._terminal.cols-F.column+$.column)}}_handleResize(U){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let Z=this._rowContainer.children.length;Z<this._terminal.rows;Z++)this._rowElements[Z]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[Z]);for(;this._rowElements.length>U;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let U=this._coreBrowserService.mainDocument.createElement("div");return U.setAttribute("role","listitem"),U.tabIndex=-1,this._refreshRowDimensions(U),U}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let U=0;U<this._terminal.rows;U++)this._refreshRowDimensions(this._rowElements[U]),this._alignRowWidth(this._rowElements[U])}}_refreshRowDimensions(U){U.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(U){U.style.transform="";let Z=U.getBoundingClientRect().width,X=this._rowColumns.get(U)?.slice(-1)?.[0];if(!X)return;let Q=X*this._renderService.dimensions.css.cell.width;U.style.transform=`scaleX(${Q/Z})`}};XY=$1([c0(1,YQ),c0(2,NU),c0(3,gU)],XY);var XQ=class extends d0{constructor(U,Z,X,Q,K){super();this._element=U,this._mouseService=Z,this._renderService=X,this._bufferService=Q,this._linkProviderService=K,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new w0),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new w0),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(U1(()=>{VZ(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(u0(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(u0(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(u0(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(u0(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(U){this._lastMouseEvent=U;let Z=this._positionFromMouseEvent(U,this._element,this._mouseService);if(!Z)return;this._isMouseOut=!1;let X=U.composedPath();for(let Q=0;Q<X.length;Q++){let K=X[Q];if(K.classList.contains("xterm"))break;if(K.classList.contains("xterm-hover"))return}(!this._lastBufferCell||Z.x!==this._lastBufferCell.x||Z.y!==this._lastBufferCell.y)&&(this._handleHover(Z),this._lastBufferCell=Z)}_handleHover(U){if(this._activeLine!==U.y||this._wasResized){this._clearCurrentLink(),this._askForLink(U,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,U)||(this._clearCurrentLink(),this._askForLink(U,!0))}_askForLink(U,Z){(!this._activeProviderReplies||!Z)&&(this._activeProviderReplies?.forEach((Q)=>{Q?.forEach((K)=>{K.link.dispose&&K.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=U.y);let X=!1;for(let[Q,K]of this._linkProviderService.linkProviders.entries())Z?this._activeProviderReplies?.get(Q)&&(X=this._checkLinkProviderResult(Q,U,X)):K.provideLinks(U.y,(F)=>{if(this._isMouseOut)return;let $=F?.map((q)=>({link:q}));this._activeProviderReplies?.set(Q,$),X=this._checkLinkProviderResult(Q,U,X),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(U.y,this._activeProviderReplies)})}_removeIntersectingLinks(U,Z){let X=new Set;for(let Q=0;Q<Z.size;Q++){let K=Z.get(Q);if(K)for(let F=0;F<K.length;F++){let $=K[F],q=$.link.range.start.y<U?0:$.link.range.start.x,M=$.link.range.end.y>U?this._bufferService.cols:$.link.range.end.x;for(let z=q;z<=M;z++){if(X.has(z)){K.splice(F--,1);break}X.add(z)}}}}_checkLinkProviderResult(U,Z,X){if(!this._activeProviderReplies)return X;let Q=this._activeProviderReplies.get(U),K=!1;for(let F=0;F<U;F++)(!this._activeProviderReplies.has(F)||this._activeProviderReplies.get(F))&&(K=!0);if(!K&&Q){let F=Q.find(($)=>this._linkAtPosition($.link,Z));F&&(X=!0,this._handleNewLink(F))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!X)for(let F=0;F<this._activeProviderReplies.size;F++){let $=this._activeProviderReplies.get(F)?.find((q)=>this._linkAtPosition(q.link,Z));if($){X=!0,this._handleNewLink($);break}}return X}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(U){if(!this._currentLink)return;let Z=this._positionFromMouseEvent(U,this._element,this._mouseService);Z&&this._mouseDownLink&&wC(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,Z)&&this._currentLink.link.activate(U,this._currentLink.link.text)}_clearCurrentLink(U,Z){!this._currentLink||!this._lastMouseEvent||(!U||!Z||this._currentLink.link.range.start.y>=U&&this._currentLink.link.range.end.y<=Z)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,VZ(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(U){if(!this._lastMouseEvent)return;let Z=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);Z&&this._linkAtPosition(U.link,Z)&&(this._currentLink=U,this._currentLink.state={decorations:{underline:U.link.decorations===void 0?!0:U.link.decorations.underline,pointerCursor:U.link.decorations===void 0?!0:U.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,U.link,this._lastMouseEvent),U.link.decorations={},Object.defineProperties(U.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:(X)=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==X&&(this._currentLink.state.decorations.pointerCursor=X,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",X))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:(X)=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==X&&(this._currentLink.state.decorations.underline=X,this._currentLink.state.isHovered&&this._fireUnderlineEvent(U.link,X))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((X)=>{if(!this._currentLink)return;let Q=X.start===0?0:X.start+1+this._bufferService.buffer.ydisp,K=this._bufferService.buffer.ydisp+1+X.end;if(this._currentLink.link.range.start.y>=Q&&this._currentLink.link.range.end.y<=K&&(this._clearCurrentLink(Q,K),this._lastMouseEvent)){let F=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);F&&this._askForLink(F,!1)}})))}_linkHover(U,Z,X){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(Z,!0),this._currentLink.state.decorations.pointerCursor&&U.classList.add("xterm-cursor-pointer")),Z.hover&&Z.hover(X,Z.text)}_fireUnderlineEvent(U,Z){let X=U.range,Q=this._bufferService.buffer.ydisp,K=this._createLinkUnderlineEvent(X.start.x-1,X.start.y-Q-1,X.end.x,X.end.y-Q-1,void 0);(Z?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(K)}_linkLeave(U,Z,X){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(Z,!1),this._currentLink.state.decorations.pointerCursor&&U.classList.remove("xterm-cursor-pointer")),Z.leave&&Z.leave(X,Z.text)}_linkAtPosition(U,Z){let X=U.range.start.y*this._bufferService.cols+U.range.start.x,Q=U.range.end.y*this._bufferService.cols+U.range.end.x,K=Z.y*this._bufferService.cols+Z.x;return X<=K&&K<=Q}_positionFromMouseEvent(U,Z,X){let Q=X.getCoords(U,Z,this._bufferService.cols,this._bufferService.rows);if(Q)return{x:Q[0],y:Q[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(U,Z,X,Q,K){return{x1:U,y1:Z,x2:X,y2:Q,cols:this._bufferService.cols,fg:K}}};XQ=$1([c0(1,JQ),c0(2,gU),c0(3,r1),c0(4,KK)],XQ);function wC(U,Z){return U.text===Z.text&&U.range.start.x===Z.range.start.x&&U.range.start.y===Z.range.start.y&&U.range.end.x===Z.range.end.x&&U.range.end.y===Z.range.end.y}var yC=class extends jC{constructor(U={}){super(U);this._linkifier=this._register(new EZ),this.browser=jK,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new EZ),this._onCursorMove=this._register(new w0),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new w0),this.onKey=this._onKey.event,this._onRender=this._register(new w0),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new w0),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new w0),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new w0),this.onBell=this._onBell.event,this._onFocus=this._register(new w0),this._onBlur=this._register(new w0),this._onA11yCharEmitter=this._register(new w0),this._onA11yTabEmitter=this._register(new w0),this._onWillOpen=this._register(new w0),this._setup(),this._decorationService=this._instantiationService.createInstance(xC),this._instantiationService.setService(FX,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(S8),this._instantiationService.setService(KK,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(_J)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows((Z)=>this.refresh(Z?.start??0,Z?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport((Z)=>this._reportWindowsOptions(Z))),this._register(this._inputHandler.onColor((Z)=>this._handleColorEvent(Z))),this._register(b1.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(b1.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(b1.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(b1.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize((Z)=>this._afterResize(Z.cols,Z.rows))),this._register(U1(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(U){if(this._themeService)for(let Z of U){let X,Q="";switch(Z.index){case 256:X="foreground",Q="10";break;case 257:X="background",Q="11";break;case 258:X="cursor",Q="12";break;default:X="ansi",Q="4;"+Z.index}switch(Z.type){case 0:let K=e0.toColorRGB(X==="ansi"?this._themeService.colors.ansi[Z.index]:this._themeService.colors[X]);this.coreService.triggerDataEvent(`${D0.ESC}]${Q};${TC(K)}${PK.ST}`);break;case 1:if(X==="ansi")this._themeService.modifyColors((F)=>F.ansi[Z.index]=F1.toColor(...Z.color));else{let F=X;this._themeService.modifyColors(($)=>$[F]=F1.toColor(...Z.color))}break;case 2:this._themeService.restoreColor(Z.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(U){U?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(XY,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(U){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(D0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(D0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let U=this.buffer.ybase+this.buffer.y,Z=this.buffer.lines.get(U);if(!Z)return;let X=Math.min(this.buffer.x,this.cols-1),Q=this._renderService.dimensions.css.cell.height,K=Z.getWidth(X),F=this._renderService.dimensions.css.cell.width*K,$=this.buffer.y*this._renderService.dimensions.css.cell.height,q=X*this._renderService.dimensions.css.cell.width;this.textarea.style.left=q+"px",this.textarea.style.top=$+"px",this.textarea.style.width=F+"px",this.textarea.style.height=Q+"px",this.textarea.style.lineHeight=Q+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(u0(this.element,"copy",(Z)=>{this.hasSelection()&&HO(Z,this._selectionService)}));let U=(Z)=>OO(Z,this.textarea,this.coreService,this.optionsService);this._register(u0(this.textarea,"paste",U)),this._register(u0(this.element,"paste",U)),vK?this._register(u0(this.element,"mousedown",(Z)=>{Z.button===2&&U$(Z,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(u0(this.element,"contextmenu",(Z)=>{U$(Z,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),FQ&&this._register(u0(this.element,"auxclick",(Z)=>{Z.button===1&&YK(Z,this.textarea,this.screenElement)}))}_bindKeys(){this._register(u0(this.textarea,"keyup",(U)=>this._keyUp(U),!0)),this._register(u0(this.textarea,"keydown",(U)=>this._keyDown(U),!0)),this._register(u0(this.textarea,"keypress",(U)=>this._keyPress(U),!0)),this._register(u0(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(u0(this.textarea,"compositionupdate",(U)=>this._compositionHelper.compositionupdate(U))),this._register(u0(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(u0(this.textarea,"input",(U)=>this._inputEvent(U),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(U){if(!U)throw Error("Terminal requires a parent element.");if(U.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=U.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),U.appendChild(this.element);let Z=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),Z.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(u0(this.screenElement,"mousemove",(K)=>this.updateCursorStyle(K))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),Z.appendChild(this.screenElement);let X=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",kJ.get()),xK||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>X.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(R8,this.textarea,U.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(NU,this._coreBrowserService),this._register(u0(this.textarea,"focus",(K)=>this._handleTextAreaFocus(K))),this._register(u0(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(oJ,this._document,this._helperContainer),this._instantiationService.setService(JY,this._charSizeService),this._themeService=this._instantiationService.createInstance(rJ),this._instantiationService.setService(SZ,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(eX),this._instantiationService.setService($K,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(mJ,this.rows,this.screenElement)),this._instantiationService.setService(gU,this._renderService),this._register(this._renderService.onRenderedViewportChange((K)=>this._onRender.fire(K))),this.onResize((K)=>this._renderService.resize(K.cols,K.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(bJ,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(nJ),this._instantiationService.setService(JQ,this._mouseService);let Q=this._linkifier.value=this._register(this._instantiationService.createInstance(XQ,this.screenElement));this.element.appendChild(Z);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(hJ,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines((K)=>{super.scrollLines(K,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(sJ,this.element,this.screenElement,Q)),this._instantiationService.setService(TO,this._selectionService),this._register(this._selectionService.onRequestScrollLines((K)=>this.scrollLines(K.amount,K.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw((K)=>this._renderService.handleSelectionChanged(K.start,K.end,K.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection((K)=>{this.textarea.value=K,this.textarea.focus(),this.textarea.select()})),this._register(b1.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(uJ,this.screenElement)),this._register(u0(this.element,"mousedown",(K)=>this._selectionService.handleMouseDown(K))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(XY,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",(K)=>this._handleScreenReaderModeOptionChange(K))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(iX,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",(K)=>{!this._overviewRulerRenderer&&K&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(iX,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(lJ,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let U=this,Z=this.element;function X(F){let $=U._mouseService.getMouseReportCoords(F,U.screenElement);if(!$)return!1;let q,M;switch(F.overrideType||F.type){case"mousemove":M=32,F.buttons===void 0?(q=3,F.button!==void 0&&(q=F.button<3?F.button:3)):q=F.buttons&1?0:F.buttons&4?1:F.buttons&2?2:3;break;case"mouseup":M=0,q=F.button<3?F.button:3;break;case"mousedown":M=1,q=F.button<3?F.button:3;break;case"wheel":if(U._customWheelEventHandler&&U._customWheelEventHandler(F)===!1)return!1;let z=F.deltaY;if(z===0||U.coreMouseService.consumeWheelEvent(F,U._renderService?.dimensions?.device?.cell?.height,U._coreBrowserService?.dpr)===0)return!1;M=z<0?0:1,q=4;break;default:return!1}return M===void 0||q===void 0||q>4?!1:U.coreMouseService.triggerMouseEvent({col:$.col,row:$.row,x:$.x,y:$.y,button:q,action:M,ctrl:F.ctrlKey,alt:F.altKey,shift:F.shiftKey})}let Q={mouseup:null,wheel:null,mousedrag:null,mousemove:null},K={mouseup:(F)=>(X(F),F.buttons||(this._document.removeEventListener("mouseup",Q.mouseup),Q.mousedrag&&this._document.removeEventListener("mousemove",Q.mousedrag)),this.cancel(F)),wheel:(F)=>(X(F),this.cancel(F,!0)),mousedrag:(F)=>{F.buttons&&X(F)},mousemove:(F)=>{F.buttons||X(F)}};this._register(this.coreMouseService.onProtocolChange((F)=>{F?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(F)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),F&8?Q.mousemove||(Z.addEventListener("mousemove",K.mousemove),Q.mousemove=K.mousemove):(Z.removeEventListener("mousemove",Q.mousemove),Q.mousemove=null),F&16?Q.wheel||(Z.addEventListener("wheel",K.wheel,{passive:!1}),Q.wheel=K.wheel):(Z.removeEventListener("wheel",Q.wheel),Q.wheel=null),F&2?Q.mouseup||(Q.mouseup=K.mouseup):(this._document.removeEventListener("mouseup",Q.mouseup),Q.mouseup=null),F&4?Q.mousedrag||(Q.mousedrag=K.mousedrag):(this._document.removeEventListener("mousemove",Q.mousedrag),Q.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(u0(Z,"mousedown",(F)=>{if(F.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(F)))return X(F),Q.mouseup&&this._document.addEventListener("mouseup",Q.mouseup),Q.mousedrag&&this._document.addEventListener("mousemove",Q.mousedrag),this.cancel(F)})),this._register(u0(Z,"wheel",(F)=>{if(!Q.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(F)===!1)return!1;if(!this.buffer.hasScrollback){if(F.deltaY===0)return!1;if(U.coreMouseService.consumeWheelEvent(F,U._renderService?.dimensions?.device?.cell?.height,U._coreBrowserService?.dpr)===0)return this.cancel(F,!0);let $=D0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(F.deltaY<0?"A":"B");return this.coreService.triggerDataEvent($,!0),this.cancel(F,!0)}}},{passive:!1}))}refresh(U,Z){this._renderService?.refreshRows(U,Z)}updateCursorStyle(U){this._selectionService?.shouldColumnSelect(U)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(U,Z){this._viewport?this._viewport.scrollLines(U):super.scrollLines(U,Z),this.refresh(0,this.rows-1)}scrollPages(U){this.scrollLines(U*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(U){U&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(U){let Z=U-this._bufferService.buffer.ydisp;Z!==0&&this.scrollLines(Z)}paste(U){XK(U,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(U){this._customKeyEventHandler=U}attachCustomWheelEventHandler(U){this._customWheelEventHandler=U}registerLinkProvider(U){return this._linkProviderService.registerLinkProvider(U)}registerCharacterJoiner(U){if(!this._characterJoinerService)throw Error("Terminal must be opened first");let Z=this._characterJoinerService.register(U);return this.refresh(0,this.rows-1),Z}deregisterCharacterJoiner(U){if(!this._characterJoinerService)throw Error("Terminal must be opened first");this._characterJoinerService.deregister(U)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(U){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+U)}registerDecoration(U){return this._decorationService.registerDecoration(U)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(U,Z,X){this._selectionService.setSelection(U,Z,X)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(U,Z){this._selectionService?.selectLines(U,Z)}_keyDown(U){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(U)===!1)return!1;let Z=this.browser.isMac&&this.options.macOptionIsMeta&&U.altKey;if(!Z&&!this._compositionHelper.keydown(U))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!Z&&(U.key==="Dead"||U.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let X=_C(U,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(U),X.type===3||X.type===2){let Q=this.rows-1;return this.scrollLines(X.type===2?-Q:Q),this.cancel(U,!0)}if(X.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,U)||(X.cancel&&this.cancel(U,!0),!X.key)||U.key&&!U.ctrlKey&&!U.altKey&&!U.metaKey&&U.key.length===1&&U.key.charCodeAt(0)>=65&&U.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((X.key===D0.ETX||X.key===D0.CR)&&(this.textarea.value=""),this._onKey.fire({key:X.key,domEvent:U}),this._showCursor(),this.coreService.triggerDataEvent(X.key,!0),!this.optionsService.rawOptions.screenReaderMode||U.altKey||U.ctrlKey)return this.cancel(U,!0);this._keyDownHandled=!0}_isThirdLevelShift(U,Z){let X=U.isMac&&!this.options.macOptionIsMeta&&Z.altKey&&!Z.ctrlKey&&!Z.metaKey||U.isWindows&&Z.altKey&&Z.ctrlKey&&!Z.metaKey||U.isWindows&&Z.getModifierState("AltGraph");return Z.type==="keypress"?X:X&&(!Z.keyCode||Z.keyCode>47)}_keyUp(U){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(U)===!1)&&(cC(U)||this.focus(),this.updateCursorStyle(U),this._keyPressHandled=!1)}_keyPress(U){let Z;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(U)===!1)return!1;if(this.cancel(U),U.charCode)Z=U.charCode;else if(U.which===null||U.which===void 0)Z=U.keyCode;else if(U.which!==0&&U.charCode!==0)Z=U.which;else return!1;return!Z||(U.altKey||U.ctrlKey||U.metaKey)&&!this._isThirdLevelShift(this.browser,U)?!1:(Z=String.fromCharCode(Z),this._onKey.fire({key:Z,domEvent:U}),this._showCursor(),this.coreService.triggerDataEvent(Z,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(U){if(U.data&&U.inputType==="insertText"&&(!U.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let Z=U.data;return this.coreService.triggerDataEvent(Z,!0),this.cancel(U),!0}return!1}resize(U,Z){if(U===this.cols&&Z===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(U,Z)}_afterResize(U,Z){this._charSizeService?.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let U=1;U<this.rows;U++)this.buffer.lines.push(this.buffer.getBlankLine(I1));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let U=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=U,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(D0.ESC+"[I"):this.coreService.triggerDataEvent(D0.ESC+"[O")}_reportWindowsOptions(U){if(this._renderService)switch(U){case 0:let Z=this._renderService.dimensions.css.canvas.width.toFixed(0),X=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${D0.ESC}[4;${X};${Z}t`);break;case 1:let Q=this._renderService.dimensions.css.cell.width.toFixed(0),K=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${D0.ESC}[6;${K};${Q}t`);break}}cancel(U,Z){if(!(!this.options.cancelEvents&&!Z))return U.preventDefault(),U.stopPropagation(),!1}};function cC(U){return U.keyCode===16||U.keyCode===17||U.keyCode===18}var pC=class{constructor(){this._addons=[]}dispose(){for(let U=this._addons.length-1;U>=0;U--)this._addons[U].instance.dispose()}loadAddon(U,Z){let X={instance:Z,dispose:Z.dispose,isDisposed:!1};this._addons.push(X),Z.dispose=()=>this._wrappedAddonDispose(X),Z.activate(U)}_wrappedAddonDispose(U){if(U.isDisposed)return;let Z=-1;for(let X=0;X<this._addons.length;X++)if(this._addons[X]===U){Z=X;break}if(Z===-1)throw Error("Could not dispose an addon that has not been loaded");U.isDisposed=!0,U.dispose.apply(U.instance),this._addons.splice(Z,1)}},hC=class{constructor(U){this._line=U}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(U,Z){if(!(U<0||U>=this._line.length))return Z?(this._line.loadCell(U,Z),Z):this._line.loadCell(U,new HU)}translateToString(U,Z,X){return this._line.translateToString(U,Z,X)}},UK=class{constructor(U,Z){this._buffer=U,this.type=Z}init(U){return this._buffer=U,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(U){let Z=this._buffer.lines.get(U);if(Z)return new hC(Z)}getNullCell(){return new HU}},uC=class extends d0{constructor(U){super();this._core=U,this._onBufferChange=this._register(new w0),this.onBufferChange=this._onBufferChange.event,this._normal=new UK(this._core.buffers.normal,"normal"),this._alternate=new UK(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},bC=class{constructor(U){this._core=U}registerCsiHandler(U,Z){return this._core.registerCsiHandler(U,(X)=>Z(X.toArray()))}addCsiHandler(U,Z){return this.registerCsiHandler(U,Z)}registerDcsHandler(U,Z){return this._core.registerDcsHandler(U,(X,Q)=>Z(X,Q.toArray()))}addDcsHandler(U,Z){return this.registerDcsHandler(U,Z)}registerEscHandler(U,Z){return this._core.registerEscHandler(U,Z)}addEscHandler(U,Z){return this.registerEscHandler(U,Z)}registerOscHandler(U,Z){return this._core.registerOscHandler(U,Z)}addOscHandler(U,Z){return this.registerOscHandler(U,Z)}},dC=class{constructor(U){this._core=U}register(U){this._core.unicodeService.register(U)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(U){this._core.unicodeService.activeVersion=U}},lC=["cols","rows"],MU=0,hK=class extends d0{constructor(U){super(),this._core=this._register(new yC(U)),this._addonManager=this._register(new pC),this._publicOptions={...this._core.options};let Z=(Q)=>this._core.options[Q],X=(Q,K)=>{this._checkReadonlyOptions(Q),this._core.options[Q]=K};for(let Q in this._core.options){let K={get:Z.bind(this,Q),set:X.bind(this,Q)};Object.defineProperty(this._publicOptions,Q,K)}}_checkReadonlyOptions(U){if(lC.includes(U))throw Error(`Option "${U}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new bC(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new dC(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this._register(new uC(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let U=this._core.coreService.decPrivateModes,Z="none";switch(this._core.coreMouseService.activeProtocol){case"X10":Z="x10";break;case"VT200":Z="vt200";break;case"DRAG":Z="drag";break;case"ANY":Z="any";break}return{applicationCursorKeysMode:U.applicationCursorKeys,applicationKeypadMode:U.applicationKeypad,bracketedPasteMode:U.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:Z,originMode:U.origin,reverseWraparoundMode:U.reverseWraparound,sendFocusMode:U.sendFocus,synchronizedOutputMode:U.synchronizedOutput,wraparoundMode:U.wraparound}}get options(){return this._publicOptions}set options(U){for(let Z in U)this._publicOptions[Z]=U[Z]}blur(){this._core.blur()}focus(){this._core.focus()}input(U,Z=!0){this._core.input(U,Z)}resize(U,Z){this._verifyIntegers(U,Z),this._core.resize(U,Z)}open(U){this._core.open(U)}attachCustomKeyEventHandler(U){this._core.attachCustomKeyEventHandler(U)}attachCustomWheelEventHandler(U){this._core.attachCustomWheelEventHandler(U)}registerLinkProvider(U){return this._core.registerLinkProvider(U)}registerCharacterJoiner(U){return this._checkProposedApi(),this._core.registerCharacterJoiner(U)}deregisterCharacterJoiner(U){this._checkProposedApi(),this._core.deregisterCharacterJoiner(U)}registerMarker(U=0){return this._verifyIntegers(U),this._core.registerMarker(U)}registerDecoration(U){return this._checkProposedApi(),this._verifyPositiveIntegers(U.x??0,U.width??0,U.height??0),this._core.registerDecoration(U)}hasSelection(){return this._core.hasSelection()}select(U,Z,X){this._verifyIntegers(U,Z,X),this._core.select(U,Z,X)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(U,Z){this._verifyIntegers(U,Z),this._core.selectLines(U,Z)}dispose(){super.dispose()}scrollLines(U){this._verifyIntegers(U),this._core.scrollLines(U)}scrollPages(U){this._verifyIntegers(U),this._core.scrollPages(U)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(U){this._verifyIntegers(U),this._core.scrollToLine(U)}clear(){this._core.clear()}write(U,Z){this._core.write(U,Z)}writeln(U,Z){this._core.write(U),this._core.write(`\r
|
|
383
|
+
`,Z)}paste(U){this._core.paste(U)}refresh(U,Z){this._verifyIntegers(U,Z),this._core.refresh(U,Z)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(U){this._addonManager.loadAddon(this,U)}static get strings(){return{get promptLabel(){return kJ.get()},set promptLabel(U){kJ.set(U)},get tooMuchOutput(){return jJ.get()},set tooMuchOutput(U){jJ.set(U)}}}_verifyIntegers(...U){for(MU of U)if(MU===1/0||isNaN(MU)||MU%1!==0)throw Error("This API only accepts integers")}_verifyPositiveIntegers(...U){for(MU of U)if(MU&&(MU===1/0||isNaN(MU)||MU%1!==0||MU<0))throw Error("This API only accepts positive integers")}};var HQ=null,KY=null,uK={"catppuccin-mocha":{background:"#1e1e2e",foreground:"#cdd6f4",cursor:"#f5e0dc",cursorAccent:"#1e1e2e",selectionBackground:"#585b70",black:"#45475a",red:"#f38ba8",green:"#a6e3a1",yellow:"#f9e2af",blue:"#89b4fa",magenta:"#f5c2e7",cyan:"#94e2d5",white:"#bac2de",brightBlack:"#585b70",brightRed:"#f38ba8",brightGreen:"#a6e3a1",brightYellow:"#f9e2af",brightBlue:"#89b4fa",brightMagenta:"#f5c2e7",brightCyan:"#94e2d5",brightWhite:"#a6adc8"},"catppuccin-latte":{background:"#eff1f5",foreground:"#4c4f69",cursor:"#dc8a78",cursorAccent:"#eff1f5",selectionBackground:"#acb0be",black:"#5c5f77",red:"#d20f39",green:"#40a02b",yellow:"#df8e1d",blue:"#1e66f5",magenta:"#ea76cb",cyan:"#179299",white:"#acb0be",brightBlack:"#6c6f85",brightRed:"#d20f39",brightGreen:"#40a02b",brightYellow:"#df8e1d",brightBlue:"#1e66f5",brightMagenta:"#ea76cb",brightCyan:"#179299",brightWhite:"#bcc0cc"}},bK="catppuccin-mocha";function oC(){if(!HQ)HQ=WJ({indexURL:"https://cdn.jsdelivr.net/pyodide/v0.29.1/full/",stdout:(U)=>{if(KY)KY.write(U+`\r
|
|
365
384
|
`)},stderr:(U)=>{if(KY)KY.write(U+`\r
|
|
366
|
-
`)}});return
|
|
385
|
+
`)}});return HQ}function nC(){if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",dK);else dK()}function mC(){if(document.getElementById("pyrepl-styles"))return;let U=document.createElement("link");U.rel="stylesheet",U.href="https://cdn.jsdelivr.net/npm/@xterm/xterm/css/xterm.css",document.head.appendChild(U);let Z=document.createElement("style");Z.id="pyrepl-styles",Z.textContent=`
|
|
367
386
|
.pyrepl {
|
|
368
387
|
display: inline-block;
|
|
369
388
|
border-radius: 8px;
|
|
@@ -421,5 +440,5 @@ ${T.join(`
|
|
|
421
440
|
</div>
|
|
422
441
|
<div class="pyrepl-header-title">python</div>
|
|
423
442
|
<div style="width: 48px"></div>
|
|
424
|
-
`,U.appendChild(Z);let X=document.createElement("div");U.appendChild(X);let Q=U.dataset.theme||bK,K=uK[Q]||uK[bK],
|
|
425
|
-
`),globalThis.term=
|
|
443
|
+
`,U.appendChild(Z);let X=document.createElement("div");U.appendChild(X);let Q=U.dataset.theme||bK,K=uK[Q]||uK[bK],F=new hK({cursorBlink:!0,fontSize:14,fontFamily:"monospace",theme:K});F.open(X);let $=await oC();await $.loadPackage("micropip");let q=U.dataset.packages,M=q?q.split(",").map((E)=>E.trim()).filter(Boolean):[];if(M.length>0)await $.pyimport("micropip").install(M);let T=`Python 3.13 (Pyodide${M.length>0?` + ${M.join(", ")}`:""})`;F.write(`\x1B[90m${T}\x1B[0m\r
|
|
444
|
+
`),globalThis.term=F,globalThis.pyreplTheme=Q,globalThis.pyreplInfo=T;let A=zQ;$.runPython(A),$.runPythonAsync("await start_repl()");let L=$.globals.get("browser_console");globalThis.browserConsole=L,F.onData((E)=>{for(let S of E)L.push_char(S.charCodeAt(0))})}async function dK(){let U=document.querySelectorAll(".pyrepl");if(U.length===0){console.warn("pyrepl-web: no .pyrepl elements found");return}U.forEach(sC)}nC();
|