pyrepl-web 0.1.10 → 0.1.13
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/dist/chunk-3vjhr6cq.js +16 -0
- package/dist/chunk-7hjm8rrn.js +36 -0
- package/dist/chunk-agmzdfvt.js +2 -0
- package/dist/chunk-cmrefyz7.js +2 -0
- package/dist/chunk-n46k5haq.js +3 -0
- package/dist/chunk-t9eg0wr0.js +1 -0
- package/dist/pyrepl.esm.js +529 -0
- package/dist/pyrepl.js +1 -560
- package/package.json +3 -3
package/dist/pyrepl.js
CHANGED
|
@@ -1,560 +1 @@
|
|
|
1
|
-
|
|
2
|
-
`,"\t"],ZW=["{","}","|","\\","^","`"].concat(UW),CY=["'"].concat(ZW),qG=["%","/","?",";","#"].concat(CY),TG=["/","?","#"],RG=/^[+a-z0-9A-Z_-]{0,63}$/,YW=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,JW={javascript:!0,"javascript:":!0},AY={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},DY={parse(U){var Z=decodeURIComponent;return(U+"").replace(/\+/g," ").split("&").filter(Boolean).reduce(function(X,G,K){var F=G.split("="),$=Z(F[0]||""),L=Z(F[1]||""),M=X[$];return X[$]=M===void 0?L:[].concat(M,L),X},{})},stringify(U){var Z=encodeURIComponent;return Object.keys(U||{}).reduce(function(X,G){return[].concat(U[G]).forEach(function(K){X.push(Z(G)+"="+Z(K))}),X},[]).join("&").replace(/\s/g,"+")}};XU.prototype.parse=function(U,Z,X){if(!LY(U))throw TypeError("Parameter 'url' must be a string, not "+typeof U);var G=U.indexOf("?"),K=G!==-1&&G<U.indexOf("#")?"?":"#",F=U.split(K),$=/\\/g;F[0]=F[0].replace($,"/"),U=F.join(K);var L=U;if(L=L.trim(),!X&&U.split("#").length===1){var M=eK.exec(L);if(M){if(this.path=L,this.href=L,this.pathname=M[1],M[2])if(this.search=M[2],Z)this.query=DY.parse(this.search.substr(1));else this.query=this.search.substr(1);else if(Z)this.search="",this.query={};return this}}var D=tK.exec(L);if(D){D=D[0];var T=D.toLowerCase();this.protocol=T,L=L.substr(D.length)}if(X||D||L.match(/^\/\/[^@\/]+@[^@\/]+/)){var A=L.substr(0,2)==="//";if(A&&!(D&&AY[D]))L=L.substr(2),this.slashes=!0}if(!AY[D]&&(A||D&&!FZ[D])){var q=-1;for(var S=0;S<TG.length;S++){var E=L.indexOf(TG[S]);if(E!==-1&&(q===-1||E<q))q=E}var j,k;if(q===-1)k=L.lastIndexOf("@");else k=L.lastIndexOf("@",q);if(k!==-1)j=L.slice(0,k),L=L.slice(k+1),this.auth=decodeURIComponent(j);q=-1;for(var S=0;S<qG.length;S++){var E=L.indexOf(qG[S]);if(E!==-1&&(q===-1||E<q))q=E}if(q===-1)q=L.length;this.host=L.slice(0,q),L=L.slice(q),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 S=0,x=v.length;S<x;S++){var N=v[S];if(!N)continue;if(!N.match(RG)){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(RG)){var V0=v.slice(0,S),Y0=v.slice(S+1),b=N.match(YW);if(b)V0.push(b[1]),Y0.unshift(b[2]);if(Y0.length)L="/"+Y0.join(".")+L;this.hostname=V0.join(".");break}}}}if(this.hostname.length>XW)this.hostname="";else this.hostname=this.hostname.toLowerCase();if(!B)this.hostname=new zY(`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),L[0]!=="/")L="/"+L}}if(!JW[T])for(var S=0,x=CY.length;S<x;S++){var V=CY[S];if(L.indexOf(V)===-1)continue;var I=encodeURIComponent(V);if(I===V)I=escape(V);L=L.split(V).join(I)}var Q=L.indexOf("#");if(Q!==-1)this.hash=L.substr(Q),L=L.slice(0,Q);var W=L.indexOf("?");if(W!==-1){if(this.search=L.substr(W),this.query=L.substr(W+1),Z)this.query=DY.parse(this.query);L=L.slice(0,W)}else if(Z)this.search="",this.query={};if(L)this.pathname=L;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||"",G=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&&EG(this.query)&&Object.keys(this.query).length)F=DY.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(G&&G.charAt(0)!=="#")G="#"+G;if($&&$.charAt(0)!=="?")$="?"+$;return X=X.replace(/[?#]/g,function(L){return encodeURIComponent(L)}),$=$.replace("#","%23"),Z+K+X+$+G};XU.prototype.resolve=function(U){return this.resolveObject(HZ(U,!1,!0)).format()};XU.prototype.resolveObject=function(U){if(LY(U)){var Z=new XU;Z.parse(U,!1,!0),U=Z}var X=new XU,G=Object.keys(this);for(var K=0;K<G.length;K++){var F=G[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 L=0;L<$.length;L++){var M=$[L];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 D=Object.keys(U);for(var T=0;T<D.length;T++){var A=D[T];X[A]=U[A]}return X.href=X.format(),X}if(X.protocol=U.protocol,!U.host&&!AY[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 q=X.pathname||"",S=X.search||"";X.path=q+S}return X.slashes=X.slashes||U.slashes,X.href=X.format(),X}var E=X.pathname&&X.pathname.charAt(0)==="/",j=U.host||U.pathname&&U.pathname.charAt(0)==="/",k=j||E||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(!aK(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,!AX(X.pathname)||!AX(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(!AX(X.pathname)||!AX(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=iK.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};GW={parse:HZ,resolve:kG,resolveObject:jG,format:PG,Url:XU,URL:zY,URLSearchParams:SG}});var RY={};WZ(RY,{sep:()=>cG,resolve:()=>DX,relative:()=>xG,posix:()=>uG,parse:()=>pG,normalize:()=>TY,join:()=>BG,isAbsolute:()=>_G,format:()=>yG,extname:()=>wG,dirname:()=>gG,delimiter:()=>hG,default:()=>VW,basename:()=>fG,_makeLong:()=>NG});function CU(U){if(typeof U!=="string")throw TypeError("Path must be a string. Received "+JSON.stringify(U))}function vG(U,Z){var X="",G=0,K=-1,F=0,$;for(var L=0;L<=U.length;++L){if(L<U.length)$=U.charCodeAt(L);else if($===47)break;else $=47;if($===47){if(K===L-1||F===1);else if(K!==L-1&&F===2){if(X.length<2||G!==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="",G=0;else X=X.slice(0,M),G=X.length-1-X.lastIndexOf("/");K=L,F=0;continue}}else if(X.length===2||X.length===1){X="",G=0,K=L,F=0;continue}}if(Z){if(X.length>0)X+="/..";else X="..";G=2}}else{if(X.length>0)X+="/"+U.slice(K+1,L);else X=U.slice(K+1,L);G=L-K-1}K=L,F=0}else if($===46&&F!==-1)++F;else F=-1}return X}function QW(U,Z){var X=Z.dir||Z.root,G=Z.base||(Z.name||"")+(Z.ext||"");if(!X)return G;if(X===Z.root)return X+G;return X+U+G}function DX(){var U="",Z=!1,X;for(var G=arguments.length-1;G>=-1&&!Z;G--){var K;if(G>=0)K=arguments[G];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=vG(U,!Z),Z)if(U.length>0)return"/"+U;else return"/";else if(U.length>0)return U;else return"."}function TY(U){if(CU(U),U.length===0)return".";var Z=U.charCodeAt(0)===47,X=U.charCodeAt(U.length-1)===47;if(U=vG(U,!Z),U.length===0&&!Z)U=".";if(U.length>0&&X)U+="/";if(Z)return"/"+U;return U}function _G(U){return CU(U),U.length>0&&U.charCodeAt(0)===47}function BG(){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 TY(U)}function xG(U,Z){if(CU(U),CU(Z),U===Z)return"";if(U=DX(U),Z=DX(Z),U===Z)return"";var X=1;for(;X<U.length;++X)if(U.charCodeAt(X)!==47)break;var G=U.length,K=G-X,F=1;for(;F<Z.length;++F)if(Z.charCodeAt(F)!==47)break;var $=Z.length,L=$-F,M=K<L?K:L,D=-1,T=0;for(;T<=M;++T){if(T===M){if(L>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)D=T;else if(T===0)D=0}break}var A=U.charCodeAt(X+T),q=Z.charCodeAt(F+T);if(A!==q)break;else if(A===47)D=T}var S="";for(T=X+D+1;T<=G;++T)if(T===G||U.charCodeAt(T)===47)if(S.length===0)S+="..";else S+="/..";if(S.length>0)return S+Z.slice(F+D);else{if(F+=D,Z.charCodeAt(F)===47)++F;return Z.slice(F)}}function NG(U){return U}function gG(U){if(CU(U),U.length===0)return".";var Z=U.charCodeAt(0),X=Z===47,G=-1,K=!0;for(var F=U.length-1;F>=1;--F)if(Z=U.charCodeAt(F),Z===47){if(!K){G=F;break}}else K=!1;if(G===-1)return X?"/":".";if(X&&G===1)return"//";return U.slice(0,G)}function fG(U,Z){if(Z!==void 0&&typeof Z!=="string")throw TypeError('"ext" argument must be a string');CU(U);var X=0,G=-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,L=-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(L===-1)K=!1,L=F+1;if($>=0)if(M===Z.charCodeAt($)){if(--$===-1)G=F}else $=-1,G=L}}if(X===G)G=L;else if(G===-1)G=U.length;return U.slice(X,G)}else{for(F=U.length-1;F>=0;--F)if(U.charCodeAt(F)===47){if(!K){X=F+1;break}}else if(G===-1)K=!1,G=F+1;if(G===-1)return"";return U.slice(X,G)}}function wG(U){CU(U);var Z=-1,X=0,G=-1,K=!0,F=0;for(var $=U.length-1;$>=0;--$){var L=U.charCodeAt($);if(L===47){if(!K){X=$+1;break}continue}if(G===-1)K=!1,G=$+1;if(L===46){if(Z===-1)Z=$;else if(F!==1)F=1}else if(Z!==-1)F=-1}if(Z===-1||G===-1||F===0||F===1&&Z===G-1&&Z===X+1)return"";return U.slice(Z,G)}function yG(U){if(U===null||typeof U!=="object")throw TypeError('The "pathObject" argument must be of type Object. Received type '+typeof U);return QW("/",U)}function pG(U){CU(U);var Z={root:"",dir:"",base:"",ext:"",name:""};if(U.length===0)return Z;var X=U.charCodeAt(0),G=X===47,K;if(G)Z.root="/",K=1;else K=0;var F=-1,$=0,L=-1,M=!0,D=U.length-1,T=0;for(;D>=K;--D){if(X=U.charCodeAt(D),X===47){if(!M){$=D+1;break}continue}if(L===-1)M=!1,L=D+1;if(X===46){if(F===-1)F=D;else if(T!==1)T=1}else if(F!==-1)T=-1}if(F===-1||L===-1||T===0||T===1&&F===L-1&&F===$+1){if(L!==-1)if($===0&&G)Z.base=Z.name=U.slice(1,L);else Z.base=Z.name=U.slice($,L)}else{if($===0&&G)Z.name=U.slice(1,F),Z.base=U.slice(1,L);else Z.name=U.slice($,F),Z.base=U.slice($,L);Z.ext=U.slice(F,L)}if($>0)Z.dir=U.slice(0,$-1);else if(G)Z.dir="/";return Z}var cG="/",hG=":",uG,VW;var SY=IZ(()=>{uG=((U)=>(U.posix=U,U))({resolve:DX,normalize:TY,isAbsolute:_G,join:BG,relative:xG,_makeLong:NG,dirname:gG,basename:fG,extname:wG,format:yG,parse:pG,sep:cG,delimiter:hG,win32:null,posix:null}),VW=uG});var N1={};WZ(N1,{transcode:()=>nW,resolveObjectURL:()=>dW,kStringMaxLength:()=>aG,kMaxLength:()=>vZ,isUtf8:()=>lW,isAscii:()=>oW,default:()=>mW,constants:()=>DW,btoa:()=>HW,atob:()=>OW,INSPECT_MAX_BYTES:()=>rG,File:()=>CW,Buffer:()=>W0,Blob:()=>AW});function $W(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 G=X===Z?0:4-X%4;return[X,G]}function KW(U,Z){return(U+Z)*3/4-Z}function WW(U){var Z,X=$W(U),G=X[0],K=X[1],F=new Uint8Array(KW(G,K)),$=0,L=K>0?G-4:G,M;for(M=0;M<L;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 IW(U){return AU[U>>18&63]+AU[U>>12&63]+AU[U>>6&63]+AU[U&63]}function FW(U,Z,X){var G,K=[];for(var F=Z;F<X;F+=3)G=(U[F]<<16&16711680)+(U[F+1]<<8&65280)+(U[F+2]&255),K.push(IW(G));return K.join("")}function dG(U){var Z,X=U.length,G=X%3,K=[],F=16383;for(var $=0,L=X-G;$<L;$+=F)K.push(FW(U,$,$+F>L?L:$+F));if(G===1)Z=U[X-1],K.push(AU[Z>>2]+AU[Z<<4&63]+"==");else if(G===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,G,K){var F,$,L=K*8-G-1,M=(1<<L)-1,D=M>>1,T=-7,A=X?K-1:0,q=X?-1:1,S=U[Z+A];A+=q,F=S&(1<<-T)-1,S>>=-T,T+=L;for(;T>0;F=F*256+U[Z+A],A+=q,T-=8);$=F&(1<<-T)-1,F>>=-T,T+=G;for(;T>0;$=$*256+U[Z+A],A+=q,T-=8);if(F===0)F=1-D;else if(F===M)return $?NaN:(S?-1:1)*(1/0);else $=$+Math.pow(2,G),F=F-D;return(S?-1:1)*$*Math.pow(2,F-G)}function sG(U,Z,X,G,K,F){var $,L,M,D=F*8-K-1,T=(1<<D)-1,A=T>>1,q=K===23?Math.pow(2,-24)-Math.pow(2,-77):0,S=G?0:F-1,E=G?1:-1,j=Z<0||Z===0&&1/Z<0?1:0;if(Z=Math.abs(Z),isNaN(Z)||Z===1/0)L=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+=q/M;else Z+=q*Math.pow(2,1-A);if(Z*M>=2)$++,M/=2;if($+A>=T)L=0,$=T;else if($+A>=1)L=(Z*M-1)*Math.pow(2,K),$=$+A;else L=Z*Math.pow(2,A-1)*Math.pow(2,K),$=0}for(;K>=8;U[X+S]=L&255,S+=E,L/=256,K-=8);$=$<<K|L,D+=K;for(;D>0;U[X+S]=$&255,S+=E,$/=256,D-=8);U[X+S-E]|=j*128}function EU(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 _Y(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(G){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:G,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 BY(U)}return tG(U,Z,X)}function tG(U,Z,X){if(typeof U==="string")return qW(U,Z);if(ArrayBuffer.isView(U))return TW(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(DU(U,ArrayBuffer)||U&&DU(U.buffer,ArrayBuffer))return jY(U,Z,X);if(typeof SharedArrayBuffer<"u"&&(DU(U,SharedArrayBuffer)||U&&DU(U.buffer,SharedArrayBuffer)))return jY(U,Z,X);if(typeof U==="number")throw TypeError('The "value" argument must not be of type number. Received type number');let G=U.valueOf&&U.valueOf();if(G!=null&&G!==U)return W0.from(G,Z,X);let K=RW(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 iG(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 MW(U,Z,X){if(iG(U),U<=0)return EU(U);if(Z!==void 0)return typeof X==="string"?EU(U).fill(Z,X):EU(U).fill(Z);return EU(U)}function BY(U){return iG(U),EU(U<0?0:xY(U)|0)}function qW(U,Z){if(typeof Z!=="string"||Z==="")Z="utf8";if(!W0.isEncoding(Z))throw TypeError("Unknown encoding: "+Z);let X=eG(U,Z)|0,G=EU(X),K=G.write(U,Z);if(K!==X)G=G.slice(0,K);return G}function kY(U){let Z=U.length<0?0:xY(U.length)|0,X=EU(Z);for(let G=0;G<Z;G+=1)X[G]=U[G]&255;return X}function TW(U){if(DU(U,Uint8Array)){let Z=new Uint8Array(U);return jY(Z.buffer,Z.byteOffset,Z.byteLength)}return kY(U)}function jY(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 G;if(Z===void 0&&X===void 0)G=new Uint8Array(U);else if(X===void 0)G=new Uint8Array(U,Z);else G=new Uint8Array(U,Z,X);return Object.setPrototypeOf(G,W0.prototype),G}function RW(U){if(W0.isBuffer(U)){let Z=xY(U.length)|0,X=EU(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 EU(0);return kY(U)}if(U.type==="Buffer"&&Array.isArray(U.data))return kY(U.data)}function xY(U){if(U>=vZ)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+vZ.toString(16)+" bytes");return U|0}function eG(U,Z){if(W0.isBuffer(U))return U.length;if(ArrayBuffer.isView(U)||DU(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,G=arguments.length>2&&arguments[2]===!0;if(!G&&X===0)return 0;let K=!1;for(;;)switch(Z){case"ascii":case"latin1":case"binary":return X;case"utf8":case"utf-8":return vY(U).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return X*2;case"hex":return X>>>1;case"base64":return $Q(U).length;default:if(K)return G?-1:vY(U).length;Z=(""+Z).toLowerCase(),K=!0}}function SW(U,Z,X){let G=!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 gW(this,Z,X);case"utf8":case"utf-8":return ZQ(this,Z,X);case"ascii":return xW(this,Z,X);case"latin1":case"binary":return NW(this,Z,X);case"base64":return _W(this,Z,X);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return fW(this,Z,X);default:if(G)throw TypeError("Unknown encoding: "+U);U=(U+"").toLowerCase(),G=!0}}function sU(U,Z,X){let G=U[Z];U[Z]=U[X],U[X]=G}function UQ(U,Z,X,G,K){if(U.length===0)return-1;if(typeof X==="string")G=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,G);if(W0.isBuffer(Z)){if(Z.length===0)return-1;return oG(U,Z,X,G,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 oG(U,[Z],X,G,K)}throw TypeError("val must be string, number or Buffer")}function oG(U,Z,X,G,K){let F=1,$=U.length,L=Z.length;if(G!==void 0){if(G=String(G).toLowerCase(),G==="ucs2"||G==="ucs-2"||G==="utf16le"||G==="utf-16le"){if(U.length<2||Z.length<2)return-1;F=2,$/=2,L/=2,X/=2}}function M(T,A){if(F===1)return T[A];else return T.readUInt16BE(A*F)}let D;if(K){let T=-1;for(D=X;D<$;D++)if(M(U,D)===M(Z,T===-1?0:D-T)){if(T===-1)T=D;if(D-T+1===L)return T*F}else{if(T!==-1)D-=D-T;T=-1}}else{if(X+L>$)X=$-L;for(D=X;D>=0;D--){let T=!0;for(let A=0;A<L;A++)if(M(U,D+A)!==M(Z,A)){T=!1;break}if(T)return D}}return-1}function EW(U,Z,X,G){X=Number(X)||0;let K=U.length-X;if(!G)G=K;else if(G=Number(G),G>K)G=K;let F=Z.length;if(G>F/2)G=F/2;let $;for($=0;$<G;++$){let L=parseInt(Z.substr($*2,2),16);if(Number.isNaN(L))return $;U[X+$]=L}return $}function PW(U,Z,X,G){return LX(vY(Z,U.length-X),U,X,G)}function kW(U,Z,X,G){return LX(cW(Z),U,X,G)}function jW(U,Z,X,G){return LX($Q(Z),U,X,G)}function vW(U,Z,X,G){return LX(hW(Z,U.length-X),U,X,G)}function _W(U,Z,X){if(Z===0&&X===U.length)return dG(U);else return dG(U.slice(Z,X))}function ZQ(U,Z,X){X=Math.min(U.length,X);let G=[],K=Z;while(K<X){let F=U[K],$=null,L=F>239?4:F>223?3:F>191?2:1;if(K+L<=X){let M,D,T,A;switch(L){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],D=U[K+2],(M&192)===128&&(D&192)===128){if(A=(F&15)<<12|(M&63)<<6|D&63,A>2047&&(A<55296||A>57343))$=A}break;case 4:if(M=U[K+1],D=U[K+2],T=U[K+3],(M&192)===128&&(D&192)===128&&(T&192)===128){if(A=(F&15)<<18|(M&63)<<12|(D&63)<<6|T&63,A>65535&&A<1114112)$=A}}}if($===null)$=65533,L=1;else if($>65535)$-=65536,G.push($>>>10&1023|55296),$=56320|$&1023;G.push($),K+=L}return BW(G)}function BW(U){let Z=U.length;if(Z<=nG)return String.fromCharCode.apply(String,U);let X="",G=0;while(G<Z)X+=String.fromCharCode.apply(String,U.slice(G,G+=nG));return X}function xW(U,Z,X){let G="";X=Math.min(U.length,X);for(let K=Z;K<X;++K)G+=String.fromCharCode(U[K]&127);return G}function NW(U,Z,X){let G="";X=Math.min(U.length,X);for(let K=Z;K<X;++K)G+=String.fromCharCode(U[K]);return G}function gW(U,Z,X){let G=U.length;if(!Z||Z<0)Z=0;if(!X||X<0||X>G)X=G;let K="";for(let F=Z;F<X;++F)K+=uW[U[F]];return K}function fW(U,Z,X){let G=U.slice(Z,X),K="";for(let F=0;F<G.length-1;F+=2)K+=String.fromCharCode(G[F]+G[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,G,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+G>U.length)throw RangeError("Index out of range")}function XQ(U,Z,X,G,K){VQ(Z,G,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 YQ(U,Z,X,G,K){VQ(Z,G,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 JQ(U,Z,X,G,K,F){if(X+G>U.length)throw RangeError("Index out of range");if(X<0)throw RangeError("Index out of range")}function GQ(U,Z,X,G,K){if(Z=+Z,X=X>>>0,!K)JQ(U,Z,X,4,340282346638528860000000000000000000000,-340282346638528860000000000000000000000);return sG(U,Z,X,G,23,4),X+4}function QQ(U,Z,X,G,K){if(Z=+Z,X=X>>>0,!K)JQ(U,Z,X,8,179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);return sG(U,Z,X,G,52,8),X+8}function mG(U){let Z="",X=U.length,G=U[0]==="-"?1:0;for(;X>=G+4;X-=3)Z=`_${U.slice(X-3,X)}${Z}`;return`${U.slice(0,X)}${Z}`}function wW(U,Z,X){if(OZ(Z,"offset"),U[Z]===void 0||U[Z+X]===void 0)_Z(Z,U.length-(X+1))}function VQ(U,Z,X,G,K,F){if(U>X||U<Z){let $=typeof Z==="bigint"?"n":"",L;if(F>3)if(Z===0||Z===BigInt(0))L=`>= 0${$} and < 2${$} ** ${(F+1)*8}${$}`;else L=`>= -(2${$} ** ${(F+1)*8-1}${$}) and < 2 ** ${(F+1)*8-1}${$}`;else L=`>= ${Z}${$} and <= ${X}${$}`;throw new PY("value",L,U)}wW(G,K,F)}function OZ(U,Z){if(typeof U!=="number")throw new LW(Z,"number",U)}function _Z(U,Z,X){if(Math.floor(U)!==U)throw OZ(U,X),new PY(X||"offset","an integer",U);if(Z<0)throw new zW;throw new PY(X||"offset",`>= ${X?1:0} and <= ${Z}`,U)}function pW(U){if(U=U.split("=")[0],U=U.trim().replace(yW,""),U.length<2)return"";while(U.length%4!==0)U=U+"=";return U}function vY(U,Z){Z=Z||1/0;let X,G=U.length,K=null,F=[];for(let $=0;$<G;++$){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===G){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 cW(U){let Z=[];for(let X=0;X<U.length;++X)Z.push(U.charCodeAt(X)&255);return Z}function hW(U,Z){let X,G,K,F=[];for(let $=0;$<U.length;++$){if((Z-=2)<0)break;X=U.charCodeAt($),G=X>>8,K=X%256,F.push(K),F.push(G)}return F}function $Q(U){return WW(pW(U))}function LX(U,Z,X,G){let K;for(K=0;K<G;++K){if(K+X>=Z.length||K>=U.length)break;Z[K+X]=U[K]}return K}function DU(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"?bW:U}function bW(){throw Error("BigInt not supported")}function NY(U){return()=>{throw Error(U+" is not implemented for node:buffer browser polyfill")}}var AU,KU,EY="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",mU,bG,lG,rG=50,vZ=2147483647,aG=536870888,HW,OW,CW,AW,DW,zW,LW,PY,nG=4096,yW,uW,dW,lW,oW=(U)=>{for(let Z of U)if(Z.charCodeAt(0)>127)return!1;return!0},nW,mW;var g1=IZ(()=>{AU=[],KU=[];for(mU=0,bG=EY.length;mU<bG;++mU)AU[mU]=EY[mU],KU[EY.charCodeAt(mU)]=mU;KU[45]=62;KU[95]=63;lG=typeof Symbol==="function"&&typeof Symbol.for==="function"?Symbol.for("nodejs.util.inspect.custom"):null,HW=globalThis.btoa,OW=globalThis.atob,CW=globalThis.File,AW=globalThis.Blob,DW={MAX_LENGTH:vZ,MAX_STRING_LENGTH:aG};zW=_Y("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),LW=_Y("ERR_INVALID_ARG_TYPE",function(U,Z){return`The "${U}" argument must be of type number. Received type ${typeof Z}`},TypeError),PY=_Y("ERR_OUT_OF_RANGE",function(U,Z,X){let G=`The value of "${U}" is out of range.`,K=X;if(Number.isInteger(X)&&Math.abs(X)>4294967296)K=mG(String(X));else if(typeof X==="bigint"){if(K=String(X),X>BigInt(2)**BigInt(32)||X<-(BigInt(2)**BigInt(32)))K=mG(K);K+="n"}return G+=` It must be ${Z}. Received ${K}`,G},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 tG(U,Z,X)};Object.setPrototypeOf(W0.prototype,Uint8Array.prototype);Object.setPrototypeOf(W0,Uint8Array);W0.alloc=function(U,Z,X){return MW(U,Z,X)};W0.allocUnsafe=function(U){return BY(U)};W0.allocUnsafeSlow=function(U){return BY(U)};W0.isBuffer=function(U){return U!=null&&U._isBuffer===!0&&U!==W0.prototype};W0.compare=function(U,Z){if(DU(U,Uint8Array))U=W0.from(U,U.offset,U.byteLength);if(DU(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,G=Z.length;for(let K=0,F=Math.min(X,G);K<F;++K)if(U[K]!==Z[K]){X=U[K],G=Z[K];break}if(X<G)return-1;if(G<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 G=W0.allocUnsafe(Z),K=0;for(X=0;X<U.length;++X){let F=U[X];if(DU(F,Uint8Array))if(K+F.length>G.length){if(!W0.isBuffer(F))F=W0.from(F);F.copy(G,K)}else Uint8Array.prototype.set.call(G,F,K);else if(!W0.isBuffer(F))throw TypeError('"list" argument must be an Array of Buffers');else F.copy(G,K);K+=F.length}return G};W0.byteLength=eG;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 ZQ(this,0,U);return SW.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=rG;if(U=this.toString("hex",0,Z).replace(/(.{2})/g,"$1 ").trim(),this.length>Z)U+=" ... ";return"<Buffer "+U+">"};if(lG)W0.prototype[lG]=W0.prototype.inspect;W0.prototype.compare=function(U,Z,X,G,K){if(DU(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(G===void 0)G=0;if(K===void 0)K=this.length;if(Z<0||X>U.length||G<0||K>this.length)throw RangeError("out of range index");if(G>=K&&Z>=X)return 0;if(G>=K)return-1;if(Z>=X)return 1;if(Z>>>=0,X>>>=0,G>>>=0,K>>>=0,this===U)return 0;let F=K-G,$=X-Z,L=Math.min(F,$),M=this.slice(G,K),D=U.slice(Z,X);for(let T=0;T<L;++T)if(M[T]!==D[T]){F=M[T],$=D[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 UQ(this,U,Z,X,!0)};W0.prototype.lastIndexOf=function(U,Z,X){return UQ(this,U,Z,X,!1)};W0.prototype.write=function(U,Z,X,G){if(Z===void 0)G="utf8",X=this.length,Z=0;else if(X===void 0&&typeof Z==="string")G=Z,X=this.length,Z=0;else if(isFinite(Z))if(Z=Z>>>0,isFinite(X)){if(X=X>>>0,G===void 0)G="utf8"}else G=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(!G)G="utf8";let F=!1;for(;;)switch(G){case"hex":return EW(this,U,Z,X);case"utf8":case"utf-8":return PW(this,U,Z,X);case"ascii":case"latin1":case"binary":return kW(this,U,Z,X);case"base64":return jW(this,U,Z,X);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return vW(this,U,Z,X);default:if(F)throw TypeError("Unknown encoding: "+G);G=(""+G).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 G=this.subarray(U,Z);return Object.setPrototypeOf(G,W0.prototype),G};W0.prototype.readUintLE=W0.prototype.readUIntLE=function(U,Z,X){if(U=U>>>0,Z=Z>>>0,!X)x1(U,Z,this.length);let G=this[U],K=1,F=0;while(++F<Z&&(K*=256))G+=this[U+F]*K;return G};W0.prototype.readUintBE=W0.prototype.readUIntBE=function(U,Z,X){if(U=U>>>0,Z=Z>>>0,!X)x1(U,Z,this.length);let G=this[U+--Z],K=1;while(Z>0&&(K*=256))G+=this[U+--Z]*K;return G};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 G=Z+this[++U]*256+this[++U]*65536+this[++U]*16777216,K=this[++U]+this[++U]*256+this[++U]*65536+X*16777216;return BigInt(G)+(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 G=Z*16777216+this[++U]*65536+this[++U]*256+this[++U],K=this[++U]*16777216+this[++U]*65536+this[++U]*256+X;return(BigInt(G)<<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 G=this[U],K=1,F=0;while(++F<Z&&(K*=256))G+=this[U+F]*K;if(K*=128,G>=K)G-=Math.pow(2,8*Z);return G};W0.prototype.readIntBE=function(U,Z,X){if(U=U>>>0,Z=Z>>>0,!X)x1(U,Z,this.length);let G=Z,K=1,F=this[U+--G];while(G>0&&(K*=256))F+=this[U+--G]*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 G=this[U+4]+this[U+5]*256+this[U+6]*65536+(X<<24);return(BigInt(G)<<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 G=(Z<<24)+this[++U]*65536+this[++U]*256+this[++U];return(BigInt(G)<<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,G){if(U=+U,Z=Z>>>0,X=X>>>0,!G){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,G){if(U=+U,Z=Z>>>0,X=X>>>0,!G){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 XQ(this,U,Z,BigInt(0),BigInt("0xffffffffffffffff"))});W0.prototype.writeBigUInt64BE=fU(function(U,Z=0){return YQ(this,U,Z,BigInt(0),BigInt("0xffffffffffffffff"))});W0.prototype.writeIntLE=function(U,Z,X,G){if(U=+U,Z=Z>>>0,!G){let L=Math.pow(2,8*X-1);t1(this,U,Z,X,L-1,-L)}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,G){if(U=+U,Z=Z>>>0,!G){let L=Math.pow(2,8*X-1);t1(this,U,Z,X,L-1,-L)}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 XQ(this,U,Z,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});W0.prototype.writeBigInt64BE=fU(function(U,Z=0){return YQ(this,U,Z,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});W0.prototype.writeFloatLE=function(U,Z,X){return GQ(this,U,Z,!0,X)};W0.prototype.writeFloatBE=function(U,Z,X){return GQ(this,U,Z,!1,X)};W0.prototype.writeDoubleLE=function(U,Z,X){return QQ(this,U,Z,!0,X)};W0.prototype.writeDoubleBE=function(U,Z,X){return QQ(this,U,Z,!1,X)};W0.prototype.copy=function(U,Z,X,G){if(!W0.isBuffer(U))throw TypeError("argument should be a Buffer");if(!X)X=0;if(!G&&G!==0)G=this.length;if(Z>=U.length)Z=U.length;if(!Z)Z=0;if(G>0&&G<X)G=X;if(G===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(G<0)throw RangeError("sourceEnd out of bounds");if(G>this.length)G=this.length;if(U.length-Z<G-X)G=U.length-Z+X;let K=G-X;if(this===U&&typeof Uint8Array.prototype.copyWithin==="function")this.copyWithin(Z,X,G);else Uint8Array.prototype.set.call(U,this.subarray(X,G),Z);return K};W0.prototype.fill=function(U,Z,X,G){if(typeof U==="string"){if(typeof Z==="string")G=Z,Z=0,X=this.length;else if(typeof X==="string")G=X,X=this.length;if(G!==void 0&&typeof G!=="string")throw TypeError("encoding must be a string");if(typeof G==="string"&&!W0.isEncoding(G))throw TypeError("Unknown encoding: "+G);if(U.length===1){let F=U.charCodeAt(0);if(G==="utf8"&&F<128||G==="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,G),$=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};yW=/[^+/0-9A-Za-z-_]/g;uW=function(){let U=Array(256);for(let Z=0;Z<16;++Z){let X=Z*16;for(let G=0;G<16;++G)U[X+G]="0123456789abcdef"[Z]+"0123456789abcdef"[G]}return U}();dW=NY("resolveObjectURL"),lW=NY("isUtf8"),nW=NY("transcode"),mW=W0});var zQ={};WZ(zQ,{types:()=>YI,promisify:()=>OQ,log:()=>IQ,isUndefined:()=>CZ,isSymbol:()=>GI,isString:()=>EX,isRegExp:()=>MX,isPrimitive:()=>QI,isObject:()=>AZ,isNumber:()=>WQ,isNullOrUndefined:()=>JI,isNull:()=>SX,isFunction:()=>TX,isError:()=>qX,isDate:()=>yY,isBuffer:()=>VI,isBoolean:()=>cY,isArray:()=>KQ,inspect:()=>rU,inherits:()=>FQ,format:()=>pY,deprecate:()=>rW,default:()=>WI,debuglog:()=>aW,callbackifyOnRejected:()=>bY,callbackify:()=>CQ,_extend:()=>uY,TextEncoder:()=>AQ,TextDecoder:()=>DQ});function pY(U,...Z){if(!EX(U)){var X=[U];for(var G=0;G<Z.length;G++)X.push(rU(Z[G]));return X.join(" ")}var G=0,K=Z.length,F=String(U).replace(sW,function(L){if(L==="%%")return"%";if(G>=K)return L;switch(L){case"%s":return String(Z[G++]);case"%d":return Number(Z[G++]);case"%j":try{return JSON.stringify(Z[G++])}catch(M){return"[Circular]"}default:return L}});for(var $=Z[G];G<K;$=Z[++G])if(SX($)||!AZ($))F+=" "+$;else F+=" "+rU($);return F}function rW(U,Z){if(typeof process>"u"||process?.noDeprecation===!0)return U;var X=!1;function G(...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 G}function tW(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 iW(U,Z){return U}function eW(U){var Z={};return U.forEach(function(X,G){Z[X]=!0}),Z}function RX(U,Z,X){if(U.customInspect&&Z&&TX(Z.inspect)&&Z.inspect!==rU&&!(Z.constructor&&Z.constructor.prototype===Z)){var G=Z.inspect(X,U);if(!EX(G))G=RX(U,G,X);return G}var K=UI(U,Z);if(K)return K;var F=Object.keys(Z),$=eW(F);if(U.showHidden)F=Object.getOwnPropertyNames(Z);if(qX(Z)&&(F.indexOf("message")>=0||F.indexOf("description")>=0))return gY(Z);if(F.length===0){if(TX(Z)){var L=Z.name?": "+Z.name:"";return U.stylize("[Function"+L+"]","special")}if(MX(Z))return U.stylize(RegExp.prototype.toString.call(Z),"regexp");if(yY(Z))return U.stylize(Date.prototype.toString.call(Z),"date");if(qX(Z))return gY(Z)}var M="",D=!1,T=["{","}"];if(KQ(Z))D=!0,T=["[","]"];if(TX(Z)){var A=Z.name?": "+Z.name:"";M=" [Function"+A+"]"}if(MX(Z))M=" "+RegExp.prototype.toString.call(Z);if(yY(Z))M=" "+Date.prototype.toUTCString.call(Z);if(qX(Z))M=" "+gY(Z);if(F.length===0&&(!D||Z.length==0))return T[0]+M+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 q;if(D)q=ZI(U,Z,X,$,F);else q=F.map(function(S){return wY(U,Z,X,$,S,D)});return U.seen.pop(),XI(q,M,T)}function UI(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(WQ(Z))return U.stylize(""+Z,"number");if(cY(Z))return U.stylize(""+Z,"boolean");if(SX(Z))return U.stylize("null","null")}function gY(U){return"["+Error.prototype.toString.call(U)+"]"}function ZI(U,Z,X,G,K){var F=[];for(var $=0,L=Z.length;$<L;++$)if(HQ(Z,String($)))F.push(wY(U,Z,X,G,String($),!0));else F.push("");return K.forEach(function(M){if(!M.match(/^\d+$/))F.push(wY(U,Z,X,G,M,!0))}),F}function wY(U,Z,X,G,K,F){var $,L,M;if(M=Object.getOwnPropertyDescriptor(Z,K)||{value:Z[K]},M.get)if(M.set)L=U.stylize("[Getter/Setter]","special");else L=U.stylize("[Getter]","special");else if(M.set)L=U.stylize("[Setter]","special");if(!HQ(G,K))$="["+K+"]";if(!L)if(U.seen.indexOf(M.value)<0){if(SX(X))L=RX(U,M.value,null);else L=RX(U,M.value,X-1);if(L.indexOf(`
|
|
3
|
-
`)>-1)if(F)L=L.split(`
|
|
4
|
-
`).map(function(D){return" "+D}).join(`
|
|
5
|
-
`).slice(2);else L=`
|
|
6
|
-
`+L.split(`
|
|
7
|
-
`).map(function(D){return" "+D}).join(`
|
|
8
|
-
`)}else L=U.stylize("[Circular]","special");if(CZ($)){if(F&&K.match(/^\d+$/))return L;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 $+": "+L}function XI(U,Z,X){var G=0,K=U.reduce(function(F,$){if(G++,$.indexOf(`
|
|
9
|
-
`)>=0)G++;return F+$.replace(/\u001b\[\d\d?m/g,"").length+1},0);if(K>60)return X[0]+(Z===""?"":Z+`
|
|
10
|
-
`)+" "+U.join(`,
|
|
11
|
-
`)+" "+X[1];return X[0]+Z+" "+U.join(", ")+" "+X[1]}function KQ(U){return Array.isArray(U)}function cY(U){return typeof U==="boolean"}function SX(U){return U===null}function JI(U){return U==null}function WQ(U){return typeof U==="number"}function EX(U){return typeof U==="string"}function GI(U){return typeof U==="symbol"}function CZ(U){return U===void 0}function MX(U){return AZ(U)&&hY(U)==="[object RegExp]"}function AZ(U){return typeof U==="object"&&U!==null}function yY(U){return AZ(U)&&hY(U)==="[object Date]"}function qX(U){return AZ(U)&&(hY(U)==="[object Error]"||U instanceof Error)}function TX(U){return typeof U==="function"}function QI(U){return U===null||typeof U==="boolean"||typeof U==="number"||typeof U==="string"||typeof U==="symbol"||typeof U>"u"}function VI(U){return U instanceof Buffer}function hY(U){return Object.prototype.toString.call(U)}function fY(U){return U<10?"0"+U.toString(10):U.toString(10)}function KI(){var U=new Date,Z=[fY(U.getHours()),fY(U.getMinutes()),fY(U.getSeconds())].join(":");return[U.getDate(),$I[U.getMonth()],Z].join(" ")}function IQ(...U){console.log("%s - %s",KI(),pY.apply(null,U))}function FQ(U,Z){if(Z)U.super_=Z,U.prototype=Object.create(Z.prototype,{constructor:{value:U,enumerable:!1,writable:!0,configurable:!0}})}function uY(U,Z){if(!Z||!AZ(Z))return U;var X=Object.keys(Z),G=X.length;while(G--)U[X[G]]=Z[X[G]];return U}function HQ(U,Z){return Object.prototype.hasOwnProperty.call(U,Z)}function bY(U,Z){if(!U){var X=Error("Promise was rejected with a falsy value");X.reason=U,U=X}return Z(U)}function CQ(U){if(typeof U!=="function")throw TypeError('The "original" argument must be of type Function');function Z(...X){var G=X.pop();if(typeof G!=="function")throw TypeError("The last argument must be of type Function");var K=this,F=function(...$){return G.apply(K,...$)};U.apply(this,X).then(function($){process.nextTick(F.bind(null,null,$))},function($){process.nextTick(bY.bind(null,$,F))})}return Object.setPrototypeOf(Z,Object.getPrototypeOf(U)),Object.defineProperties(Z,Object.getOwnPropertyDescriptors(U)),Z}var sW,aW,rU,YI=()=>{},$I,OQ,AQ,DQ,WI;var LQ=IZ(()=>{sW=/%[sdj%]/g;aW=((U={},Z={},X)=>((X=typeof process<"u"&&!1)&&(X=X.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase()),Z=new RegExp("^"+X+"$","i"),(G)=>{if(G=G.toUpperCase(),!U[G])if(Z.test(G))U[G]=function(...K){console.error("%s: %s",G,pid,pY.apply(null,...K))};else U[G]=function(){};return U[G]}))(),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 G={seen:[],stylize:iW};if(X.length>=1)G.depth=X[0];if(X.length>=2)G.colors=X[1];if(cY(Z))G.showHidden=Z;else if(Z)uY(G,Z);if(CZ(G.showHidden))G.showHidden=!1;if(CZ(G.depth))G.depth=2;if(CZ(G.colors))G.colors=!1;if(G.colors)G.stylize=tW;return RX(G,U,G.depth)});$I=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];OQ=((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 G,K,F=new Promise(function($,L){G=$,K=L});X.push(function($,L){if($)K($);else G(L)});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:AQ,TextDecoder:DQ}=globalThis),WI={TextEncoder:AQ,TextDecoder:DQ,promisify:OQ,log:IQ,inherits:FQ,_extend:uY,callbackifyOnRejected:bY,callbackify:CQ}});var xZ={};WZ(xZ,{setMaxListeners:()=>_Q,once:()=>jQ,listenerCount:()=>BQ,init:()=>wU,getMaxListeners:()=>NQ,getEventListeners:()=>vQ,default:()=>LI,captureRejectionSymbol:()=>SQ,addAbortListener:()=>gQ,EventEmitter:()=>wU});function EQ(U,Z){var{_events:X}=U;if(Z[0]??=Error("Unhandled error."),!X)throw Z[0];var G=X[RQ];if(G)for(var K of qQ.call(G))K.apply(U,Z);var F=X.error;if(!F)throw Z[0];for(var K of qQ.call(F))K.apply(U,Z);return!0}function HI(U,Z,X,G){Z.then(void 0,function(K){queueMicrotask(()=>OI(U,K,X,G))})}function OI(U,Z,X,G){if(typeof U[MQ]==="function")U[MQ](Z,X,...G);else try{U[aU]=!1,U.emit("error",Z)}finally{U[aU]=!0}}function PQ(U,Z,X){X.warned=!0;let G=Error(`Possible EventEmitter memory leak detected. ${X.length} ${String(Z)} listeners added to [${U.constructor.name}]. Use emitter.setMaxListeners() to increase limit`);G.name="MaxListenersExceededWarning",G.emitter=U,G.type=Z,G.count=X.length,console.warn(G)}function kQ(U,Z,...X){this.removeListener(U,Z),Z.apply(this,X)}function jQ(U,Z,X){var G=X?.signal;if(xQ(G,"options.signal"),G?.aborted)throw new dY(void 0,{cause:G?.reason});let{resolve:K,reject:F,promise:$}=$newPromiseCapability(Promise),L=(T)=>{if(U.removeListener(Z,M),G!=null)PX(G,"abort",D);F(T)},M=(...T)=>{if(typeof U.removeListener==="function")U.removeListener("error",L);if(G!=null)PX(G,"abort",D);K(T)};if(TQ(U,Z,M,{once:!0}),Z!=="error"&&typeof U.once==="function")U.once("error",L);function D(){PX(U,Z,M),PX(U,"error",L),F(new dY(void 0,{cause:G?.reason}))}if(G!=null)TQ(G,"abort",D,{once:!0});return $}function vQ(U,Z){return U.listeners(Z)}function _Q(U,...Z){oY(U,"setMaxListeners",0);var X;if(Z&&(X=Z.length))for(let G=0;G<X;G++)Z[G].setMaxListeners(U);else tU=U}function BQ(U,Z){return U.listenerCount(Z)}function PX(U,Z,X,G){if(typeof U.removeListener==="function")U.removeListener(Z,X);else U.removeEventListener(Z,X,G)}function TQ(U,Z,X,G){if(typeof U.on==="function")if(G.once)U.once(Z,X);else U.on(Z,X);else U.addEventListener(Z,X,G)}function DZ(U,Z,X){let G=TypeError(`The "${U}" argument must be of type ${Z}. Received ${X}`);return G.code="ERR_INVALID_ARG_TYPE",G}function DI(U,Z,X){let G=RangeError(`The "${U}" argument is out of range. It must be ${Z}. Received ${X}`);return G.code="ERR_OUT_OF_RANGE",G}function xQ(U,Z){if(U!==void 0&&(U===null||typeof U!=="object"||!("aborted"in U)))throw DZ(Z,"AbortSignal",U)}function oY(U,Z,X,G){if(typeof U!=="number")throw DZ(Z,"number",U);if(X!=null&&U<X||G!=null&&U>G||(X!=null||G!=null)&&Number.isNaN(U))throw DI(Z,`${X!=null?`>= ${X}`:""}${X!=null&&G!=null?" && ":""}${G!=null?`<= ${G}`:""}`,U)}function BZ(U){if(typeof U!=="function")throw TypeError("The listener must be a function")}function zI(U,Z){if(typeof U!=="boolean")throw DZ(Z,"boolean",U)}function NQ(U){return U?._maxListeners??tU}function gQ(U,Z){if(U===void 0)throw DZ("signal","AbortSignal",U);if(xQ(U,"signal"),typeof Z!=="function")throw DZ("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 lY,aU,RQ,II,FI,MQ,SQ,qQ,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=AI},i0,CI=function(U,...Z){if(U==="error")return EQ(this,Z);var{_events:X}=this;if(X===void 0)return!1;var G=X[U];if(G===void 0)return!1;let K=G.length>1?G.slice():G;for(let F=0,{length:$}=K;F<$;F++){let L=K[F];switch(Z.length){case 0:L.call(this);break;case 1:L.call(this,Z[0]);break;case 2:L.call(this,Z[0],Z[1]);break;case 3:L.call(this,Z[0],Z[1],Z[2]);break;default:L.apply(this,Z);break}}return!0},AI=function(U,...Z){if(U==="error")return EQ(this,Z);var{_events:X}=this;if(X===void 0)return!1;var G=X[U];if(G===void 0)return!1;let K=G.length>1?G.slice():G;for(let F=0,{length:$}=K;F<$;F++){let L=K[F],M;switch(Z.length){case 0:M=L.call(this);break;case 1:M=L.call(this,Z[0]);break;case 2:M=L.call(this,Z[0],Z[1]);break;case 3:M=L.call(this,Z[0],Z[1],Z[2]);break;default:M=L.apply(this,Z);break}if(M!==void 0&&typeof M?.then==="function"&&M.then===Promise.prototype.then)HI(this,M,U,Z)}return!0},dY,LI;var NZ=IZ(()=>{lY=Symbol.for,aU=Symbol("kCapture"),RQ=lY("events.errorMonitor"),II=Symbol("events.maxEventTargetListeners"),FI=Symbol("events.maxEventTargetListenersWarned"),MQ=lY("nodejs.rejection"),SQ=lY("nodejs.rejection"),qQ=Array.prototype.slice,i0=wU.prototype={};i0._events=void 0;i0._eventsCount=0;i0._maxListeners=void 0;i0.setMaxListeners=function(U){return oY(U,"setMaxListeners",0),this._maxListeners=U,this};i0.constructor=wU;i0.getMaxListeners=function(){return this?._maxListeners??tU};i0.emit=CI;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 G=X[U];if(!G)X[U]=[Z],this._eventsCount++;else{G.push(Z);var K=this._maxListeners??tU;if(K>0&&G.length>K&&!G.warned)PQ(this,U,G)}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 G=X[U];if(!G)X[U]=[Z],this._eventsCount++;else{G.unshift(Z);var K=this._maxListeners??tU;if(K>0&&G.length>K&&!G.warned)PQ(this,U,G)}return this};i0.once=function(U,Z){BZ(Z);let X=kQ.bind(this,U,Z);return X.listener=Z,this.addListener(U,X),this};i0.prependOnceListener=function(U,Z){BZ(Z);let X=kQ.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 G=X[U];if(!G)return this;var K=G.length;let F=-1;for(let $=K-1;$>=0;$--)if(G[$]===Z||G[$].listener===Z){F=$;break}if(F<0)return this;if(F===0)G.shift();else G.splice(F,1);if(G.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((G)=>G.listener??G)};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;dY=class dY extends Error{constructor(U="The operation was aborted",Z=void 0){if(Z!==void 0&&typeof Z!=="object")throw DZ("options","Object",Z);super(U,Z);this.code="ABORT_ERR",this.name="AbortError"}};Object.defineProperties(wU,{captureRejections:{get(){return i0[aU]},set(U){zI(U,"EventEmitter.captureRejections"),i0[aU]=U},enumerable:!0},defaultMaxListeners:{enumerable:!0,get:()=>{return tU},set:(U)=>{oY(U,"defaultMaxListeners",0),tU=U}},kMaxEventTargetListeners:{value:II,enumerable:!1,configurable:!1,writable:!1},kMaxEventTargetListenersWarned:{value:FI,enumerable:!1,configurable:!1,writable:!1}});Object.assign(wU,{once:jQ,getEventListeners:vQ,getMaxListeners:NQ,setMaxListeners:_Q,EventEmitter:wU,usingDomains:!1,captureRejectionSymbol:SQ,errorMonitor:RQ,addAbortListener:gQ,init:wU,listenerCount:BQ});LI=wU});var rY=rK((GA,bQ)=>{var s0=(U,Z)=>()=>(Z||U((Z={exports:{}}).exports,Z),Z.exports),Z1=s0((U,Z)=>{class X extends Error{constructor(G){if(!Array.isArray(G))throw TypeError(`Expected input to be an Array, got ${typeof G}`);let K="";for(let F=0;F<G.length;F++)K+=` ${G[F].stack}
|
|
12
|
-
`;super(K);this.name="AggregateError",this.errors=G}}Z.exports={AggregateError:X,ArrayIsArray(G){return Array.isArray(G)},ArrayPrototypeIncludes(G,K){return G.includes(K)},ArrayPrototypeIndexOf(G,K){return G.indexOf(K)},ArrayPrototypeJoin(G,K){return G.join(K)},ArrayPrototypeMap(G,K){return G.map(K)},ArrayPrototypePop(G,K){return G.pop(K)},ArrayPrototypePush(G,K){return G.push(K)},ArrayPrototypeSlice(G,K,F){return G.slice(K,F)},Error,FunctionPrototypeCall(G,K,...F){return G.call(K,...F)},FunctionPrototypeSymbolHasInstance(G,K){return Function.prototype[Symbol.hasInstance].call(G,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(G,K){return Object.defineProperties(G,K)},ObjectDefineProperty(G,K,F){return Object.defineProperty(G,K,F)},ObjectGetOwnPropertyDescriptor(G,K){return Object.getOwnPropertyDescriptor(G,K)},ObjectKeys(G){return Object.keys(G)},ObjectSetPrototypeOf(G,K){return Object.setPrototypeOf(G,K)},Promise,PromisePrototypeCatch(G,K){return G.catch(K)},PromisePrototypeThen(G,K,F){return G.then(K,F)},PromiseReject(G){return Promise.reject(G)},PromiseResolve(G){return Promise.resolve(G)},ReflectApply:Reflect.apply,RegExpPrototypeTest(G,K){return G.test(K)},SafeSet:Set,String,StringPrototypeSlice(G,K,F){return G.slice(K,F)},StringPrototypeToLowerCase(G){return G.toLowerCase()},StringPrototypeToUpperCase(G){return G.toUpperCase()},StringPrototypeTrim(G){return G.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(G,K,F){return G.set(K,F)},Boolean,Uint8Array}}),fQ=s0((U,Z)=>{Z.exports={format(X,...G){return X.replace(/%([sdifj])/g,function(...[K,F]){let $=G.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:G}=fQ(),{AggregateError:K}=Z1(),F=globalThis.AggregateError||K,$=Symbol("kIsNodeError"),L=["string","function","number","object","Function","Object","boolean","bigint","symbol"],M=/^([A-Z][a-z0-9]*)+$/,D={};function T(B,v){if(!B)throw new D.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 q(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 S(B,v,x){if(!x)x=Error;class N extends x{constructor(...w){super(q(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,D[B]=N}function E(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 D.ERR_INVALID_ARG_TYPE("options","Object",v);super(B,v);this.code="ABORT_ERR",this.name="AbortError"}}S("ERR_ASSERTION","%s",Error),S("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"),L.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=G(x,{depth:-1});N+=`. Received ${Y0}`}}else{let Y0=G(x,{colors:!1});if(Y0.length>25)Y0=`${Y0.slice(0,25)}...`;N+=`. Received type ${typeof x} (${Y0})`}return N},TypeError),S("ERR_INVALID_ARG_VALUE",(B,v,x="is invalid")=>{let N=G(v);if(N.length>128)N=N.slice(0,128)+"...";return`The ${B.includes(".")?"property":"argument"} '${B}' ${x}. Received ${N}`},TypeError),S("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),S("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),S("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=G(x);return`The value of "${B}" is out of range. It must be ${v}. Received ${N}`},RangeError),S("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),S("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),S("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),S("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),S("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),S("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),S("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),S("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),S("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),S("ERR_STREAM_WRITE_AFTER_END","write after end",Error),S("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),Z.exports={AbortError:k,aggregateTwoErrors:E(j),hideStackFrames:E,codes:D}}),MI=s0((U,Z)=>{Object.defineProperty(U,"__esModule",{value:!0});var X=new WeakMap,G=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,L(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),G.set(window.Event.prototype,$);function L(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 D(b,i){let Y=Object.keys(i);if(Y.length===0)return b;function V(I,Q){b.call(this,I,Q)}V.prototype=Object.create(b.prototype,{constructor:{value:V,configurable:!0,writable:!0}});for(let I=0;I<Y.length;++I){let Q=Y[I];if(!(Q in b.prototype)){let W=typeof Object.getOwnPropertyDescriptor(i,Q).value==="function";Object.defineProperty(V.prototype,Q,W?M(Q):L(Q))}}return V}function T(b){if(b==null||b===Object.prototype)return $;let i=G.get(b);if(i==null)i=D(T(Object.getPrototypeOf(b)),b),G.set(b,i);return i}function A(b,i){return new(T(Object.getPrototypeOf(i)))(b,i)}function q(b){return K(b).immediateStopped}function S(b,i){K(b).eventPhase=i}function E(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 Q={listener:i,listenerType:x,passive:!1,once:!1,next:null};if(V===null)Y.set(b,Q);else V.next=Q}},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),Q=(I?Boolean(Y.capture):Boolean(Y))?B:v,W={listener:i,listenerType:Q,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 z=null;while(C!=null){if(C.listener===i&&C.listenerType===Q)return;z=C,C=C.next}z.next=W},removeEventListener(b,i,Y){if(i==null)return;let V=w(this),I=(N(Y)?Boolean(Y.capture):Boolean(Y))?B:v,Q=null,W=V.get(b);while(W!=null){if(W.listener===i&&W.listenerType===I){if(Q!==null)Q.next=W.next;else if(W.next!==null)V.set(b,W.next);else V.delete(b);return}Q=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),Q=null;while(V!=null){if(V.once)if(Q!==null)Q.next=V.next;else if(V.next!==null)i.set(Y,V.next);else i.delete(Y);else Q=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(q(I))break;V=V.next}return j(I,null),S(I,0),E(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=MI();class G 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(G.prototype,"abort");function K(){let T=Object.create(G.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(G.prototype,{aborted:{enumerable:!0}}),typeof Symbol==="function"&&typeof Symbol.toStringTag==="symbol")Object.defineProperty(G.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortSignal"});class L{constructor(){M.set(this,K())}get signal(){return D(this)}abort(){F(D(this))}}var M=new WeakMap;function D(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(L.prototype,{signal:{enumerable:!0},abort:{enumerable:!0}}),typeof Symbol==="function"&&typeof Symbol.toStringTag==="symbol")Object.defineProperty(L.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortController"});U.AbortController=L,U.AbortSignal=G,U.default=L,Z.exports=L,Z.exports.AbortController=Z.exports.default=L,Z.exports.AbortSignal=G}),i1=s0((U,Z)=>{var X=(g1(),m0(N1)),{format:G,inspect:K}=fQ(),{codes:{ERR_INVALID_ARG_TYPE:F}}=n1(),{kResistStopPropagation:$,AggregateError:L,SymbolDispose:M}=Z1(),D=globalThis.AbortSignal||gZ().AbortSignal,T=globalThis.AbortController||gZ().AbortController,A=Object.getPrototypeOf(async function(){}).constructor,q=globalThis.Blob||X.Blob,S=typeof q<"u"?function(k){return k instanceof q}:function(k){return!1},E=(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:L,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:G,inspect:K,types:{isAsyncFunction(k){return k instanceof A},isArrayBufferView(k){return ArrayBuffer.isView(k)}},isBlob:S,deprecate(k,B){return k},addAbortListener:(NZ(),m0(xZ)).addAbortListener||function(k,B){if(k===void 0)throw new F("signal","AbortSignal",k);E(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:D.any||function(k){if(k.length===1)return k[0];let B=new T,v=()=>B.abort();return k.forEach((x)=>{E(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:G,ArrayPrototypeJoin:K,ArrayPrototypeMap:F,NumberIsInteger:$,NumberIsNaN:L,NumberMAX_SAFE_INTEGER:M,NumberMIN_SAFE_INTEGER:D,NumberParseInt:T,ObjectPrototypeHasOwnProperty:A,RegExpPrototypeExec:q,String:S,StringPrototypeToUpperCase:E,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(c){return c===(c|0)}function i(c){return c===c>>>0}var Y=/^[0-7]+$/,V="must be a 32-bit unsigned integer or an octal string";function I(c,m,g0){if(typeof c>"u")c=g0;if(typeof c==="string"){if(q(Y,c)===null)throw new x(m,c,V);c=T(c,8)}return C(c,m),c}var Q=k((c,m,g0=D,r=M)=>{if(typeof c!=="number")throw new v(m,"number",c);if(!$(c))throw new N(m,"an integer",c);if(c<g0||c>r)throw new N(m,`>= ${g0} && <= ${r}`,c)}),W=k((c,m,g0=-2147483648,r=2147483647)=>{if(typeof c!=="number")throw new v(m,"number",c);if(!$(c))throw new N(m,"an integer",c);if(c<g0||c>r)throw new N(m,`>= ${g0} && <= ${r}`,c)}),C=k((c,m,g0=!1)=>{if(typeof c!=="number")throw new v(m,"number",c);if(!$(c))throw new N(m,"an integer",c);let r=g0?1:0,J0=4294967295;if(c<r||c>J0)throw new N(m,`>= ${r} && <= ${J0}`,c)});function z(c,m){if(typeof c!=="string")throw new v(m,"string",c)}function H(c,m,g0=void 0,r){if(typeof c!=="number")throw new v(m,"number",c);if(g0!=null&&c<g0||r!=null&&c>r||(g0!=null||r!=null)&&L(c))throw new N(m,`${g0!=null?`>= ${g0}`:""}${g0!=null&&r!=null?" && ":""}${r!=null?`<= ${r}`:""}`,c)}var J=k((c,m,g0)=>{if(!G(g0,c)){let r="must be one of: "+K(F(g0,(J0)=>typeof J0==="string"?`'${J0}'`:S(J0)),", ");throw new x(m,c,r)}});function O(c,m){if(typeof c!=="boolean")throw new v(m,"boolean",c)}function P(c,m,g0){return c==null||!A(c,m)?g0:c[m]}var R=k((c,m,g0=null)=>{let r=P(g0,"allowArray",!1),J0=P(g0,"allowFunction",!1);if(!P(g0,"nullable",!1)&&c===null||!r&&X(c)||typeof c!=="object"&&(!J0||typeof c!=="function"))throw new v(m,"Object",c)}),_=k((c,m)=>{if(c!=null&&typeof c!=="object"&&typeof c!=="function")throw new v(m,"a dictionary",c)}),f=k((c,m,g0=0)=>{if(!X(c))throw new v(m,"Array",c);if(c.length<g0){let r=`must be longer than ${g0}`;throw new x(m,c,r)}});function p(c,m){f(c,m);for(let g0=0;g0<c.length;g0++)z(c[g0],`${m}[${g0}]`)}function o(c,m){f(c,m);for(let g0=0;g0<c.length;g0++)O(c[g0],`${m}[${g0}]`)}function K0(c,m){f(c,m);for(let g0=0;g0<c.length;g0++){let r=c[g0],J0=`${m}[${g0}]`;if(r==null)throw new v(J0,"AbortSignal",r);s(r,J0)}}function a(c,m="signal"){if(z(c,m),Y0[c]===void 0){if(Y0[E(c)]!==void 0)throw new w(c+" (signals must use all capital letters)");throw new w(c)}}var l=k((c,m="buffer")=>{if(!V0(c))throw new v(m,["Buffer","TypedArray","DataView"],c)});function G0(c,m){let g0=u(m),r=c.length;if(g0==="hex"&&r%2!==0)throw new x("encoding",m,`is invalid for data of length ${r}`)}function n(c,m="Port",g0=!0){if(typeof c!=="number"&&typeof c!=="string"||typeof c==="string"&&j(c).length===0||+c!==+c>>>0||c>65535||c===0&&!g0)throw new B(m,c,g0);return c|0}var s=k((c,m)=>{if(c!==void 0&&(c===null||typeof c!=="object"||!("aborted"in c)))throw new v(m,"AbortSignal",c)}),f0=k((c,m)=>{if(typeof c!=="function")throw new v(m,"Function",c)}),y=k((c,m)=>{if(typeof c!=="function"||Z0(c))throw new v(m,"Function",c)}),h=k((c,m)=>{if(c!==void 0)throw new v(m,"undefined",c)});function Q0(c,m,g0){if(!G(g0,c))throw new v(m,`('${K(g0,"|")}')`,c)}var t=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function U0(c,m){if(typeof c>"u"||!q(t,c))throw new x(m,c,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function q0(c){if(typeof c==="string")return U0(c,"hints"),c;else if(X(c)){let m=c.length,g0="";if(m===0)return g0;for(let r=0;r<m;r++){let J0=c[r];if(U0(J0,"hints"),g0+=J0,r!==m-1)g0+=", "}return g0}throw new x("hints",c,'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:p,validateBooleanArray:o,validateAbortSignalArray:K0,validateBoolean:O,validateBuffer:l,validateDictionary:_,validateEncoding:G0,validateFunction:f0,validateInt32:W,validateInteger:Q,validateNumber:H,validateObject:R,validateOneOf:J,validatePlainFunction:y,validatePort:n,validateSignalName:a,validateString:z,validateUint32:C,validateUndefined:h,validateUnion:Q0,validateAbortSignal:s,validateLinkHeaderValue:q0}}),iU=s0((U,Z)=>{Z.exports=globalThis.process}),kU=s0((U,Z)=>{var{SymbolAsyncIterator:X,SymbolIterator:G,SymbolFor:K}=Z1(),F=K("nodejs.stream.destroyed"),$=K("nodejs.stream.errored"),L=K("nodejs.stream.readable"),M=K("nodejs.stream.writable"),D=K("nodejs.stream.disturbed"),T=K("nodejs.webstream.isClosedPromise"),A=K("nodejs.webstream.controllerErrorFunction");function q(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 S(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 E(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[G]==="function";return typeof P[X]==="function"||typeof P[G]==="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(!S(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(!S(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(!q(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(!q(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[L]!=null)return P[L];if(typeof(P===null||P===void 0?void 0:P.readable)!=="boolean")return null;if(w(P))return!1;return q(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 S(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 Q(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 z(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[D])!==null&&R!==void 0?R:P.readableDidRead||P.readableAborted))}function O(P){var R,_,f,p,o,K0,a,l,G0,n;return!!(P&&((R=(_=(f=(p=(o=(K0=P[$])!==null&&K0!==void 0?K0:P.readableErrored)!==null&&o!==void 0?o:P.writableErrored)!==null&&p!==void 0?p:(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?_:(G0=P._readableState)===null||G0===void 0?void 0:G0.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:D,isErrored:O,kIsErrored:$,isReadable:b,kIsReadable:L,kIsClosedPromise:T,kControllerErrorFunction:A,kIsWritable:M,isClosed:Q,isDuplexNodeStream:E,isFinished:Y,isIterable:N,isReadableNodeStream:q,isReadableStream:k,isReadableEnded:V0,isReadableFinished:Y0,isReadableErrored:I,isNodeStream:j,isWebStream:x,isWritable:i,isWritableNodeStream:S,isWritableStream:B,isWritableEnded:u,isWritableFinished:Z0,isWritableErrored:V,isServerRequest:z,isServerResponse:C,willEmitClose:H,isTransformStream:v}}),yU=s0((U,Z)=>{var X=iU(),{AbortError:G,codes:K}=n1(),{ERR_INVALID_ARG_TYPE:F,ERR_STREAM_PREMATURE_CLOSE:$}=K,{kEmptyObject:L,once:M}=i1(),{validateAbortSignal:D,validateFunction:T,validateObject:A,validateBoolean:q}=fZ(),{Promise:S,PromisePrototypeThen:E,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 Q(J){return J.setHeader&&typeof J.abort==="function"}var W=()=>{};function C(J,O,P){var R,_;if(arguments.length===2)P=O,O=L;else if(O==null)O=L;else A(O,"options");if(T(P,"callback"),D(O.signal,"options.signal"),P=M(P),x(J)||V0(J))return z(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),p=(_=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)===p,G0=Y0(J,!1),n=()=>{if(G0=!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||p))return;if(!p||G0)P.call(J)},y=(c)=>{P.call(J,c)},h=k(J),Q0=()=>{h=!0;let c=b(J)||w(J);if(c&&typeof c!=="boolean")return P.call(J,c);if(f&&!s&&v(J,!0)){if(!N(J,!1))return P.call(J,new $)}if(p&&!G0){if(!Y0(J,!1))return P.call(J,new $)}P.call(J)},t=()=>{h=!0;let c=b(J)||w(J);if(c&&typeof c!=="boolean")return P.call(J,c);P.call(J)},U0=()=>{J.req.on("finish",n)};if(Q(J)){if(J.on("complete",n),!l)J.on("abort",Q0);if(J.req)U0();else J.on("request",U0)}else if(p&&!o)J.on("end",a),J.on("close",a);if(!l&&typeof J.aborted==="boolean")J.on("aborted",Q0);if(J.on("end",f0),J.on("finish",n),O.error!==!1)J.on("error",y);if(J.on("close",Q0),h)X.nextTick(Q0);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))&&(G0||u(J)===!1))X.nextTick(t);else if(!p&&(!l||u(J))&&(s||B(J)===!1))X.nextTick(t);else if(K0&&J.req&&J.aborted)X.nextTick(t);let q0=()=>{if(P=W,J.removeListener("aborted",Q0),J.removeListener("complete",n),J.removeListener("abort",Q0),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",Q0)};if(O.signal&&!h){let c=()=>{let m=P;q0(),m.call(J,new G(void 0,{cause:O.signal.reason}))};if(O.signal.aborted)X.nextTick(c);else{I=I||i1().addAbortListener;let m=I(O.signal,c),g0=P;P=M((...r)=>{m[j](),g0.apply(J,r)})}}return q0}function z(J,O,P){let R=!1,_=W;if(O.signal)if(_=()=>{R=!0,P.call(J,new G(void 0,{cause:O.signal.reason}))},O.signal.aborted)X.nextTick(_);else{I=I||i1().addAbortListener;let p=I(O.signal,_),o=P;P=M((...K0)=>{p[j](),o.apply(J,K0)})}let f=(...p)=>{if(!R)X.nextTick(()=>P.apply(J,p))};return E(J[V].promise,f,f),W}function H(J,O){var P;let R=!1;if(O===null)O=L;if((P=O)!==null&&P!==void 0&&P.cleanup)q(O.cleanup,"cleanup"),R=O.cleanup;return new S((_,f)=>{let p=C(J,O,(o)=>{if(R)p();if(o)f(o);else _()})})}Z.exports=C,Z.exports.finished=H}),zZ=s0((U,Z)=>{var X=iU(),{aggregateTwoErrors:G,codes:{ERR_MULTIPLE_CALLBACK:K},AbortError:F}=n1(),{Symbol:$}=Z1(),{kIsDestroyed:L,isDestroyed:M,isFinished:D,isServerRequest:T}=kU(),A=$("kDestroy"),q=$("kConstruct");function S(Y,V,I){if(Y){if(Y.stack,V&&!V.errored)V.errored=Y;if(I&&!I.errored)I.errored=Y}}function E(Y,V){let I=this._readableState,Q=this._writableState,W=Q||I;if(Q!==null&&Q!==void 0&&Q.destroyed||I!==null&&I!==void 0&&I.destroyed){if(typeof V==="function")V();return this}if(S(Y,Q,I),Q)Q.destroyed=!0;if(I)I.destroyed=!0;if(!W.constructed)this.once(A,function(C){j(this,G(C,Y),V)});else j(this,Y,V);return this}function j(Y,V,I){let Q=!1;function W(C){if(Q)return;Q=!0;let{_readableState:z,_writableState:H}=Y;if(S(C,H,z),H)H.closed=!0;if(z)z.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:Q}=Y;if(Q!==null&&Q!==void 0&&Q.errorEmitted||I!==null&&I!==void 0&&I.errorEmitted)return;if(Q)Q.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:Q,_writableState:W}=Y;if(W!==null&&W!==void 0&&W.destroyed||Q!==null&&Q!==void 0&&Q.destroyed)return this;if(Q!==null&&Q!==void 0&&Q.autoDestroy||W!==null&&W!==void 0&&W.autoDestroy)Y.destroy(V);else if(V){if(V.stack,W&&!W.errored)W.errored=V;if(Q&&!Q.errored)Q.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:Q}=Y;if(I)I.constructed=!1;if(Q)Q.constructed=!1;if(Y.once(q,V),Y.listenerCount(q)>1)return;X.nextTick(u,Y)}function u(Y){let V=!1;function I(Q){if(V){N(Y,Q!==null&&Q!==void 0?Q:new K);return}V=!0;let{_readableState:W,_writableState:C}=Y,z=C||W;if(W)W.constructed=!0;if(C)C.constructed=!0;if(z.destroyed)Y.emit(A,Q);else if(Q)N(Y,Q,!0);else X.nextTick(Z0,Y)}try{Y._construct((Q)=>{X.nextTick(I,Q)})}catch(Q){X.nextTick(I,Q)}}function Z0(Y){Y.emit(q)}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&&!D(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[L]=!0}Z.exports={construct:w,destroyer:i,destroy:E,undestroy:x,errorOrDestroy:N}}),nY=s0((U,Z)=>{var{ArrayIsArray:X,ObjectSetPrototypeOf:G}=Z1(),{EventEmitter:K}=(NZ(),m0(xZ));function F(L){K.call(this,L)}G(F.prototype,K.prototype),G(F,K),F.prototype.pipe=function(L,M){let D=this;function T(B){if(L.writable&&L.write(B)===!1&&D.pause)D.pause()}D.on("data",T);function A(){if(D.readable&&D.resume)D.resume()}if(L.on("drain",A),!L._isStdio&&(!M||M.end!==!1))D.on("end",S),D.on("close",E);let q=!1;function S(){if(q)return;q=!0,L.end()}function E(){if(q)return;if(q=!0,typeof L.destroy==="function")L.destroy()}function j(B){if(k(),K.listenerCount(this,"error")===0)this.emit("error",B)}$(D,"error",j),$(L,"error",j);function k(){D.removeListener("data",T),L.removeListener("drain",A),D.removeListener("end",S),D.removeListener("close",E),D.removeListener("error",j),L.removeListener("error",j),D.removeListener("end",k),D.removeListener("close",k),L.removeListener("close",k)}return D.on("end",k),D.on("close",k),L.on("close",k),L.emit("pipe",D),L};function $(L,M,D){if(typeof L.prependListener==="function")return L.prependListener(M,D);if(!L._events||!L._events[M])L.on(M,D);else if(X(L._events[M]))L._events[M].unshift(D);else L._events[M]=[D,L._events[M]]}Z.exports={Stream:F,prependListener:$}}),kX=s0((U,Z)=>{var{SymbolDispose:X}=Z1(),{AbortError:G,codes:K}=n1(),{isNodeStream:F,isWebStream:$,kControllerErrorFunction:L}=kU(),M=yU(),{ERR_INVALID_ARG_TYPE:D}=K,T,A=(q,S)=>{if(typeof q!=="object"||!("aborted"in q))throw new D(S,"AbortSignal",q)};Z.exports.addAbortSignal=function(q,S){if(A(q,"signal"),!F(S)&&!$(S))throw new D("stream",["ReadableStream","WritableStream","Stream"],S);return Z.exports.addAbortSignalNoValidate(q,S)},Z.exports.addAbortSignalNoValidate=function(q,S){if(typeof q!=="object"||!("aborted"in q))return S;let E=F(S)?()=>{S.destroy(new G(void 0,{cause:q.reason}))}:()=>{S[L](new G(void 0,{cause:q.reason}))};if(q.aborted)E();else{T=T||i1().addAbortListener;let j=T(q,E);M(S,j[X])}return S}}),qI=s0((U,Z)=>{var{StringPrototypeSlice:X,SymbolIterator:G,TypedArrayPrototypeSet:K,Uint8Array:F}=Z1(),{Buffer:$}=(g1(),m0(N1)),{inspect:L}=i1();Z.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(M){let D={data:M,next:null};if(this.length>0)this.tail.next=D;else this.head=D;this.tail=D,++this.length}unshift(M){let D={data:M,next:this.head};if(this.length===0)this.tail=D;this.head=D,++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 D=this.head,T=""+D.data;while((D=D.next)!==null)T+=M+D.data;return T}concat(M){if(this.length===0)return $.alloc(0);let D=$.allocUnsafe(M>>>0),T=this.head,A=0;while(T)K(D,T.data,A),A+=T.data.length,T=T.next;return D}consume(M,D){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 D?this._getString(M):this._getBuffer(M)}first(){return this.head.data}*[G](){for(let M=this.head;M;M=M.next)yield M.data}_getString(M){let D="",T=this.head,A=0;do{let q=T.data;if(M>q.length)D+=q,M-=q.length;else{if(M===q.length)if(D+=q,++A,T.next)this.head=T.next;else this.head=this.tail=null;else D+=X(q,0,M),this.head=T,T.data=X(q,M);break}++A}while((T=T.next)!==null);return this.length-=A,D}_getBuffer(M){let D=$.allocUnsafe(M),T=M,A=this.head,q=0;do{let S=A.data;if(M>S.length)K(D,S,T-M),M-=S.length;else{if(M===S.length)if(K(D,S,T-M),++q,A.next)this.head=A.next;else this.head=this.tail=null;else K(D,new F(S.buffer,S.byteOffset,M),T-M),this.head=A,A.data=S.slice(M);break}++q}while((A=A.next)!==null);return this.length-=q,D}[Symbol.for("nodejs.util.inspect.custom")](M,D){return L(this,{...D,depth:0,customInspect:!1})}}}),jX=s0((U,Z)=>{var{MathFloor:X,NumberIsInteger:G}=Z1(),{validateInteger:K}=fZ(),{ERR_INVALID_ARG_VALUE:F}=n1().codes,$=16384,L=16;function M(q,S,E){return q.highWaterMark!=null?q.highWaterMark:S?q[E]:null}function D(q){return q?L:$}function T(q,S){if(K(S,"value",0),q)L=S;else $=S}function A(q,S,E,j){let k=M(S,j,E);if(k!=null){if(!G(k)||k<0){let B=j?`options.${E}`:"options.highWaterMark";throw new F(B,k)}return X(k)}return D(q.objectMode)}Z.exports={getHighWaterMark:A,getDefaultHighWaterMark:D,setDefaultHighWaterMark:T}}),TI=s0((U,Z)=>{/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var X=(g1(),m0(N1)),G=X.Buffer;function K($,L){for(var M in $)L[M]=$[M]}if(G.from&&G.alloc&&G.allocUnsafe&&G.allocUnsafeSlow)Z.exports=X;else K(X,U),U.Buffer=F;function F($,L,M){return G($,L,M)}F.prototype=Object.create(G.prototype),K(G,F),F.from=function($,L,M){if(typeof $==="number")throw TypeError("Argument must not be a number");return G($,L,M)},F.alloc=function($,L,M){if(typeof $!=="number")throw TypeError("Argument must be a number");var D=G($);if(L!==void 0)if(typeof M==="string")D.fill(L,M);else D.fill(L);else D.fill(0);return D},F.allocUnsafe=function($){if(typeof $!=="number")throw TypeError("Argument must be a number");return G($)},F.allocUnsafeSlow=function($){if(typeof $!=="number")throw TypeError("Argument must be a number");return X.SlowBuffer($)}}),RI=s0((U)=>{var Z=TI().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 G(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=G(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=q,this.end=S,x=4;break;case"utf8":this.fillLast=D,x=4;break;case"base64":this.text=E,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 L(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 D(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=L(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 q(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 S(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 E(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):""}}),wQ=s0((U,Z)=>{var X=iU(),{PromisePrototypeThen:G,SymbolAsyncIterator:K,SymbolIterator:F}=Z1(),{Buffer:$}=(g1(),m0(N1)),{ERR_INVALID_ARG_TYPE:L,ERR_STREAM_NULL_VALUES:M}=n1().codes;function D(T,A,q){let S;if(typeof A==="string"||A instanceof $)return new T({objectMode:!0,...q,read(){this.push(A),this.push(null)}});let E;if(A&&A[K])E=!0,S=A[K]();else if(A&&A[F])E=!1,S=A[F]();else throw new L("iterable",["Iterable"],A);let j=new T({objectMode:!0,highWaterMark:1,...q}),k=!1;j._read=function(){if(!k)k=!0,v()},j._destroy=function(x,N){G(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 S.throw==="function";if(N&&w){let{value:u,done:Z0}=await S.throw(x);if(await u,Z0)return}if(typeof S.return==="function"){let{value:u}=await S.return();await u}}async function v(){for(;;){try{let{value:x,done:N}=E?await S.next():S.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=D}),vX=s0((U,Z)=>{var X=iU(),{ArrayPrototypeIndexOf:G,NumberIsInteger:K,NumberIsNaN:F,NumberParseInt:$,ObjectDefineProperties:L,ObjectKeys:M,ObjectSetPrototypeOf:D,Promise:T,SafeSet:A,SymbolAsyncDispose:q,SymbolAsyncIterator:S,Symbol:E}=Z1();Z.exports=r,r.ReadableState=g0;var{EventEmitter:j}=(NZ(),m0(xZ)),{Stream:k,prependListener:B}=nY(),{Buffer:v}=(g1(),m0(N1)),{addAbortSignal:x}=kX(),N=yU(),w=i1().debuglog("stream",(g)=>{w=g}),u=qI(),Z0=zZ(),{getHighWaterMark:V0,getDefaultHighWaterMark:Y0}=jX(),{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:Q},AbortError:W}=n1(),{validateObject:C}=fZ(),z=E("kPaused"),{StringDecoder:H}=RI(),J=wQ();D(r.prototype,k.prototype),D(r,k);var O=()=>{},{errorOrDestroy:P}=Z0,R=1,_=2,f=4,p=8,o=16,K0=32,a=64,l=128,G0=256,n=512,s=1024,f0=2048,y=4096,h=8192,Q0=16384,t=32768,U0=65536,q0=131072,c=262144;function m(g){return{enumerable:!1,get(){return(this.state&g)!==0},set(d){if(d)this.state|=g;else this.state&=~g}}}L(g0.prototype,{objectMode:m(R),ended:m(_),endEmitted:m(f),reading:m(p),constructed:m(o),sync:m(K0),needReadable:m(a),emittedReadable:m(l),readableListening:m(G0),resumeScheduled:m(n),errorEmitted:m(s),emitClose:m(f0),autoDestroy:m(y),destroyed:m(h),closed:m(Q0),closeEmitted:m(t),multiAwaitDrain:m(U0),readingMore:m(q0),dataEmitted:m(c)});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[z]=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)L0(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[q]=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&=~p,I0(g,y0);else if((y0.state&R)!==0||d&&d.length>0)if(X0)if((y0.state&f)!==0)P(g,new Q);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&=~p,y0.decoder&&!e)if(d=y0.decoder.write(d),y0.objectMode||d.length!==0)h0(g,y0,d,!1);else L0(g,y0);else h0(g,y0,d,!1);else if(!X0)y0.state&=~p,L0(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)}L0(g,d)}r.prototype.isPaused=function(){let g=this._readableState;return g[z]===!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|=p|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=S0(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 L0(g,d){if(!d.readingMore&&d.constructed)d.readingMore=!0,X.nextTick(D0,g,d)}function D0(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 G1,P0=!1;function N0(){if(w("cleanup"),g.removeListener("close",Q1),g.removeListener("finish",l0),G1)g.removeListener("drain",G1);if(g.removeListener("error",M0),g.removeListener("unpipe",F0),e.removeListener("end",A0),e.removeListener("end",b0),e.removeListener("data",k0),P0=!0,G1&&X0.awaitDrainWriters&&(!g._writableState||g._writableState.needDrain))G1()}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(!G1)G1=d1(e,g),g.on("drain",G1)}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 Q1(){g.removeListener("finish",l0),b0()}g.once("close",Q1);function l0(){w("onfinish"),g.removeListener("close",Q1),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=G(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[z]===!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[z]=!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[z]=!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[S]=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()}}L(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}}}),L(g0.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[z]!==!1},set(g){this[z]=!!g}}}),r._fromList=S0;function S0(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 E0(){if(B1===void 0)B1={};return B1}r.fromWeb=function(g,d){return E0().newStreamReadableFromReadableStream(g,d)},r.toWeb=function(g,d){return E0().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)}}),mY=s0((U,Z)=>{var X=iU(),{ArrayPrototypeSlice:G,Error:K,FunctionPrototypeSymbolHasInstance:F,ObjectDefineProperty:$,ObjectDefineProperties:L,ObjectSetPrototypeOf:M,StringPrototypeToLowerCase:D,Symbol:T,SymbolHasInstance:A}=Z1();Z.exports=C,C.WritableState=Q;var{EventEmitter:q}=(NZ(),m0(xZ)),S=nY().Stream,{Buffer:E}=(g1(),m0(N1)),j=zZ(),{addAbortSignal:k}=kX(),{getHighWaterMark:B,getDefaultHighWaterMark:v}=jX(),{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,S.prototype),M(C,S);function V(){}var I=T("kOnFinished");function Q(y,h,Q0){if(typeof Q0!=="boolean")Q0=h instanceof PU();if(this.objectMode=!!(y&&y.objectMode),Q0)this.objectMode=this.objectMode||!!(y&&y.writableObjectMode);this.highWaterMark=y?B(this,y,"writableHighWaterMark",Q0):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}Q.prototype.getBuffer=function(){return G(this.buffered,this.bufferedIndex)},$(Q.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 Q(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)}S.call(this,y),j.construct(this,()=>{let Q0=this._writableState;if(!Q0.writing)p(this,Q0);l(this,Q0)})}$(C,A,{__proto__:null,value:function(y){if(F(this,y))return!0;if(this!==C)return!1;return y&&y._writableState instanceof Q}}),C.prototype.pipe=function(){Y(this,new u)};function z(y,h,Q0,t){let U0=y._writableState;if(typeof Q0==="function")t=Q0,Q0=U0.defaultEncoding;else{if(!Q0)Q0=U0.defaultEncoding;else if(Q0!=="buffer"&&!E.isEncoding(Q0))throw new i(Q0);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=E.from(h,Q0),Q0="buffer"}else if(h instanceof E)Q0="buffer";else if(S._isUint8Array(h))h=S._uint8ArrayToBuffer(h),Q0="buffer";else throw new x("chunk",["string","Buffer","Uint8Array"],h);let q0;if(U0.ending)q0=new b;else if(U0.destroyed)q0=new Z0("write");if(q0)return X.nextTick(t,q0),Y(y,q0,!0),q0;return U0.pendingcb++,H(y,U0,h,Q0,t)}C.prototype.write=function(y,h,Q0){return z(this,y,h,Q0)===!0},C.prototype.cork=function(){this._writableState.corked++},C.prototype.uncork=function(){let y=this._writableState;if(y.corked){if(y.corked--,!y.writing)p(this,y)}},C.prototype.setDefaultEncoding=function(y){if(typeof y==="string")y=D(y);if(!E.isEncoding(y))throw new i(y);return this._writableState.defaultEncoding=y,this};function H(y,h,Q0,t,U0){let q0=h.objectMode?1:Q0.length;h.length+=q0;let c=h.length<h.highWaterMark;if(!c)h.needDrain=!0;if(h.writing||h.corked||h.errored||!h.constructed){if(h.buffered.push({chunk:Q0,encoding:t,callback:U0}),h.allBuffers&&t!=="buffer")h.allBuffers=!1;if(h.allNoop&&U0!==V)h.allNoop=!1}else h.writelen=q0,h.writecb=U0,h.writing=!0,h.sync=!0,y._write(Q0,t,h.onwrite),h.sync=!1;return c&&!h.errored&&!h.destroyed}function J(y,h,Q0,t,U0,q0,c){if(h.writelen=t,h.writecb=c,h.writing=!0,h.sync=!0,h.destroyed)h.onwrite(new Z0("write"));else if(Q0)y._writev(U0,h.onwrite);else y._write(U0,q0,h.onwrite);h.sync=!1}function O(y,h,Q0,t){--h.pendingcb,t(Q0),f(h),Y(y,Q0)}function P(y,h){let Q0=y._writableState,t=Q0.sync,U0=Q0.writecb;if(typeof U0!=="function"){Y(y,new w);return}if(Q0.writing=!1,Q0.writecb=null,Q0.length-=Q0.writelen,Q0.writelen=0,h){if(h.stack,!Q0.errored)Q0.errored=h;if(y._readableState&&!y._readableState.errored)y._readableState.errored=h;if(t)X.nextTick(O,y,Q0,h,U0);else O(y,Q0,h,U0)}else{if(Q0.buffered.length>Q0.bufferedIndex)p(y,Q0);if(t)if(Q0.afterWriteTickInfo!==null&&Q0.afterWriteTickInfo.cb===U0)Q0.afterWriteTickInfo.count++;else Q0.afterWriteTickInfo={count:1,cb:U0,stream:y,state:Q0},X.nextTick(R,Q0.afterWriteTickInfo);else _(y,Q0,1,U0)}}function R({stream:y,state:h,count:Q0,cb:t}){return h.afterWriteTickInfo=null,_(y,h,Q0,t)}function _(y,h,Q0,t){if(!h.ending&&!y.destroyed&&h.length===0&&h.needDrain)h.needDrain=!1,y.emit("drain");while(Q0-- >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:q0,callback:c}=y.buffered[U0],m=y.objectMode?1:q0.length;y.length-=m,c((h=y.errored)!==null&&h!==void 0?h:new Z0("write"))}let Q0=y[I].splice(0);for(let U0=0;U0<Q0.length;U0++){var t;Q0[U0]((t=y.errored)!==null&&t!==void 0?t:new Z0("end"))}W(y)}function p(y,h){if(h.corked||h.bufferProcessing||h.destroyed||!h.constructed)return;let{buffered:Q0,bufferedIndex:t,objectMode:U0}=h,q0=Q0.length-t;if(!q0)return;let c=t;if(h.bufferProcessing=!0,q0>1&&y._writev){h.pendingcb-=q0-1;let m=h.allNoop?V:(r)=>{for(let J0=c;J0<Q0.length;++J0)Q0[J0].callback(r)},g0=h.allNoop&&c===0?Q0:G(Q0,c);g0.allBuffers=h.allBuffers,J(y,h,!0,h.length,g0,"",m),W(h)}else{do{let{chunk:m,encoding:g0,callback:r}=Q0[c];Q0[c++]=null;let J0=U0?1:m.length;J(y,h,!1,J0,m,g0,r)}while(c<Q0.length&&!h.writing);if(c===Q0.length)W(h);else if(c>256)Q0.splice(0,c),h.bufferedIndex=0;else h.bufferedIndex=c}h.bufferProcessing=!1}C.prototype._write=function(y,h,Q0){if(this._writev)this._writev([{chunk:y,encoding:h}],Q0);else throw new N("_write()")},C.prototype._writev=null,C.prototype.end=function(y,h,Q0){let t=this._writableState;if(typeof y==="function")Q0=y,y=null,h=null;else if(typeof h==="function")Q0=h,h=null;let U0;if(y!==null&&y!==void 0){let q0=z(this,y,h);if(q0 instanceof K)U0=q0}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 Q0==="function")if(U0||t.finished)X.nextTick(Q0,U0);else t[I].push(Q0);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 Q0=!1;function t(U0){if(Q0){Y(y,U0!==null&&U0!==void 0?U0:w());return}if(Q0=!0,h.pendingcb--,U0){let q0=h[I].splice(0);for(let c=0;c<q0.length;c++)q0[c](U0);Y(y,U0,h.sync)}else if(o(h))h.prefinished=!0,y.emit("prefinish"),h.pendingcb++,X.nextTick(G0,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,Q0){if(o(h)){if(a(y,h),h.pendingcb===0){if(Q0)h.pendingcb++,X.nextTick((t,U0)=>{if(o(U0))G0(t,U0);else U0.pendingcb--},y,h);else if(o(h))h.pendingcb++,G0(y,h)}}}function G0(y,h){h.pendingcb--,h.finished=!0;let Q0=h[I].splice(0);for(let t=0;t<Q0.length;t++)Q0[t]();if(y.emit("finish"),h.autoDestroy){let t=y._readableState;if(!t||t.autoDestroy&&(t.endEmitted||t.readable===!1))y.destroy()}}L(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 Q0=this._writableState;if(!Q0.destroyed&&(Q0.bufferedIndex<Q0.buffered.length||Q0[I].length))X.nextTick(f,Q0);return n.call(this,y,h),this},C.prototype._undestroy=j.undestroy,C.prototype._destroy=function(y,h){h(y)},C.prototype[q.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)}}),SI=s0((U,Z)=>{var X=iU(),G=(g1(),m0(N1)),{isReadable:K,isWritable:F,isIterable:$,isNodeStream:L,isReadableNodeStream:M,isWritableNodeStream:D,isDuplexNodeStream:T,isReadableStream:A,isWritableStream:q}=kU(),S=yU(),{AbortError:E,codes:{ERR_INVALID_ARG_TYPE:j,ERR_INVALID_RETURN_VALUE:k}}=n1(),{destroyer:B}=zZ(),v=PU(),x=vX(),N=mY(),{createDeferredPromise:w}=i1(),u=wQ(),Z0=globalThis.Blob||G.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(Q,W){if(T(Q))return Q;if(M(Q))return V({readable:Q});if(D(Q))return V({writable:Q});if(L(Q))return V({writable:!1,readable:!1});if(A(Q))return V({readable:x.fromWeb(Q)});if(q(Q))return V({writable:N.fromWeb(Q)});if(typeof Q==="function"){let{value:z,write:H,final:J,destroy:O}=Y(Q);if($(z))return u(i,z,{objectMode:!0,write:H,final:J,destroy:O});let P=z===null||z===void 0?void 0:z.then;if(typeof P==="function"){let R,_=b(P,z,(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(p){X.nextTick(f,p)}})},destroy:O})}throw new k("Iterable, AsyncIterable or AsyncFunction",W,z)}if(V0(Q))return I(Q.arrayBuffer());if($(Q))return u(i,Q,{objectMode:!0,writable:!1});if(A(Q===null||Q===void 0?void 0:Q.readable)&&q(Q===null||Q===void 0?void 0:Q.writable))return i.fromWeb(Q);if(typeof(Q===null||Q===void 0?void 0:Q.writable)==="object"||typeof(Q===null||Q===void 0?void 0:Q.readable)==="object"){let z=Q!==null&&Q!==void 0&&Q.readable?M(Q===null||Q===void 0?void 0:Q.readable)?Q===null||Q===void 0?void 0:Q.readable:I(Q.readable):void 0,H=Q!==null&&Q!==void 0&&Q.writable?D(Q===null||Q===void 0?void 0:Q.writable)?Q===null||Q===void 0?void 0:Q.writable:I(Q.writable):void 0;return V({readable:z,writable:H})}let C=Q===null||Q===void 0?void 0:Q.then;if(typeof C==="function"){let z;return b(C,Q,(H)=>{if(H!=null)z.push(H);z.push(null)},(H)=>{B(z,H)}),z=new i({objectMode:!0,writable:!1,read(){}})}throw new j(W,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],Q)};function Y(I){let{promise:Q,resolve:W}=w(),C=new Y0,z=C.signal;return{value:I(async function*(){while(!0){let H=Q;Q=null;let{chunk:J,done:O,cb:P}=await H;if(X.nextTick(P),O)return;if(z.aborted)throw new E(void 0,{cause:z.reason});({promise:Q,resolve:W}=w()),yield J}}(),{signal:z}),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 Q=I.readable&&typeof I.readable.read!=="function"?x.wrap(I.readable):I.readable,W=I.writable,C=!!K(Q),z=!!F(W),H,J,O,P,R;function _(f){let p=P;if(P=null,p)p(f);else if(f)R.destroy(f)}if(R=new i({readableObjectMode:!!(Q!==null&&Q!==void 0&&Q.readableObjectMode),writableObjectMode:!!(W!==null&&W!==void 0&&W.writableObjectMode),readable:C,writable:z}),z)S(W,(f)=>{if(z=!1,f)B(Q,f);_(f)}),R._write=function(f,p,o){if(W.write(f,p))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)S(Q,(f)=>{if(C=!1,f)B(Q,f);_(f)}),Q.on("readable",function(){if(O){let f=O;O=null,f()}}),Q.on("end",function(){R.push(null)}),R._read=function(){while(!0){let f=Q.read();if(f===null){O=R._read;return}if(!R.push(f))return}};return R._destroy=function(f,p){if(!f&&P!==null)f=new E;if(O=null,H=null,J=null,P===null)p(f);else P=p,B(W,f),B(Q,f)},R}}),PU=s0((U,Z)=>{var{ObjectDefineProperties:X,ObjectGetOwnPropertyDescriptor:G,ObjectKeys:K,ObjectSetPrototypeOf:F}=Z1();Z.exports=M;var $=vX(),L=mY();F(M.prototype,$.prototype),F(M,$);{let q=K(L.prototype);for(let S=0;S<q.length;S++){let E=q[S];if(!M.prototype[E])M.prototype[E]=L.prototype[E]}}function M(q){if(!(this instanceof M))return new M(q);if($.call(this,q),L.call(this,q),q){if(this.allowHalfOpen=q.allowHalfOpen!==!1,q.readable===!1)this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0;if(q.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,...G(L.prototype,"writable")},writableHighWaterMark:{__proto__:null,...G(L.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...G(L.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...G(L.prototype,"writableBuffer")},writableLength:{__proto__:null,...G(L.prototype,"writableLength")},writableFinished:{__proto__:null,...G(L.prototype,"writableFinished")},writableCorked:{__proto__:null,...G(L.prototype,"writableCorked")},writableEnded:{__proto__:null,...G(L.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...G(L.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(q){if(this._readableState&&this._writableState)this._readableState.destroyed=q,this._writableState.destroyed=q}}});var D;function T(){if(D===void 0)D={};return D}M.fromWeb=function(q,S){return T().newStreamDuplexFromReadableWritablePair(q,S)},M.toWeb=function(q){return T().newReadableWritablePairFromDuplex(q)};var A;M.from=function(q){if(!A)A=SI();return A(q,"body")}}),yQ=s0((U,Z)=>{var{ObjectSetPrototypeOf:X,Symbol:G}=Z1();Z.exports=M;var{ERR_METHOD_NOT_IMPLEMENTED:K}=n1().codes,F=PU(),{getHighWaterMark:$}=jX();X(M.prototype,F.prototype),X(M,F);var L=G("kCallback");function M(A){if(!(this instanceof M))return new M(A);let q=A?$(this,A,"readableHighWaterMark",!0):null;if(q===0)A={...A,highWaterMark:null,readableHighWaterMark:q,writableHighWaterMark:A.writableHighWaterMark||0};if(F.call(this,A),this._readableState.sync=!1,this[L]=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 D(A){if(typeof this._flush==="function"&&!this.destroyed)this._flush((q,S)=>{if(q){if(A)A(q);else this.destroy(q);return}if(S!=null)this.push(S);if(this.push(null),A)A()});else if(this.push(null),A)A()}function T(){if(this._final!==D)D.call(this)}M.prototype._final=D,M.prototype._transform=function(A,q,S){throw new K("_transform()")},M.prototype._write=function(A,q,S){let E=this._readableState,j=this._writableState,k=E.length;this._transform(A,q,(B,v)=>{if(B){S(B);return}if(v!=null)this.push(v);if(j.ended||k===E.length||E.length<E.highWaterMark)S();else this[L]=S})},M.prototype._read=function(){if(this[L]){let A=this[L];this[L]=null,A()}}}),pQ=s0((U,Z)=>{var{ObjectSetPrototypeOf:X}=Z1();Z.exports=K;var G=yQ();X(K.prototype,G.prototype),X(K,G);function K(F){if(!(this instanceof K))return new K(F);G.call(this,F)}K.prototype._transform=function(F,$,L){L(null,F)}}),sY=s0((U,Z)=>{var X=iU(),{ArrayIsArray:G,Promise:K,SymbolAsyncIterator:F,SymbolDispose:$}=Z1(),L=yU(),{once:M}=i1(),D=zZ(),T=PU(),{aggregateTwoErrors:A,codes:{ERR_INVALID_ARG_TYPE:q,ERR_INVALID_RETURN_VALUE:S,ERR_MISSING_ARGS:E,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,Q;function W(f,p,o){let K0=!1;f.on("close",()=>{K0=!0});let a=L(f,{readable:p,writable:o},(l)=>{K0=!l});return{destroy:(l)=>{if(K0)return;K0=!0,D.destroyer(f,l||new j("pipe"))},cleanup:a}}function C(f){return v(f[f.length-1],"streams[stream.length - 1]"),f.pop()}function z(f){if(N(f))return f;else if(u(f))return H(f);throw new q("val",["Readable","Iterable","AsyncIterable"],f)}async function*H(f){if(!I)I=vX();yield*I.prototype[F].call(f)}async function J(f,p,o,{end:K0}){let a,l=null,G0=(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()}});p.on("drain",G0);let s=L(p,{readable:!1},G0);try{if(p.writableNeedDrain)await n();for await(let f0 of f)if(!p.write(f0))await n();if(K0)p.end(),await n();o()}catch(f0){o(a!==f0?A(a,f0):f0)}finally{s(),p.off("drain",G0)}}async function O(f,p,o,{end:K0}){if(V0(p))p=p.writable;let a=p.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(G0){o(G0)}}}function P(...f){return R(f,M(C(f)))}function R(f,p,o){if(f.length===1&&G(f[0]))f=f[0];if(f.length<2)throw new E("streams");let K0=new Y,a=K0.signal,l=o===null||o===void 0?void 0:o.signal,G0=[];x(l,"options.signal");function n(){U0(new B)}Q=Q||i1().addAbortListener;let s;if(l)s=Q(l,n);let f0,y,h=[],Q0=0;function t(r){U0(r,--Q0===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)G0.forEach((H0)=>H0());X.nextTick(p,f0,y)}}let q0;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 c=I0;if(O0){let{destroy:C0,cleanup:K1}=W(J0,h0,H0);if(h.push(C0),w(J0)&&J1)G0.push(K1)}if(J0.on("error",I0),w(J0)&&J1)G0.push(()=>{J0.removeListener("error",I0)})}if(r===0)if(typeof J0==="function"){if(q0=J0({signal:a}),!N(q0))throw new S("Iterable, AsyncIterable or Stream","source",q0)}else if(N(J0)||u(J0)||V0(J0))q0=J0;else q0=T.from(J0);else if(typeof J0==="function"){if(V0(q0)){var m;q0=z((m=q0)===null||m===void 0?void 0:m.readable)}else q0=z(q0);if(q0=J0(q0,{signal:a}),h0){if(!N(q0,!0))throw new S("AsyncIterable",`transform[${r-1}]`,q0)}else{var g0;if(!V)V=pQ();let I0=new V({objectMode:!0}),C0=(g0=q0)===null||g0===void 0?void 0:g0.then;if(typeof C0==="function")Q0++,C0.call(q0,(D0)=>{if(y=D0,D0!=null)I0.write(D0);if(O0)I0.end();X.nextTick(t)},(D0)=>{I0.destroy(D0),X.nextTick(t,D0)});else if(N(q0,!0))Q0++,J(q0,I0,t,{end:O0});else if(b(q0)||V0(q0)){let D0=q0.readable||q0;Q0++,J(D0,I0,t,{end:O0})}else throw new S("AsyncIterable or Promise","destination",q0);q0=I0;let{destroy:K1,cleanup:L0}=W(q0,!1,!0);if(h.push(K1),J1)G0.push(L0)}}else if(Z0(J0)){if(u(q0)){Q0+=2;let I0=_(q0,J0,t,{end:O0});if(w(J0)&&J1)G0.push(I0)}else if(V0(q0)||b(q0)){let I0=q0.readable||q0;Q0++,J(I0,J0,t,{end:O0})}else if(N(q0))Q0++,J(q0,J0,t,{end:O0});else throw new q("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],q0);q0=J0}else if(Y0(J0)){if(u(q0))Q0++,O(z(q0),J0,t,{end:O0});else if(b(q0)||N(q0))Q0++,O(q0,J0,t,{end:O0});else if(V0(q0))Q0++,O(q0.readable,J0,t,{end:O0});else throw new q("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],q0);q0=J0}else q0=T.from(J0)}if(a!==null&&a!==void 0&&a.aborted||l!==null&&l!==void 0&&l.aborted)X.nextTick(n);return q0}function _(f,p,o,{end:K0}){let a=!1;if(p.on("close",()=>{if(!a)o(new k)}),f.pipe(p,{end:!1}),K0){let G0=function(){a=!0,p.end()};var l=G0;if(i(f))X.nextTick(G0);else f.once("end",G0)}else o();return L(f,{readable:!0,writable:!1},(G0)=>{let n=f._readableState;if(G0&&G0.code==="ERR_STREAM_PREMATURE_CLOSE"&&n&&n.ended&&!n.errored&&!n.errorEmitted)f.once("end",o).once("error",o);else o(G0)}),L(p,{readable:!1,writable:!0},o)}Z.exports={pipelineImpl:R,pipeline:P}}),cQ=s0((U,Z)=>{var{pipeline:X}=sY(),G=PU(),{destroyer:K}=zZ(),{isNodeStream:F,isReadable:$,isWritable:L,isWebStream:M,isTransformStream:D,isWritableStream:T,isReadableStream:A}=kU(),{AbortError:q,codes:{ERR_INVALID_ARG_VALUE:S,ERR_MISSING_ARGS:E}}=n1(),j=yU();Z.exports=function(...k){if(k.length===0)throw new E("streams");if(k.length===1)return G.from(k[0]);let B=[...k];if(typeof k[0]==="function")k[0]=G.from(k[0]);if(typeof k[k.length-1]==="function"){let Y=k.length-1;k[Y]=G.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])||D(k[Y])))throw new S(`streams[${Y}]`,B[Y],"must be readable");if(Y>0&&!(L(k[Y])||T(k[Y])||D(k[Y])))throw new S(`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=!!(L(V0)||T(V0)||D(V0)),i=!!($(Y0)||A(Y0)||D(Y0));if(u=new G({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,Q){if(V0.write(V,I))Q();else v=Q},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=(D(V0)?V0.writable:V0).getWriter();u._write=async function(I,Q,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(Q){I(Q)}}}let Y=D(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=(D(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 q;if(N=null,v=null,x=null,w===null)V(Y);else if(w=V,F(Y0))K(Y0,Y)},u}}),EI=s0((U,Z)=>{var X=globalThis.AbortController||gZ().AbortController,{codes:{ERR_INVALID_ARG_VALUE:G,ERR_INVALID_ARG_TYPE:K,ERR_MISSING_ARGS:F,ERR_OUT_OF_RANGE:$},AbortError:L}=n1(),{validateAbortSignal:M,validateInteger:D,validateObject:T}=fZ(),A=Z1().Symbol("kWeak"),q=Z1().Symbol("kResistStopPropagation"),{finished:S}=yU(),E=cQ(),{addAbortSignalNoValidate:j}=kX(),{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 Q(l,G0){if(G0!=null)T(G0,"options");if((G0===null||G0===void 0?void 0:G0.signal)!=null)M(G0.signal,"options.signal");if(B(l)&&!k(l))throw new G("stream",l,"must be writable");let n=E(this,l);if(G0!==null&&G0!==void 0&&G0.signal)j(G0.signal,n);return n}function W(l,G0){if(typeof l!=="function")throw new K("fn",["Function","AsyncFunction"],l);if(G0!=null)T(G0,"options");if((G0===null||G0===void 0?void 0:G0.signal)!=null)M(G0.signal,"options.signal");let n=1;if((G0===null||G0===void 0?void 0:G0.concurrency)!=null)n=w(G0.concurrency);let s=n-1;if((G0===null||G0===void 0?void 0:G0.highWaterMark)!=null)s=w(G0.highWaterMark);return D(n,"options.concurrency",1),D(s,"options.highWaterMark",0),s+=n,async function*(){let f0=i1().AbortSignalAny([G0===null||G0===void 0?void 0:G0.signal].filter(N)),y=this,h=[],Q0={signal:f0},t,U0,q0=!1,c=0;function m(){q0=!0,g0()}function g0(){c-=1,r()}function r(){if(U0&&!q0&&c<n&&h.length<s)U0(),U0=null}async function J0(){try{for await(let h0 of y){if(q0)return;if(f0.aborted)throw new L;try{if(h0=l(h0,Q0),h0===V)continue;h0=b(h0)}catch(H0){h0=Y0(H0)}if(c+=1,i(h0,g0,m),h.push(h0),t)t(),t=null;if(!q0&&(h.length>=s||c>=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(q0=!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 L;if(h0!==V)yield h0;h.shift(),r()}await new V0((h0)=>{t=h0})}}finally{if(q0=!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 G0=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 L({cause:l.signal.reason});yield[G0++,s]}}.call(this)}async function z(l,G0=void 0){for await(let n of P.call(this,l,G0))return!0;return!1}async function H(l,G0=void 0){if(typeof l!=="function")throw new K("fn",["Function","AsyncFunction"],l);return!await z.call(this,async(...n)=>{return!await l(...n)},G0)}async function J(l,G0){for await(let n of P.call(this,l,G0))return n;return}async function O(l,G0){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,G0));}function P(l,G0){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,G0)}class R extends F{constructor(){super("reduce");this.message="Reduce of an empty stream requires an initial value"}}async function _(l,G0,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 L(void 0,{cause:n.signal.reason});throw this.once("error",()=>{}),await S(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,[q]:!0};n.signal.addEventListener("abort",()=>y.abort(),U0)}let Q0=!1;try{for await(let U0 of this){var t;if(Q0=!0,n!==null&&n!==void 0&&(t=n.signal)!==null&&t!==void 0&&t.aborted)throw new L;if(!f0)G0=U0,f0=!0;else G0=await l(G0,U0,{signal:h})}if(!Q0&&!f0)throw new R}finally{y.abort()}return G0}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 G0=[];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 L(void 0,{cause:l.signal.reason});x(G0,s)}return G0}function p(l,G0){let n=W.call(this,l,G0);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,G0=void 0){if(G0!=null)T(G0,"options");if((G0===null||G0===void 0?void 0:G0.signal)!=null)M(G0.signal,"options.signal");return l=o(l),async function*(){var n;if(G0!==null&&G0!==void 0&&(n=G0.signal)!==null&&n!==void 0&&n.aborted)throw new L;for await(let f0 of this){var s;if(G0!==null&&G0!==void 0&&(s=G0.signal)!==null&&s!==void 0&&s.aborted)throw new L;if(l--<=0)yield f0}}.call(this)}function a(l,G0=void 0){if(G0!=null)T(G0,"options");if((G0===null||G0===void 0?void 0:G0.signal)!=null)M(G0.signal,"options.signal");return l=o(l),async function*(){var n;if(G0!==null&&G0!==void 0&&(n=G0.signal)!==null&&n!==void 0&&n.aborted)throw new L;for await(let f0 of this){var s;if(G0!==null&&G0!==void 0&&(s=G0.signal)!==null&&s!==void 0&&s.aborted)throw new L;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:p,map:W,take:a,compose:Q},Z.exports.promiseReturningOperators={every:H,forEach:O,reduce:_,toArray:f,some:z,find:J}}),hQ=s0((U,Z)=>{var{ArrayPrototypePop:X,Promise:G}=Z1(),{isIterable:K,isNodeStream:F,isWebStream:$}=kU(),{pipelineImpl:L}=sY(),{finished:M}=yU();uQ();function D(...T){return new G((A,q)=>{let S,E,j=T[T.length-1];if(j&&typeof j==="object"&&!F(j)&&!K(j)&&!$(j)){let k=X(T);S=k.signal,E=k.end}L(T,(k,B)=>{if(k)q(k);else A(B)},{signal:S,end:E})})}Z.exports={finished:M,pipeline:D}}),uQ=s0((U,Z)=>{var{Buffer:X}=(g1(),m0(N1)),{ObjectDefineProperty:G,ObjectKeys:K,ReflectApply:F}=Z1(),{promisify:{custom:$}}=i1(),{streamReturningOperators:L,promiseReturningOperators:M}=EI(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:D}}=n1(),T=cQ(),{setDefaultHighWaterMark:A,getDefaultHighWaterMark:q}=jX(),{pipeline:S}=sY(),{destroyer:E}=zZ(),j=yU(),k=hQ(),B=kU(),v=Z.exports=nY().Stream;v.isDestroyed=B.isDestroyed,v.isDisturbed=B.isDisturbed,v.isErrored=B.isErrored,v.isReadable=B.isReadable,v.isWritable=B.isWritable,v.Readable=vX();for(let N of K(L)){let w=function(...Z0){if(new.target)throw D();return v.Readable.from(F(u,this,Z0))},u=L[N];G(w,"name",{__proto__:null,value:u.name}),G(w,"length",{__proto__:null,value:u.length}),G(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 D();return F(u,this,Z0)},u=M[N];G(w,"name",{__proto__:null,value:u.name}),G(w,"length",{__proto__:null,value:u.length}),G(v.Readable.prototype,N,{__proto__:null,value:w,enumerable:!1,configurable:!0,writable:!0})}v.Writable=mY(),v.Duplex=PU(),v.Transform=yQ(),v.PassThrough=pQ(),v.pipeline=S;var{addAbortSignal:x}=kX();v.addAbortSignal=x,v.finished=j,v.destroy=E,v.compose=T,v.setDefaultHighWaterMark=A,v.getDefaultHighWaterMark=q,G(v,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return k}}),G(S,$,{__proto__:null,enumerable:!0,get(){return k.pipeline}}),G(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)}}),PI=s0((U,Z)=>{var X=rY();{let G=uQ(),K=hQ(),F=G.Readable.destroy;Z.exports=G.Readable,Z.exports._uint8ArrayToBuffer=G._uint8ArrayToBuffer,Z.exports._isUint8Array=G._isUint8Array,Z.exports.isDisturbed=G.isDisturbed,Z.exports.isErrored=G.isErrored,Z.exports.isReadable=G.isReadable,Z.exports.Readable=G.Readable,Z.exports.Writable=G.Writable,Z.exports.Duplex=G.Duplex,Z.exports.Transform=G.Transform,Z.exports.PassThrough=G.PassThrough,Z.exports.addAbortSignal=G.addAbortSignal,Z.exports.finished=G.finished,Z.exports.destroy=G.destroy,Z.exports.destroy=F,Z.exports.pipeline=G.pipeline,Z.exports.compose=G.compose,Object.defineProperty(G,"promises",{configurable:!0,enumerable:!0,get(){return K}}),Z.exports.Stream=G.Stream}Z.exports.default=Z.exports});bQ.exports=PI()});var e1={};WZ(e1,{webcrypto:()=>eH,rng:()=>IH,randomUUID:()=>aH,randomFillSync:()=>oH,randomFill:()=>lH,randomBytes:()=>FH,publicEncrypt:()=>hH,publicDecrypt:()=>bH,pseudoRandomBytes:()=>WH,prng:()=>KH,privateEncrypt:()=>uH,privateDecrypt:()=>dH,pbkdf2Sync:()=>LH,pbkdf2:()=>zH,listCiphers:()=>vH,getRandomValues:()=>rH,getHashes:()=>DH,getDiffieHellman:()=>xH,getCurves:()=>iH,getCiphers:()=>jH,default:()=>UO,createVerify:()=>yH,createSign:()=>fH,createHmac:()=>AH,createHash:()=>OH,createECDH:()=>cH,createDiffieHellmanGroup:()=>BH,createDiffieHellman:()=>NH,createDecipheriv:()=>kH,createDecipher:()=>EH,createCredentials:()=>nH,createCipheriv:()=>RH,createCipher:()=>qH,constants:()=>mH,Verify:()=>pH,Sign:()=>wH,Hmac:()=>CH,Hash:()=>HH,DiffieHellmanGroup:()=>_H,DiffieHellman:()=>gH,Decipheriv:()=>PH,Decipher:()=>SH,DEFAULT_ENCODING:()=>sH,Cipheriv:()=>TH,Cipher:()=>MH});function iH(){return tH}var kI,jI,dQ,vI,_I,BI=(U,Z,X)=>{X=U!=null?kI(jI(U)):{};let G=Z||!U||!U.__esModule?dQ(X,"default",{value:U,enumerable:!0}):X;for(let K of vI(U))if(!_I.call(G,K))dQ(G,K,{get:()=>U[K],enumerable:!0});return G},$0=(U,Z)=>()=>(Z||U((Z={exports:{}}).exports,Z),Z.exports),_X,BX,oQ,xI,tY,iY,m1,NI,yZ,nQ,gI,fI,wI,yI,mQ,pI,cI,hI,uI,bI,dI,lI,oI,nI,mI,pZ,xX,sQ,sI,rQ,aQ,rI,cZ,eY,UJ,aI,tQ,ZJ,tI,iQ,iI,eQ,UV,eI,UF,ZF,XF,YF,JF,GF,QF,VF,$F,KF,WF,IF,FF,XJ,ZV,HF,XV,OF,CF,AF,DF,jU,pU,YV,WU,JV,NX,zF,YU,LF,MF,qF,GV,zU,hZ,QV,TF,VV,RF,$V,SF,EF,PF,kF,YJ,jF,JJ,vF,_F,BF,xF,NF,gF,fF,wF,yF,pF,cF,hF,uF,bF,lQ,dF,wZ,lF,KV,WV,oF,nF,IV,mF,sF,uZ,rF,aF,tF,iF,eF,UH,FV,ZH,HV,OV,CV,GJ,AV,XH,DV,YH,JH,aY,GH,QH,VH,$H,o0,KH,WH,IH,FH,HH,OH,CH,AH,DH,zH,LH,MH,qH,TH,RH,SH,EH,PH,kH,jH,vH,_H,BH,xH,NH,gH,fH,wH,yH,pH,cH,hH,uH,bH,dH,lH,oH,nH,mH,sH="buffer",rH=(U)=>{return crypto.getRandomValues(U)},aH=()=>{return crypto.randomUUID()},tH,eH,UO;var UU=IZ(()=>{kI=Object.create,{getPrototypeOf:jI,defineProperty:dQ,getOwnPropertyNames:vI}=Object,_I=Object.prototype.hasOwnProperty,_X=$0((U,Z)=>{Z.exports=(UU(),m0(e1)).randomBytes}),BX=$0((U,Z)=>{Z.exports=(UU(),m0(e1)).createHash}),oQ=$0((U,Z)=>{Z.exports=(UU(),m0(e1)).createHmac}),xI=$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"}}}),tY=$0((U,Z)=>{var X=isFinite,G=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>G||F!==F)throw TypeError("Bad key length")}}),iY=$0((U,Z)=>{var X;if(globalThis.process&&globalThis.process.browser)X="utf-8";else if(globalThis.process&&globalThis.process.version)G=parseInt(process.version.split(".")[0].slice(1),10),X=G>=6?"utf-8":"binary";else X="utf-8";var G;Z.exports=X}),m1=$0((U,Z)=>{/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var X=(g1(),m0(N1)),G=X.Buffer;function K($,L){for(var M in $)L[M]=$[M]}if(G.from&&G.alloc&&G.allocUnsafe&&G.allocUnsafeSlow)Z.exports=X;else K(X,U),U.Buffer=F;function F($,L,M){return G($,L,M)}F.prototype=Object.create(G.prototype),K(G,F),F.from=function($,L,M){if(typeof $==="number")throw TypeError("Argument must not be a number");return G($,L,M)},F.alloc=function($,L,M){if(typeof $!=="number")throw TypeError("Argument must be a number");var D=G($);if(L!==void 0)if(typeof M==="string")D.fill(L,M);else D.fill(L);else D.fill(0);return D},F.allocUnsafe=function($){if(typeof $!=="number")throw TypeError("Argument must be a number");return G($)},F.allocUnsafeSlow=function($){if(typeof $!=="number")throw TypeError("Argument must be a number");return X.SlowBuffer($)}}),NI=$0((U,Z)=>{var X={}.toString;Z.exports=Array.isArray||function(G){return X.call(G)=="[object Array]"}}),yZ=$0((U,Z)=>{Z.exports=TypeError}),nQ=$0((U,Z)=>{Z.exports=Object}),gI=$0((U,Z)=>{Z.exports=Error}),fI=$0((U,Z)=>{Z.exports=EvalError}),wI=$0((U,Z)=>{Z.exports=RangeError}),yI=$0((U,Z)=>{Z.exports=ReferenceError}),mQ=$0((U,Z)=>{Z.exports=SyntaxError}),pI=$0((U,Z)=>{Z.exports=URIError}),cI=$0((U,Z)=>{Z.exports=Math.abs}),hI=$0((U,Z)=>{Z.exports=Math.floor}),uI=$0((U,Z)=>{Z.exports=Math.max}),bI=$0((U,Z)=>{Z.exports=Math.min}),dI=$0((U,Z)=>{Z.exports=Math.pow}),lI=$0((U,Z)=>{Z.exports=Math.round}),oI=$0((U,Z)=>{Z.exports=Number.isNaN||function(X){return X!==X}}),nI=$0((U,Z)=>{var X=oI();Z.exports=function(G){if(X(G)||G===0)return G;return G<0?-1:1}}),mI=$0((U,Z)=>{Z.exports=Object.getOwnPropertyDescriptor}),pZ=$0((U,Z)=>{var X=mI();if(X)try{X([],"length")}catch(G){X=null}Z.exports=X}),xX=$0((U,Z)=>{var X=Object.defineProperty||!1;if(X)try{X({},"a",{value:1})}catch(G){X=!1}Z.exports=X}),sQ=$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={},G=Symbol("test"),K=Object(G);if(typeof G==="string")return!1;if(Object.prototype.toString.call(G)!=="[object Symbol]")return!1;if(Object.prototype.toString.call(K)!=="[object Symbol]")return!1;var F=42;X[G]=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 L=Object.getOwnPropertySymbols(X);if(L.length!==1||L[0]!==G)return!1;if(!Object.prototype.propertyIsEnumerable.call(X,G))return!1;if(typeof Object.getOwnPropertyDescriptor==="function"){var M=Object.getOwnPropertyDescriptor(X,G);if(M.value!==F||M.enumerable!==!0)return!1}return!0}}),sI=$0((U,Z)=>{var X=typeof Symbol<"u"&&Symbol,G=sQ();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 G()}}),rQ=$0((U,Z)=>{Z.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null}),aQ=$0((U,Z)=>{var X=nQ();Z.exports=X.getPrototypeOf||null}),rI=$0((U,Z)=>{var X="Function.prototype.bind called on incompatible ",G=Object.prototype.toString,K=Math.max,F="[object Function]",$=function(D,T){var A=[];for(var q=0;q<D.length;q+=1)A[q]=D[q];for(var S=0;S<T.length;S+=1)A[S+D.length]=T[S];return A},L=function(D,T){var A=[];for(var q=T||0,S=0;q<D.length;q+=1,S+=1)A[S]=D[q];return A},M=function(D,T){var A="";for(var q=0;q<D.length;q+=1)if(A+=D[q],q+1<D.length)A+=T;return A};Z.exports=function(D){var T=this;if(typeof T!=="function"||G.apply(T)!==F)throw TypeError(X+T);var A=L(arguments,1),q,S=function(){if(this instanceof q){var v=T.apply(this,$(A,arguments));if(Object(v)===v)return v;return this}return T.apply(D,$(A,arguments))},E=K(0,T.length-A.length),j=[];for(var k=0;k<E;k++)j[k]="$"+k;if(q=Function("binder","return function ("+M(j,",")+"){ return binder.apply(this,arguments); }")(S),T.prototype){var B=function(){};B.prototype=T.prototype,q.prototype=new B,B.prototype=null}return q}}),cZ=$0((U,Z)=>{var X=rI();Z.exports=Function.prototype.bind||X}),eY=$0((U,Z)=>{Z.exports=Function.prototype.call}),UJ=$0((U,Z)=>{Z.exports=Function.prototype.apply}),aI=$0((U,Z)=>{Z.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply}),tQ=$0((U,Z)=>{var X=cZ(),G=UJ(),K=eY(),F=aI();Z.exports=F||X.call(K,G)}),ZJ=$0((U,Z)=>{var X=cZ(),G=yZ(),K=eY(),F=tQ();Z.exports=function($){if($.length<1||typeof $[0]!=="function")throw new G("a function is required");return F(X,K,$)}}),tI=$0((U,Z)=>{var X=ZJ(),G=pZ(),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&&G&&G(Object.prototype,"__proto__"),$=Object,L=$.getPrototypeOf;Z.exports=F&&typeof F.get==="function"?X([F.get]):typeof L==="function"?function(M){return L(M==null?M:$(M))}:!1}),iQ=$0((U,Z)=>{var X=rQ(),G=aQ(),K=tI();Z.exports=X?function(F){return X(F)}:G?function(F){if(!F||typeof F!=="object"&&typeof F!=="function")throw TypeError("getProto: not an object");return G(F)}:K?function(F){return K(F)}:null}),iI=$0((U,Z)=>{var X=Function.prototype.call,G=Object.prototype.hasOwnProperty,K=cZ();Z.exports=K.call(X,G)}),eQ=$0((U,Z)=>{var X,G=nQ(),K=gI(),F=fI(),$=wI(),L=yI(),M=mQ(),D=yZ(),T=pI(),A=cI(),q=hI(),S=uI(),E=bI(),j=dI(),k=lI(),B=nI(),v=Function,x=function(G0){try{return v('"use strict"; return ('+G0+").constructor;")()}catch(n){}},N=pZ(),w=xX(),u=function(){throw new D},Z0=N?function(){try{return arguments.callee,u}catch(G0){try{return N(arguments,"callee").get}catch(n){return u}}}():u,V0=sI()(),Y0=iQ(),b=aQ(),i=rQ(),Y=UJ(),V=eY(),I={},Q=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%":G,"%Object.getOwnPropertyDescriptor%":N,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?X:Promise,"%Proxy%":typeof Proxy>"u"?X:Proxy,"%RangeError%":$,"%ReferenceError%":L,"%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%":Q,"%TypeError%":D,"%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%":q,"%Math.max%":S,"%Math.min%":E,"%Math.pow%":j,"%Math.round%":k,"%Math.sign%":B,"%Reflect.getPrototypeOf%":i};if(Y0)try{null.error}catch(G0){C=Y0(Y0(G0)),W["%Error.prototype%"]=C}var C,z=function G0(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=G0("%AsyncGeneratorFunction%");if(f0)s=f0.prototype}else if(n==="%AsyncIteratorPrototype%"){var y=G0("%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=cZ(),O=iI(),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),p=J.call(V,RegExp.prototype.exec),o=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,K0=/\\(\\)?/g,a=function(G0){var n=f(G0,0,1),s=f(G0,-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 _(G0,o,function(y,h,Q0,t){f0[f0.length]=Q0?_(t,K0,"$1"):h||y}),f0},l=function(G0,n){var s=G0,f0;if(O(H,s))f0=H[s],s="%"+f0[0]+"%";if(O(W,s)){var y=W[s];if(y===I)y=z(s);if(typeof y>"u"&&!n)throw new D("intrinsic "+G0+" exists, but is not available. Please file an issue!");return{alias:f0,name:s,value:y}}throw new M("intrinsic "+G0+" does not exist!")};Z.exports=function(G0,n){if(typeof G0!=="string"||G0.length===0)throw new D("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof n!=="boolean")throw new D('"allowMissing" argument must be a boolean');if(p(/^%?[^%]*%?$/,G0)===null)throw new M("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var s=a(G0),f0=s.length>0?s[0]:"",y=l("%"+f0+"%",n),h=y.name,Q0=y.value,t=!1,U0=y.alias;if(U0)f0=U0[0],R(s,P([0,1],U0));for(var q0=1,c=!0;q0<s.length;q0+=1){var m=s[q0],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"||!c)t=!0;if(f0+="."+m,h="%"+f0+"%",O(W,h))Q0=W[h];else if(Q0!=null){if(!(m in Q0)){if(!n)throw new D("base intrinsic for "+G0+" exists, but the property is not available.");return}if(N&&q0+1>=s.length){var J0=N(Q0,m);if(c=!!J0,c&&"get"in J0&&!("originalValue"in J0.get))Q0=J0.get;else Q0=Q0[m]}else c=O(Q0,m),Q0=Q0[m];if(c&&!t)W[h]=Q0}}return Q0}}),UV=$0((U,Z)=>{var X=eQ(),G=ZJ(),K=G([X("%String.prototype.indexOf%")]);Z.exports=function(F,$){var L=X(F,!!$);if(typeof L==="function"&&K(F,".prototype.")>-1)return G([L]);return L}}),eI=$0((U,Z)=>{var X=Function.prototype.toString,G=typeof Reflect==="object"&&Reflect!==null&&Reflect.apply,K,F;if(typeof G==="function"&&typeof Object.defineProperty==="function")try{K=Object.defineProperty({},"length",{get:function(){throw F}}),F={},G(function(){throw 42},null,K)}catch(N){if(N!==F)G=null}else G=null;var $=/^\s*class\b/,L=function(N){try{var w=X.call(N);return $.test(w)}catch(u){return!1}},M=function(N){try{if(L(N))return!1;return X.call(N),!0}catch(w){return!1}},D=Object.prototype.toString,T="[object Object]",A="[object Function]",q="[object GeneratorFunction]",S="[object HTMLAllCollection]",E="[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,D.call(x)===D.call(document.all))v=function(N){if((B||!N)&&(typeof N>"u"||typeof N==="object"))try{var w=D.call(N);return(w===S||w===E||w===j||w===T)&&N("")==null}catch(u){}return!1}}var x;Z.exports=G?function(N){if(v(N))return!0;if(!N)return!1;if(typeof N!=="function"&&typeof N!=="object")return!1;try{G(N,null,K)}catch(w){if(w!==F)return!1}return!L(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(L(N))return!1;var w=D.call(N);if(w!==A&&w!==q&&!/^\[object HTML/.test(w))return!1;return M(N)}}),UF=$0((U,Z)=>{var X=eI(),G=Object.prototype.toString,K=Object.prototype.hasOwnProperty,F=function(D,T,A){for(var q=0,S=D.length;q<S;q++)if(K.call(D,q))if(A==null)T(D[q],q,D);else T.call(A,D[q],q,D)},$=function(D,T,A){for(var q=0,S=D.length;q<S;q++)if(A==null)T(D.charAt(q),q,D);else T.call(A,D.charAt(q),q,D)},L=function(D,T,A){for(var q in D)if(K.call(D,q))if(A==null)T(D[q],q,D);else T.call(A,D[q],q,D)};function M(D){return G.call(D)==="[object Array]"}Z.exports=function(D,T,A){if(!X(T))throw TypeError("iterator must be a function");var q;if(arguments.length>=3)q=A;if(M(D))F(D,T,q);else if(typeof D==="string")$(D,T,q);else L(D,T,q)}}),ZF=$0((U,Z)=>{Z.exports=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]}),XF=$0((U,Z)=>{var X=ZF(),G=typeof globalThis>"u"?globalThis:globalThis;Z.exports=function(){var K=[];for(var F=0;F<X.length;F++)if(typeof G[X[F]]==="function")K[K.length]=X[F];return K}}),YF=$0((U,Z)=>{var X=xX(),G=mQ(),K=yZ(),F=pZ();Z.exports=function($,L,M){if(!$||typeof $!=="object"&&typeof $!=="function")throw new K("`obj` must be an object or a function`");if(typeof L!=="string"&&typeof L!=="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 D=arguments.length>3?arguments[3]:null,T=arguments.length>4?arguments[4]:null,A=arguments.length>5?arguments[5]:null,q=arguments.length>6?arguments[6]:!1,S=!!F&&F($,L);if(X)X($,L,{configurable:A===null&&S?S.configurable:!A,enumerable:D===null&&S?S.enumerable:!D,value:M,writable:T===null&&S?S.writable:!T});else if(q||!D&&!T&&!A)$[L]=M;else throw new G("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}}),JF=$0((U,Z)=>{var X=xX(),G=function(){return!!X};G.hasArrayLengthDefineBug=function(){if(!X)return null;try{return X([],"length",{value:1}).length!==1}catch(K){return!0}},Z.exports=G}),GF=$0((U,Z)=>{var X=eQ(),G=YF(),K=JF()(),F=pZ(),$=yZ(),L=X("%Math.floor%");Z.exports=function(M,D){if(typeof M!=="function")throw new $("`fn` is not a function");if(typeof D!=="number"||D<0||D>4294967295||L(D)!==D)throw new $("`length` must be a positive 32-bit integer");var T=arguments.length>2&&!!arguments[2],A=!0,q=!0;if("length"in M&&F){var S=F(M,"length");if(S&&!S.configurable)A=!1;if(S&&!S.writable)q=!1}if(A||q||!T)if(K)G(M,"length",D,!0,!0);else G(M,"length",D);return M}}),QF=$0((U,Z)=>{var X=cZ(),G=UJ(),K=tQ();Z.exports=function(){return K(X,G,arguments)}}),VF=$0((U,Z)=>{var X=GF(),G=xX(),K=ZJ(),F=QF();if(Z.exports=function($){var L=K(arguments),M=$.length-(arguments.length-1);return X(L,1+(M>0?M:0),!0)},G)G(Z.exports,"apply",{value:F});else Z.exports.apply=F}),$F=$0((U,Z)=>{var X=sQ();Z.exports=function(){return X()&&!!Symbol.toStringTag}}),KF=$0((U,Z)=>{var X=UF(),G=XF(),K=VF(),F=UV(),$=pZ(),L=iQ(),M=F("Object.prototype.toString"),D=$F()(),T=typeof globalThis>"u"?globalThis:globalThis,A=G(),q=F("String.prototype.slice"),S=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},E={__proto__:null};if(D&&$&&L)X(A,function(B){var v=new T[B];if(Symbol.toStringTag in v&&L){var x=L(v),N=$(x,Symbol.toStringTag);if(!N&&x){var w=L(x);N=$(w,Symbol.toStringTag)}E["$"+B]=K(N.get)}});else X(A,function(B){var v=new T[B],x=v.slice||v.set;if(x)E["$"+B]=K(x)});var j=function(B){var v=!1;return X(E,function(x,N){if(!v)try{if("$"+x(B)===N)v=q(N,1)}catch(w){}}),v},k=function(B){var v=!1;return X(E,function(x,N){if(!v)try{x(B),v=q(N,1)}catch(w){}}),v};Z.exports=function(B){if(!B||typeof B!=="object")return!1;if(!D){var v=q(M(B),8,-1);if(S(A,v)>-1)return v;if(v!=="Object")return!1;return k(B)}if(!$)return null;return j(B)}}),WF=$0((U,Z)=>{var X=KF();Z.exports=function(G){return!!X(G)}}),IF=$0((U,Z)=>{var X=yZ(),G=UV(),K=G("TypedArray.prototype.buffer",!0),F=WF();Z.exports=K||function($){if(!F($))throw new X("Not a Typed Array");return $.buffer}}),FF=$0((U,Z)=>{var X=m1().Buffer,G=NI(),K=IF(),F=ArrayBuffer.isView||function(D){try{return K(D),!0}catch(T){return!1}},$=typeof Uint8Array<"u",L=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",M=L&&(X.prototype instanceof Uint8Array||X.TYPED_ARRAY_SUPPORT);Z.exports=function(D,T){if(X.isBuffer(D)){if(D.constructor&&!("isBuffer"in D))return X.from(D);return D}if(typeof D==="string")return X.from(D,T);if(L&&F(D)){if(D.byteLength===0)return X.alloc(0);if(M){var A=X.from(D.buffer,D.byteOffset,D.byteLength);if(A.byteLength===D.byteLength)return A}var q=D instanceof Uint8Array?D:new Uint8Array(D.buffer,D.byteOffset,D.byteLength),S=X.from(q);if(S.length===D.byteLength)return S}if($&&D instanceof Uint8Array)return X.from(D);var E=G(D);if(E)for(var j=0;j<D.length;j+=1){var k=D[j];if(typeof k!=="number"||k<0||k>255||~~k!==k)throw RangeError("Array items must be numbers in the range 0-255.")}if(E||X.isBuffer(D)&&D.constructor&&typeof D.constructor.isBuffer==="function"&&D.constructor.isBuffer(D))return X.from(D);throw TypeError('The "data" argument must be a string, an Array, a Buffer, a Uint8Array, or a DataView.')}}),XJ=$0((U,Z)=>{var X=m1().Buffer,G=FF(),K=typeof Uint8Array<"u",F=K&&typeof ArrayBuffer<"u",$=F&&ArrayBuffer.isView;Z.exports=function(L,M,D){if(typeof L==="string"||X.isBuffer(L)||K&&L instanceof Uint8Array||$&&$(L))return G(L,M);throw TypeError(D+" must be a string, a Buffer, a Uint8Array, or a DataView")}}),ZV=$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},G={__proto__:null,"sha-1":"sha1","sha-224":"sha224","sha-256":"sha256","sha-384":"sha384","sha-512":"sha512","ripemd-160":"ripemd160"},K=oQ(),F=m1().Buffer,$=tY(),L=iY(),M=XJ();function D(T,A,q,S,E){$(q,S),T=M(T,L,"Password"),A=M(A,L,"Salt");var j=(E||"sha1").toLowerCase(),k=G[j]||j,B=X[k];if(typeof B!=="number"||!B)throw TypeError("Digest algorithm not supported: "+E);var v=F.allocUnsafe(S),x=F.allocUnsafe(A.length+4);A.copy(x,0,0,A.length);var N=0,w=B,u=Math.ceil(S/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<q;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=D}),HF=$0((U,Z)=>{var X=m1().Buffer,G=tY(),K=iY(),F=ZV(),$=XJ(),L,M=globalThis.crypto&&globalThis.crypto.subtle,D={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 q(){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 S(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 E(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];L=L||X.alloc(8);var B=S(L,L,10,128,k).then(function(){return!0},function(){return!1});return T[k]=B,B}function j(k,B){k.then(function(v){q()(function(){B(null,v)})},function(v){q()(function(){B(v)})})}Z.exports=function(k,B,v,x,N,w){if(typeof N==="function")w=N,N=void 0;if(G(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=D[N.toLowerCase()];if(!u||typeof globalThis.Promise!=="function"){q()(function(){var Z0;try{Z0=F(k,B,v,x,N)}catch(V0){w(V0);return}w(null,Z0)});return}j(E(u).then(function(Z0){if(Z0)return S(k,B,v,x,u);return F(k,B,v,x,N)}),w)}}),XV=$0((U)=>{var Z=(UU(),m0(e1)),X=tY(),G=iY(),K=XJ();function F(L,M,D,T,A,q){if(X(D,T),L=K(L,G,"Password"),M=K(M,G,"Salt"),typeof A==="function")q=A,A="sha1";if(typeof q!=="function")throw Error("No callback provided to pbkdf2");return Z.pbkdf2(L,M,D,T,A,q)}function $(L,M,D,T,A){return X(D,T),L=K(L,G,"Password"),M=K(M,G,"Salt"),A=A||"sha1",Z.pbkdf2Sync(L,M,D,T,A)}if(!Z.pbkdf2Sync||Z.pbkdf2Sync.toString().indexOf("keylen, digest")===-1)U.pbkdf2Sync=ZV(),U.pbkdf2=HF();else U.pbkdf2Sync=$,U.pbkdf2=F}),OF=$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}),CF=$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}),AF=$0((U)=>{var Z=(UU(),m0(e1));U.createSign=Z.createSign,U.Sign=Z.Sign,U.createVerify=Z.createVerify,U.Verify=Z.Verify}),DF=$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,G){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 G.BN=$;$.BN=$,$.wordSize=26;var L;try{if(typeof window<"u"&&typeof window.Buffer<"u")L=window.Buffer;else L=(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 Q=0;if(Y[0]==="-")Q++,this.negative=1;if(Q<Y.length){if(V===16)this._parseHex(Y,Q,I);else if(this._parseBase(Y,V,Q),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 Q=0;Q<this.length;Q++)this.words[Q]=0;var W,C,z=0;if(I==="be"){for(Q=Y.length-1,W=0;Q>=0;Q-=3)if(C=Y[Q]|Y[Q-1]<<8|Y[Q-2]<<16,this.words[W]|=C<<z&67108863,this.words[W+1]=C>>>26-z&67108863,z+=24,z>=26)z-=26,W++}else if(I==="le"){for(Q=0,W=0;Q<Y.length;Q+=3)if(C=Y[Q]|Y[Q+1]<<8|Y[Q+2]<<16,this.words[W]|=C<<z&67108863,this.words[W+1]=C>>>26-z&67108863,z+=24,z>=26)z-=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 D(Y,V,I){var Q=M(Y,I);if(I-1>=V)Q|=M(Y,I-1)<<4;return Q}$.prototype._parseHex=function(Y,V,I){this.length=Math.ceil((Y.length-V)/6),this.words=Array(this.length);for(var Q=0;Q<this.length;Q++)this.words[Q]=0;var W=0,C=0,z;if(I==="be")for(Q=Y.length-1;Q>=V;Q-=2)if(z=D(Y,V,Q)<<W,this.words[C]|=z&67108863,W>=18)W-=18,C+=1,this.words[C]|=z>>>26;else W+=8;else{var H=Y.length-V;for(Q=H%2===0?V+1:V;Q<Y.length;Q+=2)if(z=D(Y,V,Q)<<W,this.words[C]|=z&67108863,W>=18)W-=18,C+=1,this.words[C]|=z>>>26;else W+=8}this.strip()};function T(Y,V,I,Q){var W=0,C=Math.min(Y.length,I);for(var z=V;z<C;z++){var H=Y.charCodeAt(z)-48;if(W*=Q,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 Q=0,W=1;W<=67108863;W*=V)Q++;Q--,W=W/V|0;var C=Y.length-I,z=C%Q,H=Math.min(C,C-z)+I,J=0;for(var O=I;O<H;O+=Q)if(J=T(Y,O,O+Q,V),this.imuln(W),this.words[0]+J<67108864)this.words[0]+=J;else this._iaddn(J);if(z!==0){var P=1;J=T(Y,O,Y.length,V);for(O=0;O<z;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"],q=[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],S=[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 Q=0,W=0;for(var C=0;C<this.length;C++){var z=this.words[C],H=((z<<Q|W)&16777215).toString(16);if(W=z>>>24-Q&16777215,Q+=2,Q>=26)Q-=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=q[Y],O=S[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 L<"u"),this.toArrayLike(L,Y,V)},$.prototype.toArray=function(Y,V){return this.toArrayLike(Array,Y,V)},$.prototype.toArrayLike=function(Y,V,I){var Q=this.byteLength(),W=I||Math.max(1,Q);K(Q<=W,"byte array longer than desired length"),K(W>0,"Requested array length <= 0"),this.strip();var C=V==="le",z=new Y(W),H,J,O=this.clone();if(!C){for(J=0;J<W-Q;J++)z[J]=0;for(J=0;!O.isZero();J++)H=O.andln(255),O.iushrn(8),z[W-J-1]=H}else{for(J=0;!O.isZero();J++)H=O.andln(255),O.iushrn(8),z[J]=H;for(;J<W;J++)z[J]=0}return z},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 E(Y){var V=Array(Y.bitLength());for(var I=0;I<V.length;I++){var Q=I/26|0,W=I%26;V[I]=(Y.words[Q]&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 Q=0;Q<I.length;Q++)this.words[Q]=V.words[Q]^I.words[Q];if(this!==V)for(;Q<V.length;Q++)this.words[Q]=V.words[Q];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 Q=0;Q<V;Q++)this.words[Q]=~this.words[Q]&67108863;if(I>0)this.words[Q]=~this.words[Q]&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,Q=Y%26;if(this._expand(I+1),V)this.words[I]=this.words[I]|1<<Q;else this.words[I]=this.words[I]&~(1<<Q);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,Q;if(this.length>Y.length)I=this,Q=Y;else I=Y,Q=this;var W=0;for(var C=0;C<Q.length;C++)V=(I.words[C]|0)+(Q.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 Q,W;if(I>0)Q=this,W=Y;else Q=Y,W=this;var C=0;for(var z=0;z<W.length;z++)V=(Q.words[z]|0)-(W.words[z]|0)+C,C=V>>26,this.words[z]=V&67108863;for(;C!==0&&z<Q.length;z++)V=(Q.words[z]|0)+C,C=V>>26,this.words[z]=V&67108863;if(C===0&&z<Q.length&&Q!==this)for(;z<Q.length;z++)this.words[z]=Q.words[z];if(this.length=Math.max(this.length,z),Q!==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 Q=Y.length+V.length|0;I.length=Q,Q=Q-1|0;var W=Y.words[0]|0,C=V.words[0]|0,z=W*C,H=z&67108863,J=z/67108864|0;I.words[0]=H;for(var O=1;O<Q;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 p=O-f|0;W=Y.words[p]|0,C=V.words[f]|0,z=W*C+R,P+=z/67108864|0,R=z&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 Q=Y.words,W=V.words,C=I.words,z=0,H,J,O,P=Q[0]|0,R=P&8191,_=P>>>13,f=Q[1]|0,p=f&8191,o=f>>>13,K0=Q[2]|0,a=K0&8191,l=K0>>>13,G0=Q[3]|0,n=G0&8191,s=G0>>>13,f0=Q[4]|0,y=f0&8191,h=f0>>>13,Q0=Q[5]|0,t=Q0&8191,U0=Q0>>>13,q0=Q[6]|0,c=q0&8191,m=q0>>>13,g0=Q[7]|0,r=g0&8191,J0=g0>>>13,h0=Q[8]|0,H0=h0&8191,O0=h0>>>13,J1=Q[9]|0,I0=J1&8191,C0=J1>>>13,K1=W[0]|0,L0=K1&8191,D0=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,S0=h1>>>13,_1=W[4]|0,B0=_1&8191,x0=_1>>>13,B1=W[5]|0,E0=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,G1=W[8]|0,P0=G1&8191,N0=G1>>>13,u1=W[9]|0,k0=u1&8191,M0=u1>>>13;I.negative=Y.negative^V.negative,I.length=19,H=Math.imul(R,L0),J=Math.imul(R,D0),J=J+Math.imul(_,L0)|0,O=Math.imul(_,D0);var Q1=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(Q1>>>26)|0,Q1&=67108863,H=Math.imul(p,L0),J=Math.imul(p,D0),J=J+Math.imul(o,L0)|0,O=Math.imul(o,D0),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=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(l0>>>26)|0,l0&=67108863,H=Math.imul(a,L0),J=Math.imul(a,D0),J=J+Math.imul(l,L0)|0,O=Math.imul(l,D0),H=H+Math.imul(p,T0)|0,J=J+Math.imul(p,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=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(b0>>>26)|0,b0&=67108863,H=Math.imul(n,L0),J=Math.imul(n,D0),J=J+Math.imul(s,L0)|0,O=Math.imul(s,D0),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(p,v0)|0,J=J+Math.imul(p,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,S0)|0,J=J+Math.imul(_,_0)|0,O=O+Math.imul(_,S0)|0;var t0=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(t0>>>26)|0,t0&=67108863,H=Math.imul(y,L0),J=Math.imul(y,D0),J=J+Math.imul(h,L0)|0,O=Math.imul(h,D0),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(p,_0)|0,J=J+Math.imul(p,S0)|0,J=J+Math.imul(o,_0)|0,O=O+Math.imul(o,S0)|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=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(r0>>>26)|0,r0&=67108863,H=Math.imul(t,L0),J=Math.imul(t,D0),J=J+Math.imul(U0,L0)|0,O=Math.imul(U0,D0),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,S0)|0,J=J+Math.imul(l,_0)|0,O=O+Math.imul(l,S0)|0,H=H+Math.imul(p,B0)|0,J=J+Math.imul(p,x0)|0,J=J+Math.imul(o,B0)|0,O=O+Math.imul(o,x0)|0,H=H+Math.imul(R,E0)|0,J=J+Math.imul(R,g)|0,J=J+Math.imul(_,E0)|0,O=O+Math.imul(_,g)|0;var H1=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(H1>>>26)|0,H1&=67108863,H=Math.imul(c,L0),J=Math.imul(c,D0),J=J+Math.imul(m,L0)|0,O=Math.imul(m,D0),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,S0)|0,J=J+Math.imul(s,_0)|0,O=O+Math.imul(s,S0)|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(p,E0)|0,J=J+Math.imul(p,g)|0,J=J+Math.imul(o,E0)|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=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(O1>>>26)|0,O1&=67108863,H=Math.imul(r,L0),J=Math.imul(r,D0),J=J+Math.imul(J0,L0)|0,O=Math.imul(J0,D0),H=H+Math.imul(c,T0)|0,J=J+Math.imul(c,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,S0)|0,J=J+Math.imul(h,_0)|0,O=O+Math.imul(h,S0)|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,E0)|0,J=J+Math.imul(a,g)|0,J=J+Math.imul(l,E0)|0,O=O+Math.imul(l,g)|0,H=H+Math.imul(p,e)|0,J=J+Math.imul(p,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=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(C1>>>26)|0,C1&=67108863,H=Math.imul(H0,L0),J=Math.imul(H0,D0),J=J+Math.imul(O0,L0)|0,O=Math.imul(O0,D0),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(c,v0)|0,J=J+Math.imul(c,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,S0)|0,J=J+Math.imul(U0,_0)|0,O=O+Math.imul(U0,S0)|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,E0)|0,J=J+Math.imul(n,g)|0,J=J+Math.imul(s,E0)|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(p,F0)|0,J=J+Math.imul(p,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=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(A1>>>26)|0,A1&=67108863,H=Math.imul(I0,L0),J=Math.imul(I0,D0),J=J+Math.imul(C0,L0)|0,O=Math.imul(C0,D0),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(c,_0)|0,J=J+Math.imul(c,S0)|0,J=J+Math.imul(m,_0)|0,O=O+Math.imul(m,S0)|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,E0)|0,J=J+Math.imul(y,g)|0,J=J+Math.imul(h,E0)|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(p,P0)|0,J=J+Math.imul(p,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 D1=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(D1>>>26)|0,D1&=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,S0)|0,J=J+Math.imul(J0,_0)|0,O=O+Math.imul(J0,S0)|0,H=H+Math.imul(c,B0)|0,J=J+Math.imul(c,x0)|0,J=J+Math.imul(m,B0)|0,O=O+Math.imul(m,x0)|0,H=H+Math.imul(t,E0)|0,J=J+Math.imul(t,g)|0,J=J+Math.imul(U0,E0)|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(p,k0)|0,J=J+Math.imul(p,M0)|0,J=J+Math.imul(o,k0)|0,O=O+Math.imul(o,M0)|0;var z1=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(z1>>>26)|0,z1&=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,S0)|0,J=J+Math.imul(O0,_0)|0,O=O+Math.imul(O0,S0)|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(c,E0)|0,J=J+Math.imul(c,g)|0,J=J+Math.imul(m,E0)|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 L1=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(L1>>>26)|0,L1&=67108863,H=Math.imul(I0,_0),J=Math.imul(I0,S0),J=J+Math.imul(C0,_0)|0,O=Math.imul(C0,S0),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,E0)|0,J=J+Math.imul(r,g)|0,J=J+Math.imul(J0,E0)|0,O=O+Math.imul(J0,g)|0,H=H+Math.imul(c,e)|0,J=J+Math.imul(c,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=(z+H|0)+((J&8191)<<13)|0;z=(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,E0)|0,J=J+Math.imul(H0,g)|0,J=J+Math.imul(O0,E0)|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(c,F0)|0,J=J+Math.imul(c,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 q1=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(q1>>>26)|0,q1&=67108863,H=Math.imul(I0,E0),J=Math.imul(I0,g),J=J+Math.imul(C0,E0)|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(c,P0)|0,J=J+Math.imul(c,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=(z+H|0)+((J&8191)<<13)|0;z=(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(c,k0)|0,J=J+Math.imul(c,M0)|0,J=J+Math.imul(m,k0)|0,O=O+Math.imul(m,M0)|0;var R1=(z+H|0)+((J&8191)<<13)|0;z=(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 S1=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(S1>>>26)|0,S1&=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 E1=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(E1>>>26)|0,E1&=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=(z+H|0)+((J&8191)<<13)|0;if(z=(O+(J>>>13)|0)+(P1>>>26)|0,P1&=67108863,C[0]=Q1,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]=D1,C[10]=z1,C[11]=L1,C[12]=M1,C[13]=q1,C[14]=T1,C[15]=R1,C[16]=S1,C[17]=E1,C[18]=P1,z!==0)C[19]=z,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 Q=0,W=0;for(var C=0;C<I.length-1;C++){var z=W;W=0;var H=Q&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*_,p=f&67108863;z=z+(f/67108864|0)|0,p=p+H|0,H=p&67108863,z=z+(p>>>26)|0,W+=z>>>26,z&=67108863}I.words[C]=H,Q=z,z=W}if(Q!==0)I.words[C]=Q;else I.length--;return I.strip()}function v(Y,V,I){var Q=new x;return Q.mulp(Y,V,I)}$.prototype.mulTo=function(Y,V){var I,Q=this.length+Y.length;if(this.length===10&&Y.length===10)I=k(this,Y,V);else if(Q<63)I=j(this,Y,V);else if(Q<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 Q=0;Q<Y;Q++)V[Q]=this.revBin(Q,I,Y);return V},x.prototype.revBin=function(Y,V,I){if(Y===0||Y===I-1)return Y;var Q=0;for(var W=0;W<V;W++)Q|=(Y&1)<<V-W-1,Y>>=1;return Q},x.prototype.permute=function(Y,V,I,Q,W,C){for(var z=0;z<C;z++)Q[z]=V[Y[z]],W[z]=I[Y[z]]},x.prototype.transform=function(Y,V,I,Q,W,C){this.permute(C,Y,V,I,Q,W);for(var z=1;z<W;z<<=1){var H=z<<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<z;f++){var p=I[P+f],o=Q[P+f],K0=I[P+f+z],a=Q[P+f+z],l=R*K0-_*a;if(a=R*a+_*K0,K0=l,I[P+f]=p+K0,Q[P+f]=o+a,I[P+f+z]=p-K0,Q[P+f+z]=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,Q=I&1,W=0;for(I=I/2|0;I;I=I>>>1)W++;return 1<<W+1+Q},x.prototype.conjugate=function(Y,V,I){if(I<=1)return;for(var Q=0;Q<I/2;Q++){var W=Y[Q];Y[Q]=Y[I-Q-1],Y[I-Q-1]=W,W=V[Q],V[Q]=-V[I-Q-1],V[I-Q-1]=-W}},x.prototype.normalize13b=function(Y,V){var I=0;for(var Q=0;Q<V/2;Q++){var W=Math.round(Y[2*Q+1]/V)*8192+Math.round(Y[2*Q]/V)+I;if(Y[Q]=W&67108863,W<67108864)I=0;else I=W/67108864|0}return Y},x.prototype.convert13b=function(Y,V,I,Q){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<Q;++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 Q=2*this.guessLen13b(Y.length,V.length),W=this.makeRBT(Q),C=this.stub(Q),z=Array(Q),H=Array(Q),J=Array(Q),O=Array(Q),P=Array(Q),R=Array(Q),_=I.words;_.length=Q,this.convert13b(Y.words,Y.length,z,Q),this.convert13b(V.words,V.length,O,Q),this.transform(z,C,H,J,Q,W),this.transform(O,C,P,R,Q,W);for(var f=0;f<Q;f++){var p=H[f]*P[f]-J[f]*R[f];J[f]=H[f]*R[f]+J[f]*P[f],H[f]=p}return this.conjugate(H,J,Q),this.transform(H,J,_,C,Q,W),this.conjugate(_,C,Q),this.normalize13b(_,Q),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 Q=(this.words[I]|0)*Y,W=(Q&67108863)+(V&67108863);V>>=26,V+=Q/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=E(Y);if(V.length===0)return new $(1);var I=this;for(var Q=0;Q<V.length;Q++,I=I.sqr())if(V[Q]!==0)break;if(++Q<V.length)for(var W=I.sqr();Q<V.length;Q++,W=W.sqr()){if(V[Q]===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,Q=67108863>>>26-V<<26-V,W;if(V!==0){var C=0;for(W=0;W<this.length;W++){var z=this.words[W]&Q,H=(this.words[W]|0)-z<<V;this.words[W]=H|C,C=z>>>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 Q;if(V)Q=(V-V%26)/26;else Q=0;var W=Y%26,C=Math.min((Y-W)/26,this.length),z=67108863^67108863>>>W<<W,H=I;if(Q-=C,Q=Math.max(0,Q),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>=Q);J--){var P=this.words[J]|0;this.words[J]=O<<26-W|P>>>W,O=P&z}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,Q=1<<V;if(this.length<=I)return!1;var W=this.words[I];return!!(W&Q)},$.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 Q=67108863^67108863>>>V<<V;this.words[this.length-1]&=Q}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 Q=Y.length+I,W;this._expand(Q);var C,z=0;for(W=0;W<Y.length;W++){C=(this.words[W+I]|0)+z;var H=(Y.words[W]|0)*V;C-=H&67108863,z=(C>>26)-(H/67108864|0),this.words[W+I]=C&67108863}for(;W<this.length-I;W++)C=(this.words[W+I]|0)+z,z=C>>26,this.words[W+I]=C&67108863;if(z===0)return this.strip();K(z===-1),z=0;for(W=0;W<this.length;W++)C=-(this.words[W]|0)+z,z=C>>26,this.words[W]=C&67108863;return this.negative=1,this.strip()},$.prototype._wordDiv=function(Y,V){var I=this.length-Y.length,Q=this.clone(),W=Y,C=W.words[W.length-1]|0,z=this._countBits(C);if(I=26-z,I!==0)W=W.ushln(I),Q.iushln(I),C=W.words[W.length-1]|0;var H=Q.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=Q.clone()._ishlnsubmul(W,1,H);if(P.negative===0){if(Q=P,J)J.words[H]=1}for(var R=H-1;R>=0;R--){var _=(Q.words[W.length+R]|0)*67108864+(Q.words[W.length+R-1]|0);_=Math.min(_/C|0,67108863),Q._ishlnsubmul(W,_,R);while(Q.negative!==0)if(_--,Q.negative=0,Q._ishlnsubmul(W,1,R),!Q.isZero())Q.negative^=1;if(J)J.words[R]=_}if(J)J.strip();if(Q.strip(),V!=="div"&&I!==0)Q.iushrn(I);return{div:J||null,mod:Q}},$.prototype.divmod=function(Y,V,I){if(K(!Y.isZero()),this.isZero())return{div:new $(0),mod:new $(0)};var Q,W,C;if(this.negative!==0&&Y.negative===0){if(C=this.neg().divmod(Y,V),V!=="mod")Q=C.div.neg();if(V!=="div"){if(W=C.mod.neg(),I&&W.negative!==0)W.iadd(Y)}return{div:Q,mod:W}}if(this.negative===0&&Y.negative!==0){if(C=this.divmod(Y.neg(),V),V!=="mod")Q=C.div.neg();return{div:Q,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,Q=Y.ushrn(1),W=Y.andln(1),C=I.cmp(Q);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 Q=this.length-1;Q>=0;Q--)I=(V*I+(this.words[Q]|0))%Y;return I},$.prototype.idivn=function(Y){K(Y<=67108863);var V=0;for(var I=this.length-1;I>=0;I--){var Q=(this.words[I]|0)+V*67108864;this.words[I]=Q/Y|0,V=Q%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 Q=new $(1),W=new $(0),C=new $(0),z=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(Q.isOdd()||W.isOdd())Q.iadd(J),W.isub(O);Q.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()||z.isOdd())C.iadd(J),z.isub(O);C.iushrn(1),z.iushrn(1)}}if(V.cmp(I)>=0)V.isub(I),Q.isub(C),W.isub(z);else I.isub(V),C.isub(Q),z.isub(W)}return{a:C,b:z,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 Q=new $(1),W=new $(0),C=I.clone();while(V.cmpn(1)>0&&I.cmpn(1)>0){for(var z=0,H=1;(V.words[0]&H)===0&&z<26;++z,H<<=1);if(z>0){V.iushrn(z);while(z-- >0){if(Q.isOdd())Q.iadd(C);Q.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),Q.isub(W);else I.isub(V),W.isub(Q)}var P;if(V.cmpn(1)===0)P=Q;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 Q=0;V.isEven()&&I.isEven();Q++)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(Q)},$.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,Q=1<<V;if(this.length<=I)return this._expand(I+1),this.words[I]|=Q,this;var W=Q;for(var C=I;W!==0&&C<this.length;C++){var z=this.words[C]|0;z+=W,W=z>>>26,z&=67108863,this.words[C]=z}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 Q=this.words[0]|0;I=Q===Y?0:Q<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 Q=this.words[I]|0,W=Y.words[I]|0;if(Q===W)continue;if(Q<W)V=-1;else if(Q>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 Q=I<this.n?-1:V.ucmp(this.p);if(Q===0)V.words[0]=0,V.length=1;else if(Q>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,Q=Math.min(Y.length,9);for(var W=0;W<Q;W++)V.words[W]=Y.words[W];if(V.length=Q,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 z=Y.words[W]|0;Y.words[W-10]=(z&I)<<4|C>>>22,C=z}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 Q=Y.words[I]|0;V+=Q*977,Y.words[I]=V&67108863,V=Q*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 Q=(Y.words[I]|0)*19+V,W=Q&67108863;Q>>>=26,Y.words[I]=W,V=Q}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 Q=this.m.subn(1),W=0;while(!Q.isZero()&&Q.andln(1)===0)W++,Q.iushrn(1);K(!Q.isZero());var C=new $(1).toRed(this),z=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(z)!==0)J.redIAdd(z);var O=this.pow(J,Q),P=this.pow(Y,Q.addn(1).iushrn(1)),R=this.pow(Y,Q),_=W;while(R.cmp(C)!==0){var f=R;for(var p=0;f.cmp(C)!==0;p++)f=f.redSqr();K(p<_);var o=this.pow(O,new $(1).iushln(_-p-1));P=P.redMul(o),O=o.redSqr(),R=R.redMul(O),_=p}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,Q=Array(1<<I);Q[0]=new $(1).toRed(this),Q[1]=Y;for(var W=2;W<Q.length;W++)Q[W]=this.mul(Q[W-1],Y);var C=Q[0],z=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!==Q[0])C=this.sqr(C);if(R===0&&z===0){H=0;continue}if(z<<=1,z|=R,H++,H!==I&&(W!==0||P!==0))continue;C=this.mul(C,Q[z]),H=0,z=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),Q=I.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),W=I.isub(Q).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),Q=I.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),W=I.isub(Q).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)}),pU=$0((U,Z)=>{Z.exports=X;function X(G,K){if(!G)throw Error(K||"Assertion failed")}X.equal=function(G,K,F){if(G!=K)throw Error(F||"Assertion failed: "+G+" != "+K)}}),YV=$0((U)=>{var Z=U;function X(F,$){if(Array.isArray(F))return F.slice();if(!F)return[];var L=[];if(typeof F!=="string"){for(var M=0;M<F.length;M++)L[M]=F[M]|0;return L}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)L.push(parseInt(F[M]+F[M+1],16))}else for(var M=0;M<F.length;M++){var D=F.charCodeAt(M),T=D>>8,A=D&255;if(T)L.push(T,A);else L.push(A)}return L}Z.toArray=X;function G(F){if(F.length===1)return"0"+F;else return F}Z.zero2=G;function K(F){var $="";for(var L=0;L<F.length;L++)$+=G(F[L].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(),G=pU(),K=YV();Z.assert=G,Z.toArray=K.toArray,Z.zero2=K.zero2,Z.toHex=K.toHex,Z.encode=K.encode;function F(T,A,q){var S=Array(Math.max(T.bitLength(),q)+1),E;for(E=0;E<S.length;E+=1)S[E]=0;var j=1<<A+1,k=T.clone();for(E=0;E<S.length;E++){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;S[E]=B,k.iushrn(1)}return S}Z.getNAF=F;function $(T,A){var q=[[],[]];T=T.clone(),A=A.clone();var S=0,E=0,j;while(T.cmpn(-S)>0||A.cmpn(-E)>0){var k=T.andln(3)+S&3,B=A.andln(3)+E&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)+S&7,(j===3||j===5)&&B===2)v=-k;else v=k;q[0].push(v);var x;if((B&1)===0)x=0;else if(j=A.andln(7)+E&7,(j===3||j===5)&&k===2)x=-B;else x=B;if(q[1].push(x),2*S===v+1)S=1-S;if(2*E===x+1)E=1-E;T.iushrn(1),A.iushrn(1)}return q}Z.getJSF=$;function L(T,A,q){var S="_"+A;T.prototype[A]=function(){return this[S]!==void 0?this[S]:this[S]=q.call(this)}}Z.cachedProperty=L;function M(T){return typeof T==="string"?Z.toArray(T,"hex"):T}Z.parseBytes=M;function D(T){return new X(T,"hex","le")}Z.intFromLE=D}),JV=$0((U,Z)=>{var X;Z.exports=function(F){if(!X)X=new G(null);return X.generate(F)};function G(F){this.rand=F}if(Z.exports.Rand=G,G.prototype.generate=function(F){return this._rand(F)},G.prototype._rand=function(F){if(this.rand.getBytes)return this.rand.getBytes(F);var $=new Uint8Array(F);for(var L=0;L<$.length;L++)$[L]=this.rand.getByte();return $},typeof self==="object"){if(self.crypto&&self.crypto.getRandomValues)G.prototype._rand=function(F){var $=new Uint8Array(F);return self.crypto.getRandomValues($),$};else if(self.msCrypto&&self.msCrypto.getRandomValues)G.prototype._rand=function(F){var $=new Uint8Array(F);return self.msCrypto.getRandomValues($),$};else if(typeof window==="object")G.prototype._rand=function(){throw Error("Not implemented yet")}}else try{if(K=(UU(),m0(e1)),typeof K.randomBytes!=="function")throw Error("Not supported");G.prototype._rand=function(F){return K.randomBytes(F)}}catch(F){}var K}),NX=$0((U,Z)=>{var X=jU(),G=WU(),K=G.getNAF,F=G.getJSF,$=G.assert;function L(D,T){this.type=D,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=L,L.prototype.point=function(){throw Error("Not implemented")},L.prototype.validate=function(){throw Error("Not implemented")},L.prototype._fixedNafMul=function(D,T){$(D.precomputed);var A=D._getDoubles(),q=K(T,1,this._bitLength),S=(1<<A.step+1)-(A.step%2===0?2:1);S/=3;var E=[],j,k;for(j=0;j<q.length;j+=A.step){k=0;for(var B=j+A.step-1;B>=j;B--)k=(k<<1)+q[B];E.push(k)}var v=this.jpoint(null,null,null),x=this.jpoint(null,null,null);for(var N=S;N>0;N--){for(j=0;j<E.length;j++)if(k=E[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()},L.prototype._wnafMul=function(D,T){var A=4,q=D._getNAFPoints(A);A=q.wnd;var S=q.points,E=K(T,A,this._bitLength),j=this.jpoint(null,null,null);for(var k=E.length-1;k>=0;k--){for(var B=0;k>=0&&E[k]===0;k--)B++;if(k>=0)B++;if(j=j.dblp(B),k<0)break;var v=E[k];if($(v!==0),D.type==="affine")if(v>0)j=j.mixedAdd(S[v-1>>1]);else j=j.mixedAdd(S[-v-1>>1].neg());else if(v>0)j=j.add(S[v-1>>1]);else j=j.add(S[-v-1>>1].neg())}return D.type==="affine"?j.toP():j},L.prototype._wnafMulAdd=function(D,T,A,q,S){var E=this._wnafT1,j=this._wnafT2,k=this._wnafT3,B=0,v,x,N;for(v=0;v<q;v++){N=T[v];var w=N._getNAFPoints(D);E[v]=w.wnd,j[v]=w.points}for(v=q-1;v>=1;v-=2){var u=v-1,Z0=v;if(E[u]!==1||E[Z0]!==1){k[u]=K(A[u],E[u],this._bitLength),k[Z0]=K(A[Z0],E[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 Q=0;while(v>=0){var W=!0;for(x=0;x<q;x++)if(I[x]=k[x][v]|0,I[x]!==0)W=!1;if(!W)break;Q++,v--}if(v>=0)Q++;if(V=V.dblp(Q),v<0)break;for(x=0;x<q;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<q;v++)j[v]=null;if(S)return V;else return V.toP()};function M(D,T){this.curve=D,this.type=T,this.precomputed=null}L.BasePoint=M,M.prototype.eq=function(){throw Error("Not implemented")},M.prototype.validate=function(){return this.curve.validate(this)},L.prototype.decodePoint=function(D,T){D=G.toArray(D,T);var A=this.p.byteLength();if((D[0]===4||D[0]===6||D[0]===7)&&D.length-1===2*A){if(D[0]===6)$(D[D.length-1]%2===0);else if(D[0]===7)$(D[D.length-1]%2===1);var q=this.point(D.slice(1,1+A),D.slice(1+A,1+2*A));return q}else if((D[0]===2||D[0]===3)&&D.length-1===A)return this.pointFromX(D.slice(1,1+A),D[0]===3);throw Error("Unknown point format")},M.prototype.encodeCompressed=function(D){return this.encode(D,!0)},M.prototype._encode=function(D){var T=this.curve.p.byteLength(),A=this.getX().toArray("be",T);if(D)return[this.getY().isEven()?2:3].concat(A);return[4].concat(A,this.getY().toArray("be",T))},M.prototype.encode=function(D,T){return G.encode(this._encode(T),D)},M.prototype.precompute=function(D){if(this.precomputed)return this;var T={doubles:null,naf:null,beta:null};return T.naf=this._getNAFPoints(8),T.doubles=this._getDoubles(4,D),T.beta=this._getBeta(),this.precomputed=T,this},M.prototype._hasDoubles=function(D){if(!this.precomputed)return!1;var T=this.precomputed.doubles;if(!T)return!1;return T.points.length>=Math.ceil((D.bitLength()+1)/T.step)},M.prototype._getDoubles=function(D,T){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;var A=[this],q=this;for(var S=0;S<T;S+=D){for(var E=0;E<D;E++)q=q.dbl();A.push(q)}return{step:D,points:A}},M.prototype._getNAFPoints=function(D){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;var T=[this],A=(1<<D)-1,q=A===1?null:this.dbl();for(var S=1;S<A;S++)T[S]=T[S-1].add(q);return{wnd:D,points:T}},M.prototype._getBeta=function(){return null},M.prototype.dblp=function(D){var T=this;for(var A=0;A<D;A++)T=T.dbl();return T}}),zF=$0((U,Z)=>{if(typeof Object.create==="function")Z.exports=function(X,G){if(G)X.super_=G,X.prototype=Object.create(G.prototype,{constructor:{value:X,enumerable:!1,writable:!0,configurable:!0}})};else Z.exports=function(X,G){if(G){X.super_=G;var K=function(){};K.prototype=G.prototype,X.prototype=new K,X.prototype.constructor=X}}}),YU=$0((U,Z)=>{try{if(X=(LQ(),m0(zQ)),typeof X.inherits!=="function")throw"";Z.exports=X.inherits}catch(G){Z.exports=zF()}var X}),LF=$0((U,Z)=>{var X=WU(),G=jU(),K=YU(),F=NX(),$=X.assert;function L(T){F.call(this,"short",T),this.a=new G(T.a,16).toRed(this.red),this.b=new G(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(L,F),Z.exports=L,L.prototype._getEndomorphism=function(T){if(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)return;var A,q;if(T.beta)A=new G(T.beta,16).toRed(this.red);else{var S=this._getEndoRoots(this.p);A=S[0].cmp(S[1])<0?S[0]:S[1],A=A.toRed(this.red)}if(T.lambda)q=new G(T.lambda,16);else{var E=this._getEndoRoots(this.n);if(this.g.mul(E[0]).x.cmp(this.g.x.redMul(A))===0)q=E[0];else q=E[1],$(this.g.mul(q).x.cmp(this.g.x.redMul(A))===0)}var j;if(T.basis)j=T.basis.map(function(k){return{a:new G(k.a,16),b:new G(k.b,16)}});else j=this._getEndoBasis(q);return{beta:A,lambda:q,basis:j}},L.prototype._getEndoRoots=function(T){var A=T===this.p?this.red:G.mont(T),q=new G(2).toRed(A).redInvm(),S=q.redNeg(),E=new G(3).toRed(A).redNeg().redSqrt().redMul(q),j=S.redAdd(E).fromRed(),k=S.redSub(E).fromRed();return[j,k]},L.prototype._getEndoBasis=function(T){var A=this.n.ushrn(Math.floor(this.n.bitLength()/2)),q=T,S=this.n.clone(),E=new G(1),j=new G(0),k=new G(0),B=new G(1),v,x,N,w,u,Z0,V0,Y0=0,b,i;while(q.cmpn(0)!==0){var Y=S.div(q);b=S.sub(Y.mul(q)),i=k.sub(Y.mul(E));var V=B.sub(Y.mul(j));if(!N&&b.cmp(A)<0)v=V0.neg(),x=E,N=b.neg(),w=i;else if(N&&++Y0===2)break;V0=b,S=q,q=b,k=E,E=i,B=j,j=V}u=b.neg(),Z0=i;var I=N.sqr().add(w.sqr()),Q=u.sqr().add(Z0.sqr());if(Q.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}]},L.prototype._endoSplit=function(T){var A=this.endo.basis,q=A[0],S=A[1],E=S.b.mul(T).divRound(this.n),j=q.b.neg().mul(T).divRound(this.n),k=E.mul(q.a),B=j.mul(S.a),v=E.mul(q.b),x=j.mul(S.b),N=T.sub(k).sub(B),w=v.add(x).neg();return{k1:N,k2:w}},L.prototype.pointFromX=function(T,A){if(T=new G(T,16),!T.red)T=T.toRed(this.red);var q=T.redSqr().redMul(T).redIAdd(T.redMul(this.a)).redIAdd(this.b),S=q.redSqrt();if(S.redSqr().redSub(q).cmp(this.zero)!==0)throw Error("invalid point");var E=S.fromRed().isOdd();if(A&&!E||!A&&E)S=S.redNeg();return this.point(T,S)},L.prototype.validate=function(T){if(T.inf)return!0;var{x:A,y:q}=T,S=this.a.redMul(A),E=A.redSqr().redMul(A).redIAdd(S).redIAdd(this.b);return q.redSqr().redISub(E).cmpn(0)===0},L.prototype._endoWnafMulAdd=function(T,A,q){var S=this._endoWnafT1,E=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);S[j*2]=B,S[j*2+1]=v,E[j*2]=k.k1,E[j*2+1]=k.k2}var x=this._wnafMulAdd(1,S,E,j*2,q);for(var N=0;N<j*2;N++)S[N]=null,E[N]=null;return x};function M(T,A,q,S){if(F.BasePoint.call(this,T,"affine"),A===null&&q===null)this.x=null,this.y=null,this.inf=!0;else{if(this.x=new G(A,16),this.y=new G(q,16),S)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),L.prototype.point=function(T,A,q){return new M(this,T,A,q)},L.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 q=this.curve,S=function(E){return q.point(E.x.redMul(q.endo.beta),E.y)};T.beta=A,A.precomputed={beta:null,naf:T.naf&&{wnd:T.naf.wnd,points:T.naf.points.map(S)},doubles:T.doubles&&{step:T.doubles.step,points:T.doubles.points.map(S)}}}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,q){if(typeof A==="string")A=JSON.parse(A);var S=T.point(A[0],A[1],q);if(!A[2])return S;function E(k){return T.point(k[0],k[1],q)}var j=A[2];return S.precomputed={beta:null,doubles:j.doubles&&{step:j.doubles.step,points:[S].concat(j.doubles.points.map(E))},naf:j.naf&&{wnd:j.naf.wnd,points:[S].concat(j.naf.points.map(E))}},S},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 q=A.redSqr().redISub(this.x).redISub(T.x),S=A.redMul(this.x.redSub(q)).redISub(this.y);return this.curve.point(q,S)},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,q=this.x.redSqr(),S=T.redInvm(),E=q.redAdd(q).redIAdd(q).redIAdd(A).redMul(S),j=E.redSqr().redISub(this.x.redAdd(this.x)),k=E.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 G(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,q){var S=[this,A],E=[T,q];if(this.curve.endo)return this.curve._endoWnafMulAdd(S,E);else return this.curve._wnafMulAdd(1,S,E,2)},M.prototype.jmulAdd=function(T,A,q){var S=[this,A],E=[T,q];if(this.curve.endo)return this.curve._endoWnafMulAdd(S,E,!0);else return this.curve._wnafMulAdd(1,S,E,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 q=this.precomputed,S=function(E){return E.neg()};A.precomputed={naf:q.naf&&{wnd:q.naf.wnd,points:q.naf.points.map(S)},doubles:q.doubles&&{step:q.doubles.step,points:q.doubles.points.map(S)}}}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 D(T,A,q,S){if(F.BasePoint.call(this,T,"jacobian"),A===null&&q===null&&S===null)this.x=this.curve.one,this.y=this.curve.one,this.z=new G(0);else this.x=new G(A,16),this.y=new G(q,16),this.z=new G(S,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(D,F.BasePoint),L.prototype.jpoint=function(T,A,q){return new D(this,T,A,q)},D.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var T=this.z.redInvm(),A=T.redSqr(),q=this.x.redMul(A),S=this.y.redMul(A).redMul(T);return this.curve.point(q,S)},D.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},D.prototype.add=function(T){if(this.isInfinity())return T;if(T.isInfinity())return this;var A=T.z.redSqr(),q=this.z.redSqr(),S=this.x.redMul(A),E=T.x.redMul(q),j=this.y.redMul(A.redMul(T.z)),k=T.y.redMul(q.redMul(this.z)),B=S.redSub(E),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=S.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)},D.prototype.mixedAdd=function(T){if(this.isInfinity())return T.toJ();if(T.isInfinity())return this;var A=this.z.redSqr(),q=this.x,S=T.x.redMul(A),E=this.y,j=T.y.redMul(A).redMul(this.z),k=q.redSub(S),B=E.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=q.redMul(v),w=B.redSqr().redIAdd(x).redISub(N).redISub(N),u=B.redMul(N.redISub(w)).redISub(E.redMul(x)),Z0=this.z.redMul(k);return this.curve.jpoint(w,u,Z0)},D.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 q=this;for(A=0;A<T;A++)q=q.dbl();return q}var S=this.curve.a,E=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(S.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(E),B)},D.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()},D.prototype._zeroDbl=function(){var T,A,q;if(this.zOne){var S=this.x.redSqr(),E=this.y.redSqr(),j=E.redSqr(),k=this.x.redAdd(E).redSqr().redISub(S).redISub(j);k=k.redIAdd(k);var B=S.redAdd(S).redIAdd(S),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),q=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),q=this.y.redMul(this.z),q=q.redIAdd(q)}return this.curve.jpoint(T,A,q)},D.prototype._threeDbl=function(){var T,A,q;if(this.zOne){var S=this.x.redSqr(),E=this.y.redSqr(),j=E.redSqr(),k=this.x.redAdd(E).redSqr().redISub(S).redISub(j);k=k.redIAdd(k);var B=S.redAdd(S).redIAdd(S).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),q=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),q=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,q)},D.prototype._dbl=function(){var T=this.curve.a,A=this.x,q=this.y,S=this.z,E=S.redSqr().redSqr(),j=A.redSqr(),k=q.redSqr(),B=j.redAdd(j).redIAdd(j).redIAdd(T.redMul(E)),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=q.redAdd(q).redMul(S);return this.curve.jpoint(N,Z0,V0)},D.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var T=this.x.redSqr(),A=this.y.redSqr(),q=this.z.redSqr(),S=A.redSqr(),E=T.redAdd(T).redIAdd(T),j=E.redSqr(),k=this.x.redAdd(A).redSqr().redISub(T).redISub(S);k=k.redIAdd(k),k=k.redAdd(k).redIAdd(k),k=k.redISub(j);var B=k.redSqr(),v=S.redIAdd(S);v=v.redIAdd(v),v=v.redIAdd(v),v=v.redIAdd(v);var x=E.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(q).redISub(B);return this.curve.jpoint(w,u,Z0)},D.prototype.mul=function(T,A){return T=new G(T,A),this.curve._wnafMul(this,T)},D.prototype.eq=function(T){if(T.type==="affine")return this.eq(T.toJ());if(this===T)return!0;var A=this.z.redSqr(),q=T.z.redSqr();if(this.x.redMul(q).redISub(T.x.redMul(A)).cmpn(0)!==0)return!1;var S=A.redMul(this.z),E=q.redMul(T.z);return this.y.redMul(E).redISub(T.y.redMul(S)).cmpn(0)===0},D.prototype.eqXToP=function(T){var A=this.z.redSqr(),q=T.toRed(this.curve.red).redMul(A);if(this.x.cmp(q)===0)return!0;var S=T.clone(),E=this.curve.redN.redMul(A);for(;;){if(S.iadd(this.curve.n),S.cmp(this.curve.p)>=0)return!1;if(q.redIAdd(E),this.x.cmp(q)===0)return!0}},D.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)+">"},D.prototype.isInfinity=function(){return this.z.cmpn(0)===0}}),MF=$0((U,Z)=>{var X=jU(),G=YU(),K=NX(),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))}G($,K),Z.exports=$,$.prototype.validate=function(M){var D=M.normalize().x,T=D.redSqr(),A=T.redMul(D).redAdd(T.redMul(this.a)).redAdd(D),q=A.redSqrt();return q.redSqr().cmp(A)===0};function L(M,D,T){if(K.BasePoint.call(this,M,"projective"),D===null&&T===null)this.x=this.curve.one,this.z=this.curve.zero;else{if(this.x=new X(D,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)}}G(L,K.BasePoint),$.prototype.decodePoint=function(M,D){return this.point(F.toArray(M,D),1)},$.prototype.point=function(M,D){return new L(this,M,D)},$.prototype.pointFromJSON=function(M){return L.fromJSON(this,M)},L.prototype.precompute=function(){},L.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},L.fromJSON=function(M,D){return new L(M,D[0],D[1]||M.one)},L.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)+">"},L.prototype.isInfinity=function(){return this.z.cmpn(0)===0},L.prototype.dbl=function(){var M=this.x.redAdd(this.z),D=M.redSqr(),T=this.x.redSub(this.z),A=T.redSqr(),q=D.redSub(A),S=D.redMul(A),E=q.redMul(A.redAdd(this.curve.a24.redMul(q)));return this.curve.point(S,E)},L.prototype.add=function(){throw Error("Not supported on Montgomery curve")},L.prototype.diffAdd=function(M,D){var T=this.x.redAdd(this.z),A=this.x.redSub(this.z),q=M.x.redAdd(M.z),S=M.x.redSub(M.z),E=S.redMul(T),j=q.redMul(A),k=D.z.redMul(E.redAdd(j).redSqr()),B=D.x.redMul(E.redISub(j).redSqr());return this.curve.point(k,B)},L.prototype.mul=function(M){var D=M.clone(),T=this,A=this.curve.point(null,null),q=this;for(var S=[];D.cmpn(0)!==0;D.iushrn(1))S.push(D.andln(1));for(var E=S.length-1;E>=0;E--)if(S[E]===0)T=T.diffAdd(A,q),A=A.dbl();else A=T.diffAdd(A,q),T=T.dbl();return A},L.prototype.mulAdd=function(){throw Error("Not supported on Montgomery curve")},L.prototype.jumlAdd=function(){throw Error("Not supported on Montgomery curve")},L.prototype.eq=function(M){return this.getX().cmp(M.getX())===0},L.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},L.prototype.getX=function(){return this.normalize(),this.x.fromRed()}}),qF=$0((U,Z)=>{var X=WU(),G=jU(),K=YU(),F=NX(),$=X.assert;function L(D){this.twisted=(D.a|0)!==1,this.mOneA=this.twisted&&(D.a|0)===-1,this.extended=this.mOneA,F.call(this,"edwards",D),this.a=new G(D.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new G(D.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new G(D.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),$(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(D.c|0)===1}K(L,F),Z.exports=L,L.prototype._mulA=function(D){if(this.mOneA)return D.redNeg();else return this.a.redMul(D)},L.prototype._mulC=function(D){if(this.oneC)return D;else return this.c.redMul(D)},L.prototype.jpoint=function(D,T,A,q){return this.point(D,T,A,q)},L.prototype.pointFromX=function(D,T){if(D=new G(D,16),!D.red)D=D.toRed(this.red);var A=D.redSqr(),q=this.c2.redSub(this.a.redMul(A)),S=this.one.redSub(this.c2.redMul(this.d).redMul(A)),E=q.redMul(S.redInvm()),j=E.redSqrt();if(j.redSqr().redSub(E).cmp(this.zero)!==0)throw Error("invalid point");var k=j.fromRed().isOdd();if(T&&!k||!T&&k)j=j.redNeg();return this.point(D,j)},L.prototype.pointFromY=function(D,T){if(D=new G(D,16),!D.red)D=D.toRed(this.red);var A=D.redSqr(),q=A.redSub(this.c2),S=A.redMul(this.d).redMul(this.c2).redSub(this.a),E=q.redMul(S.redInvm());if(E.cmp(this.zero)===0)if(T)throw Error("invalid point");else return this.point(this.zero,D);var j=E.redSqrt();if(j.redSqr().redSub(E).cmp(this.zero)!==0)throw Error("invalid point");if(j.fromRed().isOdd()!==T)j=j.redNeg();return this.point(j,D)},L.prototype.validate=function(D){if(D.isInfinity())return!0;D.normalize();var T=D.x.redSqr(),A=D.y.redSqr(),q=T.redMul(this.a).redAdd(A),S=this.c2.redMul(this.one.redAdd(this.d.redMul(T).redMul(A)));return q.cmp(S)===0};function M(D,T,A,q,S){if(F.BasePoint.call(this,D,"projective"),T===null&&A===null&&q===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 G(T,16),this.y=new G(A,16),this.z=q?new G(q,16):this.curve.one,this.t=S&&new G(S,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),L.prototype.pointFromJSON=function(D){return M.fromJSON(this,D)},L.prototype.point=function(D,T,A,q){return new M(this,D,T,A,q)},M.fromJSON=function(D,T){return new M(D,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 D=this.x.redSqr(),T=this.y.redSqr(),A=this.z.redSqr();A=A.redIAdd(A);var q=this.curve._mulA(D),S=this.x.redAdd(this.y).redSqr().redISub(D).redISub(T),E=q.redAdd(T),j=E.redSub(A),k=q.redSub(T),B=S.redMul(j),v=E.redMul(k),x=S.redMul(k),N=j.redMul(E);return this.curve.point(B,v,N,x)},M.prototype._projDbl=function(){var D=this.x.redAdd(this.y).redSqr(),T=this.x.redSqr(),A=this.y.redSqr(),q,S,E,j,k,B;if(this.curve.twisted){j=this.curve._mulA(T);var v=j.redAdd(A);if(this.zOne)q=D.redSub(T).redSub(A).redMul(v.redSub(this.curve.two)),S=v.redMul(j.redSub(A)),E=v.redSqr().redSub(v).redSub(v);else k=this.z.redSqr(),B=v.redSub(k).redISub(k),q=D.redSub(T).redISub(A).redMul(B),S=v.redMul(j.redSub(A)),E=v.redMul(B)}else j=T.redAdd(A),k=this.curve._mulC(this.z).redSqr(),B=j.redSub(k).redSub(k),q=this.curve._mulC(D.redISub(j)).redMul(B),S=this.curve._mulC(j).redMul(T.redISub(A)),E=j.redMul(B);return this.curve.point(q,S,E)},M.prototype.dbl=function(){if(this.isInfinity())return this;if(this.curve.extended)return this._extDbl();else return this._projDbl()},M.prototype._extAdd=function(D){var T=this.y.redSub(this.x).redMul(D.y.redSub(D.x)),A=this.y.redAdd(this.x).redMul(D.y.redAdd(D.x)),q=this.t.redMul(this.curve.dd).redMul(D.t),S=this.z.redMul(D.z.redAdd(D.z)),E=A.redSub(T),j=S.redSub(q),k=S.redAdd(q),B=A.redAdd(T),v=E.redMul(j),x=k.redMul(B),N=E.redMul(B),w=j.redMul(k);return this.curve.point(v,x,w,N)},M.prototype._projAdd=function(D){var T=this.z.redMul(D.z),A=T.redSqr(),q=this.x.redMul(D.x),S=this.y.redMul(D.y),E=this.curve.d.redMul(q).redMul(S),j=A.redSub(E),k=A.redAdd(E),B=this.x.redAdd(this.y).redMul(D.x.redAdd(D.y)).redISub(q).redISub(S),v=T.redMul(j).redMul(B),x,N;if(this.curve.twisted)x=T.redMul(k).redMul(S.redSub(this.curve._mulA(q))),N=j.redMul(k);else x=T.redMul(k).redMul(S.redSub(q)),N=this.curve._mulC(j).redMul(k);return this.curve.point(v,x,N)},M.prototype.add=function(D){if(this.isInfinity())return D;if(D.isInfinity())return this;if(this.curve.extended)return this._extAdd(D);else return this._projAdd(D)},M.prototype.mul=function(D){if(this._hasDoubles(D))return this.curve._fixedNafMul(this,D);else return this.curve._wnafMul(this,D)},M.prototype.mulAdd=function(D,T,A){return this.curve._wnafMulAdd(1,[this,T],[D,A],2,!1)},M.prototype.jmulAdd=function(D,T,A){return this.curve._wnafMulAdd(1,[this,T],[D,A],2,!0)},M.prototype.normalize=function(){if(this.zOne)return this;var D=this.z.redInvm();if(this.x=this.x.redMul(D),this.y=this.y.redMul(D),this.t)this.t=this.t.redMul(D);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(D){return this===D||this.getX().cmp(D.getX())===0&&this.getY().cmp(D.getY())===0},M.prototype.eqXToP=function(D){var T=D.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(T)===0)return!0;var A=D.clone(),q=this.curve.redN.redMul(this.z);for(;;){if(A.iadd(this.curve.n),A.cmp(this.curve.p)>=0)return!1;if(T.redIAdd(q),this.x.cmp(T)===0)return!0}},M.prototype.toP=M.prototype.normalize,M.prototype.mixedAdd=M.prototype.add}),GV=$0((U)=>{var Z=U;Z.base=NX(),Z.short=LF(),Z.mont=MF(),Z.edwards=qF()}),zU=$0((U)=>{var Z=pU(),X=YU();U.inherits=X;function G(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 Q=[];if(typeof V==="string"){if(!I){var W=0;for(var C=0;C<V.length;C++){var z=V.charCodeAt(C);if(z<128)Q[W++]=z;else if(z<2048)Q[W++]=z>>6|192,Q[W++]=z&63|128;else if(G(V,C))z=65536+((z&1023)<<10)+(V.charCodeAt(++C)&1023),Q[W++]=z>>18|240,Q[W++]=z>>12&63|128,Q[W++]=z>>6&63|128,Q[W++]=z&63|128;else Q[W++]=z>>12|224,Q[W++]=z>>6&63|128,Q[W++]=z&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)Q.push(parseInt(V[C]+V[C+1],16))}}else for(C=0;C<V.length;C++)Q[C]=V[C]|0;return Q}U.toArray=K;function F(V){var I="";for(var Q=0;Q<V.length;Q++)I+=M(V[Q].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 L(V,I){var Q="";for(var W=0;W<V.length;W++){var C=V[W];if(I==="little")C=$(C);Q+=D(C.toString(16))}return Q}U.toHex32=L;function M(V){if(V.length===1)return"0"+V;else return V}U.zero2=M;function D(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=D;function T(V,I,Q,W){var C=Q-I;Z(C%4===0);var z=Array(C/4);for(var H=0,J=I;H<z.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];z[H]=O>>>0}return z}U.join32=T;function A(V,I){var Q=Array(V.length*4);for(var W=0,C=0;W<V.length;W++,C+=4){var z=V[W];if(I==="big")Q[C]=z>>>24,Q[C+1]=z>>>16&255,Q[C+2]=z>>>8&255,Q[C+3]=z&255;else Q[C+3]=z>>>24,Q[C+2]=z>>>16&255,Q[C+1]=z>>>8&255,Q[C]=z&255}return Q}U.split32=A;function q(V,I){return V>>>I|V<<32-I}U.rotr32=q;function S(V,I){return V<<I|V>>>32-I}U.rotl32=S;function E(V,I){return V+I>>>0}U.sum32=E;function j(V,I,Q){return V+I+Q>>>0}U.sum32_3=j;function k(V,I,Q,W){return V+I+Q+W>>>0}U.sum32_4=k;function B(V,I,Q,W,C){return V+I+Q+W+C>>>0}U.sum32_5=B;function v(V,I,Q,W){var C=V[I],z=V[I+1],H=W+z>>>0,J=(H<W?1:0)+Q+C;V[I]=J>>>0,V[I+1]=H}U.sum64=v;function x(V,I,Q,W){var C=I+W>>>0,z=(C<I?1:0)+V+Q;return z>>>0}U.sum64_hi=x;function N(V,I,Q,W){var C=I+W;return C>>>0}U.sum64_lo=N;function w(V,I,Q,W,C,z,H,J){var O=0,P=I;P=P+W>>>0,O+=P<I?1:0,P=P+z>>>0,O+=P<z?1:0,P=P+J>>>0,O+=P<J?1:0;var R=V+Q+C+H+O;return R>>>0}U.sum64_4_hi=w;function u(V,I,Q,W,C,z,H,J){var O=I+W+z+J;return O>>>0}U.sum64_4_lo=u;function Z0(V,I,Q,W,C,z,H,J,O,P){var R=0,_=I;_=_+W>>>0,R+=_<I?1:0,_=_+z>>>0,R+=_<z?1:0,_=_+J>>>0,R+=_<J?1:0,_=_+P>>>0,R+=_<P?1:0;var f=V+Q+C+H+O+R;return f>>>0}U.sum64_5_hi=Z0;function V0(V,I,Q,W,C,z,H,J,O,P){var R=I+W+z+J+P;return R>>>0}U.sum64_5_lo=V0;function Y0(V,I,Q){var W=I<<32-Q|V>>>Q;return W>>>0}U.rotr64_hi=Y0;function b(V,I,Q){var W=V<<32-Q|I>>>Q;return W>>>0}U.rotr64_lo=b;function i(V,I,Q){return V>>>Q}U.shr64_hi=i;function Y(V,I,Q){var W=V<<32-Q|I>>>Q;return W>>>0}U.shr64_lo=Y}),hZ=$0((U)=>{var Z=zU(),X=pU();function G(){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=G,G.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 L=0;L<K.length;L+=this._delta32)this._update(K,L,L+this._delta32)}return this},G.prototype.digest=function(K){return this.update(this._pad()),X(this.pending===null),this._digest(K)},G.prototype._pad=function(){var K=this.pendingTotal,F=this._delta8,$=F-(K+this.padLength)%F,L=Array($+this.padLength);L[0]=128;for(var M=1;M<$;M++)L[M]=0;if(K<<=3,this.endian==="big"){for(var D=8;D<this.padLength;D++)L[M++]=0;L[M++]=0,L[M++]=0,L[M++]=0,L[M++]=0,L[M++]=K>>>24&255,L[M++]=K>>>16&255,L[M++]=K>>>8&255,L[M++]=K&255}else{L[M++]=K&255,L[M++]=K>>>8&255,L[M++]=K>>>16&255,L[M++]=K>>>24&255,L[M++]=0,L[M++]=0,L[M++]=0,L[M++]=0;for(D=8;D<this.padLength;D++)L[M++]=0}return L}}),QV=$0((U)=>{var Z=zU(),X=Z.rotr32;function G(A,q,S,E){if(A===0)return K(q,S,E);if(A===1||A===3)return $(q,S,E);if(A===2)return F(q,S,E)}U.ft_1=G;function K(A,q,S){return A&q^~A&S}U.ch32=K;function F(A,q,S){return A&q^A&S^q&S}U.maj32=F;function $(A,q,S){return A^q^S}U.p32=$;function L(A){return X(A,2)^X(A,13)^X(A,22)}U.s0_256=L;function M(A){return X(A,6)^X(A,11)^X(A,25)}U.s1_256=M;function D(A){return X(A,7)^X(A,18)^A>>>3}U.g0_256=D;function T(A){return X(A,17)^X(A,19)^A>>>10}U.g1_256=T}),TF=$0((U,Z)=>{var X=zU(),G=hZ(),K=QV(),F=X.rotl32,$=X.sum32,L=X.sum32_5,M=K.ft_1,D=G.BlockHash,T=[1518500249,1859775393,2400959708,3395469782];function A(){if(!(this instanceof A))return new A;D.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=Array(80)}X.inherits(A,D),Z.exports=A,A.blockSize=512,A.outSize=160,A.hmacStrength=80,A.padLength=64,A.prototype._update=function(q,S){var E=this.W;for(var j=0;j<16;j++)E[j]=q[S+j];for(;j<E.length;j++)E[j]=F(E[j-3]^E[j-8]^E[j-14]^E[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<E.length;j++){var w=~~(j/20),u=L(F(k,5),M(w,B,v,x),N,E[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(q){if(q==="hex")return X.toHex32(this.h,"big");else return X.split32(this.h,"big")}}),VV=$0((U,Z)=>{var X=zU(),G=hZ(),K=QV(),F=pU(),$=X.sum32,L=X.sum32_4,M=X.sum32_5,D=K.ch32,T=K.maj32,A=K.s0_256,q=K.s1_256,S=K.g0_256,E=K.g1_256,j=G.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]=L(E(N[w-2]),N[w-7],S(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,q(b),D(b,i,Y),this.k[w],N[w]),Q=$(A(u),T(u,Z0,V0));V=Y,Y=i,i=b,b=$(Y0,I),Y0=V0,V0=Z0,Z0=u,u=$(I,Q)}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")}}),RF=$0((U,Z)=>{var X=zU(),G=VV();function K(){if(!(this instanceof K))return new K;G.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}X.inherits(K,G),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")}}),$V=$0((U,Z)=>{var X=zU(),G=hZ(),K=pU(),F=X.rotr64_hi,$=X.rotr64_lo,L=X.shr64_hi,M=X.shr64_lo,D=X.sum64,T=X.sum64_hi,A=X.sum64_lo,q=X.sum64_4_hi,S=X.sum64_4_lo,E=X.sum64_5_hi,j=X.sum64_5_lo,k=G.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(Q,W){var C=this.W;for(var z=0;z<32;z++)C[z]=Q[W+z];for(;z<C.length;z+=2){var H=V(C[z-4],C[z-3]),J=I(C[z-4],C[z-3]),O=C[z-14],P=C[z-13],R=i(C[z-30],C[z-29]),_=Y(C[z-30],C[z-29]),f=C[z-32],p=C[z-31];C[z]=q(H,J,O,P,R,_,f,p),C[z+1]=S(H,J,O,P,R,_,f,p)}},v.prototype._update=function(Q,W){this._prepareBlock(Q,W);var C=this.W,z=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],p=this.h[8],o=this.h[9],K0=this.h[10],a=this.h[11],l=this.h[12],G0=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,Q0=Y0(p,o),t=b(p,o),U0=x(p,o,K0,a,l,G0),q0=N(p,o,K0,a,l,G0),c=this.k[f0],m=this.k[f0+1],g0=C[f0],r=C[f0+1],J0=E(y,h,Q0,t,U0,q0,c,m,g0,r),h0=j(y,h,Q0,t,U0,q0,c,m,g0,r);y=Z0(z,H),h=V0(z,H),Q0=w(z,H,J,O,P,R),t=u(z,H,J,O,P,R);var H0=T(y,h,Q0,t),O0=A(y,h,Q0,t);n=l,s=G0,l=K0,G0=a,K0=p,a=o,p=T(_,f,J0,h0),o=A(f,f,J0,h0),_=P,f=R,P=J,R=O,J=z,O=H,z=T(J0,h0,H0,O0),H=A(J0,h0,H0,O0)}D(this.h,0,z,H),D(this.h,2,J,O),D(this.h,4,P,R),D(this.h,6,_,f),D(this.h,8,p,o),D(this.h,10,K0,a),D(this.h,12,l,G0),D(this.h,14,n,s)},v.prototype._digest=function(Q){if(Q==="hex")return X.toHex32(this.h,"big");else return X.split32(this.h,"big")};function x(Q,W,C,z,H){var J=Q&C^~Q&H;if(J<0)J+=4294967296;return J}function N(Q,W,C,z,H,J){var O=W&z^~W&J;if(O<0)O+=4294967296;return O}function w(Q,W,C,z,H){var J=Q&C^Q&H^C&H;if(J<0)J+=4294967296;return J}function u(Q,W,C,z,H,J){var O=W&z^W&J^z&J;if(O<0)O+=4294967296;return O}function Z0(Q,W){var C=F(Q,W,28),z=F(W,Q,2),H=F(W,Q,7),J=C^z^H;if(J<0)J+=4294967296;return J}function V0(Q,W){var C=$(Q,W,28),z=$(W,Q,2),H=$(W,Q,7),J=C^z^H;if(J<0)J+=4294967296;return J}function Y0(Q,W){var C=F(Q,W,14),z=F(Q,W,18),H=F(W,Q,9),J=C^z^H;if(J<0)J+=4294967296;return J}function b(Q,W){var C=$(Q,W,14),z=$(Q,W,18),H=$(W,Q,9),J=C^z^H;if(J<0)J+=4294967296;return J}function i(Q,W){var C=F(Q,W,1),z=F(Q,W,8),H=L(Q,W,7),J=C^z^H;if(J<0)J+=4294967296;return J}function Y(Q,W){var C=$(Q,W,1),z=$(Q,W,8),H=M(Q,W,7),J=C^z^H;if(J<0)J+=4294967296;return J}function V(Q,W){var C=F(Q,W,19),z=F(W,Q,29),H=L(Q,W,6),J=C^z^H;if(J<0)J+=4294967296;return J}function I(Q,W){var C=$(Q,W,19),z=$(W,Q,29),H=M(Q,W,6),J=C^z^H;if(J<0)J+=4294967296;return J}}),SF=$0((U,Z)=>{var X=zU(),G=$V();function K(){if(!(this instanceof K))return new K;G.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}X.inherits(K,G),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")}}),EF=$0((U)=>{U.sha1=TF(),U.sha224=RF(),U.sha256=VV(),U.sha384=SF(),U.sha512=$V()}),PF=$0((U)=>{var Z=zU(),X=hZ(),G=Z.rotl32,K=Z.sum32,F=Z.sum32_3,$=Z.sum32_4,L=X.BlockHash;function M(){if(!(this instanceof M))return new M;L.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}Z.inherits(M,L),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(G($(v,D(Y,x,N,w),k[q[Y]+B],T(Y)),E[Y]),u);v=u,u=w,w=G(N,10),N=x,x=V,V=K(G($(Z0,D(79-Y,V0,Y0,b),k[S[Y]+B],A(Y)),j[Y]),i),Z0=i,i=b,b=G(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 D(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 q=[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],S=[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],E=[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]}),kF=$0((U,Z)=>{var X=zU(),G=pU();function K(F,$,L){if(!(this instanceof K))return new K(F,$,L);this.Hash=F,this.blockSize=F.blockSize/8,this.outSize=F.outSize/8,this.inner=null,this.outer=null,this._init(X.toArray($,L))}Z.exports=K,K.prototype._init=function(F){if(F.length>this.blockSize)F=new this.Hash().update(F).digest();G(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)}}),YJ=$0((U)=>{var Z=U;Z.utils=zU(),Z.common=hZ(),Z.sha=EF(),Z.ripemd=PF(),Z.hmac=kF(),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}),jF=$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"]]}}}),JJ=$0((U)=>{var Z=U,X=YJ(),G=GV(),K=WU(),F=K.assert;function $(D){if(D.type==="short")this.curve=new G.short(D);else if(D.type==="edwards")this.curve=new G.edwards(D);else this.curve=new G.mont(D);this.g=this.curve.g,this.n=this.curve.n,this.hash=D.hash,F(this.g.validate(),"Invalid curve"),F(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}Z.PresetCurve=$;function L(D,T){Object.defineProperty(Z,D,{configurable:!0,enumerable:!0,get:function(){var A=new $(T);return Object.defineProperty(Z,D,{configurable:!0,enumerable:!0,value:A}),A}})}L("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"]}),L("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"]}),L("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"]}),L("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"]}),L("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"]}),L("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"]}),L("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=jF()}catch(D){M=void 0}L("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]})}),vF=$0((U,Z)=>{var X=YJ(),G=YV(),K=pU();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 L=G.toArray($.entropy,$.entropyEnc||"hex"),M=G.toArray($.nonce,$.nonceEnc||"hex"),D=G.toArray($.pers,$.persEnc||"hex");K(L.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(L,M,D)}Z.exports=F,F.prototype._init=function($,L,M){var D=$.concat(L).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(D),this._reseed=1,this.reseedInterval=281474976710656},F.prototype._hmac=function(){return new X.hmac(this.hash,this.K)},F.prototype._update=function($){var L=this._hmac().update(this.V).update([0]);if($)L=L.update($);if(this.K=L.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($,L,M,D){if(typeof L!=="string")D=M,M=L,L=null;$=G.toArray($,L),M=G.toArray(M,D),K($.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update($.concat(M||[])),this._reseed=1},F.prototype.generate=function($,L,M,D){if(this._reseed>this.reseedInterval)throw Error("Reseed is required");if(typeof L!=="string")D=M,M=L,L=null;if(M)M=G.toArray(M,D||"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++,G.encode(A,L)}}),_F=$0((U,Z)=>{var X=jU(),G=WU(),K=G.assert;function F($,L){if(this.ec=$,this.priv=null,this.pub=null,L.priv)this._importPrivate(L.priv,L.privEnc);if(L.pub)this._importPublic(L.pub,L.pubEnc)}Z.exports=F,F.fromPublic=function($,L,M){if(L instanceof F)return L;return new F($,{pub:L,pubEnc:M})},F.fromPrivate=function($,L,M){if(L instanceof F)return L;return new F($,{priv:L,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($,L){if(typeof $==="string")L=$,$=null;if(!this.pub)this.pub=this.ec.g.mul(this.priv);if(!L)return this.pub;return this.pub.encode(L,$)},F.prototype.getPrivate=function($){if($==="hex")return this.priv.toString(16,2);else return this.priv},F.prototype._importPrivate=function($,L){this.priv=new X($,L||16),this.priv=this.priv.umod(this.ec.curve.n)},F.prototype._importPublic=function($,L){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($,L)},F.prototype.derive=function($){if(!$.validate())K($.validate(),"public point not validated");return $.mul(this.priv).getX()},F.prototype.sign=function($,L,M){return this.ec.sign($,this,L,M)},F.prototype.verify=function($,L,M){return this.ec.verify($,L,this,void 0,M)},F.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"}}),BF=$0((U,Z)=>{var X=jU(),G=WU(),K=G.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 L(T,A){var q=T[A.place++];if(!(q&128))return q;var S=q&15;if(S===0||S>4)return!1;if(T[A.place]===0)return!1;var E=0;for(var j=0,k=A.place;j<S;j++,k++)E<<=8,E|=T[k],E>>>=0;if(E<=127)return!1;return A.place=k,E}function M(T){var A=0,q=T.length-1;while(!T[A]&&!(T[A+1]&128)&&A<q)A++;if(A===0)return T;return T.slice(A)}F.prototype._importDER=function(T,A){T=G.toArray(T,A);var q=new $;if(T[q.place++]!==48)return!1;var S=L(T,q);if(S===!1)return!1;if(S+q.place!==T.length)return!1;if(T[q.place++]!==2)return!1;var E=L(T,q);if(E===!1)return!1;if((T[q.place]&128)!==0)return!1;var j=T.slice(q.place,E+q.place);if(q.place+=E,T[q.place++]!==2)return!1;var k=L(T,q);if(k===!1)return!1;if(T.length!==k+q.place)return!1;if((T[q.place]&128)!==0)return!1;var B=T.slice(q.place,k+q.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 D(T,A){if(A<128){T.push(A);return}var q=1+(Math.log(A)/Math.LN2>>>3);T.push(q|128);while(--q)T.push(A>>>(q<<3)&255);T.push(A)}F.prototype.toDER=function(T){var A=this.r.toArray(),q=this.s.toArray();if(A[0]&128)A=[0].concat(A);if(q[0]&128)q=[0].concat(q);A=M(A),q=M(q);while(!q[0]&&!(q[1]&128))q=q.slice(1);var S=[2];D(S,A.length),S=S.concat(A),S.push(2),D(S,q.length);var E=S.concat(q),j=[48];return D(j,E.length),j=j.concat(E),G.encode(j,T)}}),xF=$0((U,Z)=>{var X=jU(),G=vF(),K=WU(),F=JJ(),$=JV(),L=K.assert,M=_F(),D=BF();function T(A){if(!(this instanceof T))return new T(A);if(typeof A==="string")L(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,q){return M.fromPrivate(this,A,q)},T.prototype.keyFromPublic=function(A,q){return M.fromPublic(this,A,q)},T.prototype.genKeyPair=function(A){if(!A)A={};var q=new G({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()}),S=this.n.byteLength(),E=this.n.sub(new X(2));for(;;){var j=new X(q.generate(S));if(j.cmp(E)>0)continue;return j.iaddn(1),this.keyFromPrivate(j)}},T.prototype._truncateToN=function(A,q,S){var E;if(X.isBN(A)||typeof A==="number")A=new X(A,16),E=A.byteLength();else if(typeof A==="object")E=A.length,A=new X(A,16);else{var j=A.toString();E=j.length+1>>>1,A=new X(j,16)}if(typeof S!=="number")S=E*8;var k=S-this.n.bitLength();if(k>0)A=A.ushrn(k);if(!q&&A.cmp(this.n)>=0)return A.sub(this.n);else return A},T.prototype.sign=function(A,q,S,E){if(typeof S==="object")E=S,S=null;if(!E)E={};if(typeof A!=="string"&&typeof A!=="number"&&!X.isBN(A)){L(typeof A==="object"&&A&&typeof A.length==="number","Expected message to be an array-like, a hex string, or a BN instance"),L(A.length>>>0===A.length);for(var j=0;j<A.length;j++)L((A[j]&255)===A[j])}q=this.keyFromPrivate(q,S),A=this._truncateToN(A,!1,E.msgBitLength),L(!A.isNeg(),"Can not sign a negative message");var k=this.n.byteLength(),B=q.getPrivate().toArray("be",k),v=A.toArray("be",k);L(new X(v).eq(A),"Can not sign message");var x=new G({hash:this.hash,entropy:B,nonce:v,pers:E.pers,persEnc:E.persEnc||"utf8"}),N=this.n.sub(new X(1));for(var w=0;;w++){var u=E.k?E.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(q.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(E.canonical&&b.cmp(this.nh)>0)b=this.n.sub(b),i^=1;return new D({r:Y0,s:b,recoveryParam:i})}},T.prototype.verify=function(A,q,S,E,j){if(!j)j={};A=this._truncateToN(A,!1,j.msgBitLength),S=this.keyFromPublic(S,E),q=new D(q,"hex");var{r:k,s:B}=q;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,S.getPublic(),N),w.isInfinity())return!1;return w.getX().umod(this.n).cmp(k)===0}if(w=this.g.jmulAdd(x,S.getPublic(),N),w.isInfinity())return!1;return w.eqXToP(k)},T.prototype.recoverPubKey=function(A,q,S,E){L((3&S)===S,"The recovery param is more than two bits"),q=new D(q,E);var j=this.n,k=new X(A),B=q.r,v=q.s,x=S&1,N=S>>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=q.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,q,S,E){if(q=new D(q,E),q.recoveryParam!==null)return q.recoveryParam;for(var j=0;j<4;j++){var k;try{k=this.recoverPubKey(A,q,j)}catch(B){continue}if(k.eq(S))return j}throw Error("Unable to find valid recovery factor")}}),NF=$0((U,Z)=>{var X=WU(),G=X.assert,K=X.parseBytes,F=X.cachedProperty;function $(L,M){if(this.eddsa=L,this._secret=K(M.secret),L.isPoint(M.pub))this._pub=M.pub;else this._pubBytes=K(M.pub)}$.fromPublic=function(L,M){if(M instanceof $)return M;return new $(L,{pub:M})},$.fromSecret=function(L,M){if(M instanceof $)return M;return new $(L,{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 L=this.eddsa,M=this.hash(),D=L.encodingLength-1,T=M.slice(0,L.encodingLength);return T[0]&=248,T[D]&=127,T[D]|=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(L){return G(this._secret,"KeyPair can only verify"),this.eddsa.sign(L,this)},$.prototype.verify=function(L,M){return this.eddsa.verify(L,M,this)},$.prototype.getSecret=function(L){return G(this._secret,"KeyPair is public only"),X.encode(this.secret(),L)},$.prototype.getPublic=function(L){return X.encode(this.pubBytes(),L)},Z.exports=$}),gF=$0((U,Z)=>{var X=jU(),G=WU(),K=G.assert,F=G.cachedProperty,$=G.parseBytes;function L(M,D){if(this.eddsa=M,typeof D!=="object")D=$(D);if(Array.isArray(D))K(D.length===M.encodingLength*2,"Signature has invalid size"),D={R:D.slice(0,M.encodingLength),S:D.slice(M.encodingLength)};if(K(D.R&&D.S,"Signature without R or S"),M.isPoint(D.R))this._R=D.R;if(D.S instanceof X)this._S=D.S;this._Rencoded=Array.isArray(D.R)?D.R:D.Rencoded,this._Sencoded=Array.isArray(D.S)?D.S:D.Sencoded}F(L,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),F(L,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),F(L,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),F(L,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),L.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},L.prototype.toHex=function(){return G.encode(this.toBytes(),"hex").toUpperCase()},Z.exports=L}),fF=$0((U,Z)=>{var X=YJ(),G=JJ(),K=WU(),F=K.assert,$=K.parseBytes,L=NF(),M=gF();function D(T){if(F(T==="ed25519","only tested with ed25519 so far"),!(this instanceof D))return new D(T);T=G[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=D,D.prototype.sign=function(T,A){T=$(T);var q=this.keyFromSecret(A),S=this.hashInt(q.messagePrefix(),T),E=this.g.mul(S),j=this.encodePoint(E),k=this.hashInt(j,q.pubBytes(),T).mul(q.priv()),B=S.add(k).umod(this.curve.n);return this.makeSignature({R:E,S:B,Rencoded:j})},D.prototype.verify=function(T,A,q){if(T=$(T),A=this.makeSignature(A),A.S().gte(A.eddsa.curve.n)||A.S().isNeg())return!1;var S=this.keyFromPublic(q),E=this.hashInt(A.Rencoded(),S.pubBytes(),T),j=this.g.mul(A.S()),k=A.R().add(S.pub().mul(E));return k.eq(j)},D.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)},D.prototype.keyFromPublic=function(T){return L.fromPublic(this,T)},D.prototype.keyFromSecret=function(T){return L.fromSecret(this,T)},D.prototype.makeSignature=function(T){if(T instanceof M)return T;return new M(this,T)},D.prototype.encodePoint=function(T){var A=T.getY().toArray("le",this.encodingLength);return A[this.encodingLength-1]|=T.getX().isOdd()?128:0,A},D.prototype.decodePoint=function(T){T=K.parseBytes(T);var A=T.length-1,q=T.slice(0,A).concat(T[A]&-129),S=(T[A]&128)!==0,E=K.intFromLE(q);return this.curve.pointFromY(E,S)},D.prototype.encodeInt=function(T){return T.toArray("le",this.encodingLength)},D.prototype.decodeInt=function(T){return K.intFromLE(T)},D.prototype.isPoint=function(T){return T instanceof this.pointClass}}),wF=$0((U)=>{var Z=U;Z.version=DF().version,Z.utils=WU(),Z.rand=JV(),Z.curve=GV(),Z.curves=JJ(),Z.ec=xF(),Z.eddsa=fF()}),yF=$0((U,Z)=>{(function(X,G){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 G.BN=$;$.BN=$,$.wordSize=26;var L;try{if(typeof window<"u"&&typeof window.Buffer<"u")L=window.Buffer;else L=(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 Q=0;if(Y[0]==="-")Q++,this.negative=1;if(Q<Y.length){if(V===16)this._parseHex(Y,Q,I);else if(this._parseBase(Y,V,Q),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 Q=0;Q<this.length;Q++)this.words[Q]=0;var W,C,z=0;if(I==="be"){for(Q=Y.length-1,W=0;Q>=0;Q-=3)if(C=Y[Q]|Y[Q-1]<<8|Y[Q-2]<<16,this.words[W]|=C<<z&67108863,this.words[W+1]=C>>>26-z&67108863,z+=24,z>=26)z-=26,W++}else if(I==="le"){for(Q=0,W=0;Q<Y.length;Q+=3)if(C=Y[Q]|Y[Q+1]<<8|Y[Q+2]<<16,this.words[W]|=C<<z&67108863,this.words[W+1]=C>>>26-z&67108863,z+=24,z>=26)z-=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 D(Y,V,I){var Q=M(Y,I);if(I-1>=V)Q|=M(Y,I-1)<<4;return Q}$.prototype._parseHex=function(Y,V,I){this.length=Math.ceil((Y.length-V)/6),this.words=Array(this.length);for(var Q=0;Q<this.length;Q++)this.words[Q]=0;var W=0,C=0,z;if(I==="be")for(Q=Y.length-1;Q>=V;Q-=2)if(z=D(Y,V,Q)<<W,this.words[C]|=z&67108863,W>=18)W-=18,C+=1,this.words[C]|=z>>>26;else W+=8;else{var H=Y.length-V;for(Q=H%2===0?V+1:V;Q<Y.length;Q+=2)if(z=D(Y,V,Q)<<W,this.words[C]|=z&67108863,W>=18)W-=18,C+=1,this.words[C]|=z>>>26;else W+=8}this.strip()};function T(Y,V,I,Q){var W=0,C=Math.min(Y.length,I);for(var z=V;z<C;z++){var H=Y.charCodeAt(z)-48;if(W*=Q,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 Q=0,W=1;W<=67108863;W*=V)Q++;Q--,W=W/V|0;var C=Y.length-I,z=C%Q,H=Math.min(C,C-z)+I,J=0;for(var O=I;O<H;O+=Q)if(J=T(Y,O,O+Q,V),this.imuln(W),this.words[0]+J<67108864)this.words[0]+=J;else this._iaddn(J);if(z!==0){var P=1;J=T(Y,O,Y.length,V);for(O=0;O<z;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"],q=[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],S=[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 Q=0,W=0;for(var C=0;C<this.length;C++){var z=this.words[C],H=((z<<Q|W)&16777215).toString(16);if(W=z>>>24-Q&16777215,Q+=2,Q>=26)Q-=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=q[Y],O=S[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 L<"u"),this.toArrayLike(L,Y,V)},$.prototype.toArray=function(Y,V){return this.toArrayLike(Array,Y,V)},$.prototype.toArrayLike=function(Y,V,I){var Q=this.byteLength(),W=I||Math.max(1,Q);K(Q<=W,"byte array longer than desired length"),K(W>0,"Requested array length <= 0"),this.strip();var C=V==="le",z=new Y(W),H,J,O=this.clone();if(!C){for(J=0;J<W-Q;J++)z[J]=0;for(J=0;!O.isZero();J++)H=O.andln(255),O.iushrn(8),z[W-J-1]=H}else{for(J=0;!O.isZero();J++)H=O.andln(255),O.iushrn(8),z[J]=H;for(;J<W;J++)z[J]=0}return z},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 E(Y){var V=Array(Y.bitLength());for(var I=0;I<V.length;I++){var Q=I/26|0,W=I%26;V[I]=(Y.words[Q]&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 Q=0;Q<I.length;Q++)this.words[Q]=V.words[Q]^I.words[Q];if(this!==V)for(;Q<V.length;Q++)this.words[Q]=V.words[Q];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 Q=0;Q<V;Q++)this.words[Q]=~this.words[Q]&67108863;if(I>0)this.words[Q]=~this.words[Q]&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,Q=Y%26;if(this._expand(I+1),V)this.words[I]=this.words[I]|1<<Q;else this.words[I]=this.words[I]&~(1<<Q);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,Q;if(this.length>Y.length)I=this,Q=Y;else I=Y,Q=this;var W=0;for(var C=0;C<Q.length;C++)V=(I.words[C]|0)+(Q.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 Q,W;if(I>0)Q=this,W=Y;else Q=Y,W=this;var C=0;for(var z=0;z<W.length;z++)V=(Q.words[z]|0)-(W.words[z]|0)+C,C=V>>26,this.words[z]=V&67108863;for(;C!==0&&z<Q.length;z++)V=(Q.words[z]|0)+C,C=V>>26,this.words[z]=V&67108863;if(C===0&&z<Q.length&&Q!==this)for(;z<Q.length;z++)this.words[z]=Q.words[z];if(this.length=Math.max(this.length,z),Q!==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 Q=Y.length+V.length|0;I.length=Q,Q=Q-1|0;var W=Y.words[0]|0,C=V.words[0]|0,z=W*C,H=z&67108863,J=z/67108864|0;I.words[0]=H;for(var O=1;O<Q;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 p=O-f|0;W=Y.words[p]|0,C=V.words[f]|0,z=W*C+R,P+=z/67108864|0,R=z&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 Q=Y.words,W=V.words,C=I.words,z=0,H,J,O,P=Q[0]|0,R=P&8191,_=P>>>13,f=Q[1]|0,p=f&8191,o=f>>>13,K0=Q[2]|0,a=K0&8191,l=K0>>>13,G0=Q[3]|0,n=G0&8191,s=G0>>>13,f0=Q[4]|0,y=f0&8191,h=f0>>>13,Q0=Q[5]|0,t=Q0&8191,U0=Q0>>>13,q0=Q[6]|0,c=q0&8191,m=q0>>>13,g0=Q[7]|0,r=g0&8191,J0=g0>>>13,h0=Q[8]|0,H0=h0&8191,O0=h0>>>13,J1=Q[9]|0,I0=J1&8191,C0=J1>>>13,K1=W[0]|0,L0=K1&8191,D0=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,S0=h1>>>13,_1=W[4]|0,B0=_1&8191,x0=_1>>>13,B1=W[5]|0,E0=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,G1=W[8]|0,P0=G1&8191,N0=G1>>>13,u1=W[9]|0,k0=u1&8191,M0=u1>>>13;I.negative=Y.negative^V.negative,I.length=19,H=Math.imul(R,L0),J=Math.imul(R,D0),J=J+Math.imul(_,L0)|0,O=Math.imul(_,D0);var Q1=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(Q1>>>26)|0,Q1&=67108863,H=Math.imul(p,L0),J=Math.imul(p,D0),J=J+Math.imul(o,L0)|0,O=Math.imul(o,D0),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=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(l0>>>26)|0,l0&=67108863,H=Math.imul(a,L0),J=Math.imul(a,D0),J=J+Math.imul(l,L0)|0,O=Math.imul(l,D0),H=H+Math.imul(p,T0)|0,J=J+Math.imul(p,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=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(b0>>>26)|0,b0&=67108863,H=Math.imul(n,L0),J=Math.imul(n,D0),J=J+Math.imul(s,L0)|0,O=Math.imul(s,D0),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(p,v0)|0,J=J+Math.imul(p,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,S0)|0,J=J+Math.imul(_,_0)|0,O=O+Math.imul(_,S0)|0;var t0=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(t0>>>26)|0,t0&=67108863,H=Math.imul(y,L0),J=Math.imul(y,D0),J=J+Math.imul(h,L0)|0,O=Math.imul(h,D0),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(p,_0)|0,J=J+Math.imul(p,S0)|0,J=J+Math.imul(o,_0)|0,O=O+Math.imul(o,S0)|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=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(r0>>>26)|0,r0&=67108863,H=Math.imul(t,L0),J=Math.imul(t,D0),J=J+Math.imul(U0,L0)|0,O=Math.imul(U0,D0),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,S0)|0,J=J+Math.imul(l,_0)|0,O=O+Math.imul(l,S0)|0,H=H+Math.imul(p,B0)|0,J=J+Math.imul(p,x0)|0,J=J+Math.imul(o,B0)|0,O=O+Math.imul(o,x0)|0,H=H+Math.imul(R,E0)|0,J=J+Math.imul(R,g)|0,J=J+Math.imul(_,E0)|0,O=O+Math.imul(_,g)|0;var H1=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(H1>>>26)|0,H1&=67108863,H=Math.imul(c,L0),J=Math.imul(c,D0),J=J+Math.imul(m,L0)|0,O=Math.imul(m,D0),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,S0)|0,J=J+Math.imul(s,_0)|0,O=O+Math.imul(s,S0)|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(p,E0)|0,J=J+Math.imul(p,g)|0,J=J+Math.imul(o,E0)|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=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(O1>>>26)|0,O1&=67108863,H=Math.imul(r,L0),J=Math.imul(r,D0),J=J+Math.imul(J0,L0)|0,O=Math.imul(J0,D0),H=H+Math.imul(c,T0)|0,J=J+Math.imul(c,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,S0)|0,J=J+Math.imul(h,_0)|0,O=O+Math.imul(h,S0)|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,E0)|0,J=J+Math.imul(a,g)|0,J=J+Math.imul(l,E0)|0,O=O+Math.imul(l,g)|0,H=H+Math.imul(p,e)|0,J=J+Math.imul(p,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=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(C1>>>26)|0,C1&=67108863,H=Math.imul(H0,L0),J=Math.imul(H0,D0),J=J+Math.imul(O0,L0)|0,O=Math.imul(O0,D0),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(c,v0)|0,J=J+Math.imul(c,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,S0)|0,J=J+Math.imul(U0,_0)|0,O=O+Math.imul(U0,S0)|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,E0)|0,J=J+Math.imul(n,g)|0,J=J+Math.imul(s,E0)|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(p,F0)|0,J=J+Math.imul(p,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=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(A1>>>26)|0,A1&=67108863,H=Math.imul(I0,L0),J=Math.imul(I0,D0),J=J+Math.imul(C0,L0)|0,O=Math.imul(C0,D0),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(c,_0)|0,J=J+Math.imul(c,S0)|0,J=J+Math.imul(m,_0)|0,O=O+Math.imul(m,S0)|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,E0)|0,J=J+Math.imul(y,g)|0,J=J+Math.imul(h,E0)|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(p,P0)|0,J=J+Math.imul(p,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 D1=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(D1>>>26)|0,D1&=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,S0)|0,J=J+Math.imul(J0,_0)|0,O=O+Math.imul(J0,S0)|0,H=H+Math.imul(c,B0)|0,J=J+Math.imul(c,x0)|0,J=J+Math.imul(m,B0)|0,O=O+Math.imul(m,x0)|0,H=H+Math.imul(t,E0)|0,J=J+Math.imul(t,g)|0,J=J+Math.imul(U0,E0)|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(p,k0)|0,J=J+Math.imul(p,M0)|0,J=J+Math.imul(o,k0)|0,O=O+Math.imul(o,M0)|0;var z1=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(z1>>>26)|0,z1&=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,S0)|0,J=J+Math.imul(O0,_0)|0,O=O+Math.imul(O0,S0)|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(c,E0)|0,J=J+Math.imul(c,g)|0,J=J+Math.imul(m,E0)|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 L1=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(L1>>>26)|0,L1&=67108863,H=Math.imul(I0,_0),J=Math.imul(I0,S0),J=J+Math.imul(C0,_0)|0,O=Math.imul(C0,S0),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,E0)|0,J=J+Math.imul(r,g)|0,J=J+Math.imul(J0,E0)|0,O=O+Math.imul(J0,g)|0,H=H+Math.imul(c,e)|0,J=J+Math.imul(c,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=(z+H|0)+((J&8191)<<13)|0;z=(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,E0)|0,J=J+Math.imul(H0,g)|0,J=J+Math.imul(O0,E0)|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(c,F0)|0,J=J+Math.imul(c,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 q1=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(q1>>>26)|0,q1&=67108863,H=Math.imul(I0,E0),J=Math.imul(I0,g),J=J+Math.imul(C0,E0)|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(c,P0)|0,J=J+Math.imul(c,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=(z+H|0)+((J&8191)<<13)|0;z=(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(c,k0)|0,J=J+Math.imul(c,M0)|0,J=J+Math.imul(m,k0)|0,O=O+Math.imul(m,M0)|0;var R1=(z+H|0)+((J&8191)<<13)|0;z=(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 S1=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(S1>>>26)|0,S1&=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 E1=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(E1>>>26)|0,E1&=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=(z+H|0)+((J&8191)<<13)|0;if(z=(O+(J>>>13)|0)+(P1>>>26)|0,P1&=67108863,C[0]=Q1,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]=D1,C[10]=z1,C[11]=L1,C[12]=M1,C[13]=q1,C[14]=T1,C[15]=R1,C[16]=S1,C[17]=E1,C[18]=P1,z!==0)C[19]=z,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 Q=0,W=0;for(var C=0;C<I.length-1;C++){var z=W;W=0;var H=Q&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*_,p=f&67108863;z=z+(f/67108864|0)|0,p=p+H|0,H=p&67108863,z=z+(p>>>26)|0,W+=z>>>26,z&=67108863}I.words[C]=H,Q=z,z=W}if(Q!==0)I.words[C]=Q;else I.length--;return I.strip()}function v(Y,V,I){var Q=new x;return Q.mulp(Y,V,I)}$.prototype.mulTo=function(Y,V){var I,Q=this.length+Y.length;if(this.length===10&&Y.length===10)I=k(this,Y,V);else if(Q<63)I=j(this,Y,V);else if(Q<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 Q=0;Q<Y;Q++)V[Q]=this.revBin(Q,I,Y);return V},x.prototype.revBin=function(Y,V,I){if(Y===0||Y===I-1)return Y;var Q=0;for(var W=0;W<V;W++)Q|=(Y&1)<<V-W-1,Y>>=1;return Q},x.prototype.permute=function(Y,V,I,Q,W,C){for(var z=0;z<C;z++)Q[z]=V[Y[z]],W[z]=I[Y[z]]},x.prototype.transform=function(Y,V,I,Q,W,C){this.permute(C,Y,V,I,Q,W);for(var z=1;z<W;z<<=1){var H=z<<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<z;f++){var p=I[P+f],o=Q[P+f],K0=I[P+f+z],a=Q[P+f+z],l=R*K0-_*a;if(a=R*a+_*K0,K0=l,I[P+f]=p+K0,Q[P+f]=o+a,I[P+f+z]=p-K0,Q[P+f+z]=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,Q=I&1,W=0;for(I=I/2|0;I;I=I>>>1)W++;return 1<<W+1+Q},x.prototype.conjugate=function(Y,V,I){if(I<=1)return;for(var Q=0;Q<I/2;Q++){var W=Y[Q];Y[Q]=Y[I-Q-1],Y[I-Q-1]=W,W=V[Q],V[Q]=-V[I-Q-1],V[I-Q-1]=-W}},x.prototype.normalize13b=function(Y,V){var I=0;for(var Q=0;Q<V/2;Q++){var W=Math.round(Y[2*Q+1]/V)*8192+Math.round(Y[2*Q]/V)+I;if(Y[Q]=W&67108863,W<67108864)I=0;else I=W/67108864|0}return Y},x.prototype.convert13b=function(Y,V,I,Q){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<Q;++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 Q=2*this.guessLen13b(Y.length,V.length),W=this.makeRBT(Q),C=this.stub(Q),z=Array(Q),H=Array(Q),J=Array(Q),O=Array(Q),P=Array(Q),R=Array(Q),_=I.words;_.length=Q,this.convert13b(Y.words,Y.length,z,Q),this.convert13b(V.words,V.length,O,Q),this.transform(z,C,H,J,Q,W),this.transform(O,C,P,R,Q,W);for(var f=0;f<Q;f++){var p=H[f]*P[f]-J[f]*R[f];J[f]=H[f]*R[f]+J[f]*P[f],H[f]=p}return this.conjugate(H,J,Q),this.transform(H,J,_,C,Q,W),this.conjugate(_,C,Q),this.normalize13b(_,Q),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 Q=(this.words[I]|0)*Y,W=(Q&67108863)+(V&67108863);V>>=26,V+=Q/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=E(Y);if(V.length===0)return new $(1);var I=this;for(var Q=0;Q<V.length;Q++,I=I.sqr())if(V[Q]!==0)break;if(++Q<V.length)for(var W=I.sqr();Q<V.length;Q++,W=W.sqr()){if(V[Q]===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,Q=67108863>>>26-V<<26-V,W;if(V!==0){var C=0;for(W=0;W<this.length;W++){var z=this.words[W]&Q,H=(this.words[W]|0)-z<<V;this.words[W]=H|C,C=z>>>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 Q;if(V)Q=(V-V%26)/26;else Q=0;var W=Y%26,C=Math.min((Y-W)/26,this.length),z=67108863^67108863>>>W<<W,H=I;if(Q-=C,Q=Math.max(0,Q),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>=Q);J--){var P=this.words[J]|0;this.words[J]=O<<26-W|P>>>W,O=P&z}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,Q=1<<V;if(this.length<=I)return!1;var W=this.words[I];return!!(W&Q)},$.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 Q=67108863^67108863>>>V<<V;this.words[this.length-1]&=Q}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 Q=Y.length+I,W;this._expand(Q);var C,z=0;for(W=0;W<Y.length;W++){C=(this.words[W+I]|0)+z;var H=(Y.words[W]|0)*V;C-=H&67108863,z=(C>>26)-(H/67108864|0),this.words[W+I]=C&67108863}for(;W<this.length-I;W++)C=(this.words[W+I]|0)+z,z=C>>26,this.words[W+I]=C&67108863;if(z===0)return this.strip();K(z===-1),z=0;for(W=0;W<this.length;W++)C=-(this.words[W]|0)+z,z=C>>26,this.words[W]=C&67108863;return this.negative=1,this.strip()},$.prototype._wordDiv=function(Y,V){var I=this.length-Y.length,Q=this.clone(),W=Y,C=W.words[W.length-1]|0,z=this._countBits(C);if(I=26-z,I!==0)W=W.ushln(I),Q.iushln(I),C=W.words[W.length-1]|0;var H=Q.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=Q.clone()._ishlnsubmul(W,1,H);if(P.negative===0){if(Q=P,J)J.words[H]=1}for(var R=H-1;R>=0;R--){var _=(Q.words[W.length+R]|0)*67108864+(Q.words[W.length+R-1]|0);_=Math.min(_/C|0,67108863),Q._ishlnsubmul(W,_,R);while(Q.negative!==0)if(_--,Q.negative=0,Q._ishlnsubmul(W,1,R),!Q.isZero())Q.negative^=1;if(J)J.words[R]=_}if(J)J.strip();if(Q.strip(),V!=="div"&&I!==0)Q.iushrn(I);return{div:J||null,mod:Q}},$.prototype.divmod=function(Y,V,I){if(K(!Y.isZero()),this.isZero())return{div:new $(0),mod:new $(0)};var Q,W,C;if(this.negative!==0&&Y.negative===0){if(C=this.neg().divmod(Y,V),V!=="mod")Q=C.div.neg();if(V!=="div"){if(W=C.mod.neg(),I&&W.negative!==0)W.iadd(Y)}return{div:Q,mod:W}}if(this.negative===0&&Y.negative!==0){if(C=this.divmod(Y.neg(),V),V!=="mod")Q=C.div.neg();return{div:Q,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,Q=Y.ushrn(1),W=Y.andln(1),C=I.cmp(Q);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 Q=this.length-1;Q>=0;Q--)I=(V*I+(this.words[Q]|0))%Y;return I},$.prototype.idivn=function(Y){K(Y<=67108863);var V=0;for(var I=this.length-1;I>=0;I--){var Q=(this.words[I]|0)+V*67108864;this.words[I]=Q/Y|0,V=Q%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 Q=new $(1),W=new $(0),C=new $(0),z=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(Q.isOdd()||W.isOdd())Q.iadd(J),W.isub(O);Q.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()||z.isOdd())C.iadd(J),z.isub(O);C.iushrn(1),z.iushrn(1)}}if(V.cmp(I)>=0)V.isub(I),Q.isub(C),W.isub(z);else I.isub(V),C.isub(Q),z.isub(W)}return{a:C,b:z,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 Q=new $(1),W=new $(0),C=I.clone();while(V.cmpn(1)>0&&I.cmpn(1)>0){for(var z=0,H=1;(V.words[0]&H)===0&&z<26;++z,H<<=1);if(z>0){V.iushrn(z);while(z-- >0){if(Q.isOdd())Q.iadd(C);Q.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),Q.isub(W);else I.isub(V),W.isub(Q)}var P;if(V.cmpn(1)===0)P=Q;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 Q=0;V.isEven()&&I.isEven();Q++)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(Q)},$.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,Q=1<<V;if(this.length<=I)return this._expand(I+1),this.words[I]|=Q,this;var W=Q;for(var C=I;W!==0&&C<this.length;C++){var z=this.words[C]|0;z+=W,W=z>>>26,z&=67108863,this.words[C]=z}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 Q=this.words[0]|0;I=Q===Y?0:Q<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 Q=this.words[I]|0,W=Y.words[I]|0;if(Q===W)continue;if(Q<W)V=-1;else if(Q>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 Q=I<this.n?-1:V.ucmp(this.p);if(Q===0)V.words[0]=0,V.length=1;else if(Q>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,Q=Math.min(Y.length,9);for(var W=0;W<Q;W++)V.words[W]=Y.words[W];if(V.length=Q,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 z=Y.words[W]|0;Y.words[W-10]=(z&I)<<4|C>>>22,C=z}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 Q=Y.words[I]|0;V+=Q*977,Y.words[I]=V&67108863,V=Q*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 Q=(Y.words[I]|0)*19+V,W=Q&67108863;Q>>>=26,Y.words[I]=W,V=Q}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 Q=this.m.subn(1),W=0;while(!Q.isZero()&&Q.andln(1)===0)W++,Q.iushrn(1);K(!Q.isZero());var C=new $(1).toRed(this),z=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(z)!==0)J.redIAdd(z);var O=this.pow(J,Q),P=this.pow(Y,Q.addn(1).iushrn(1)),R=this.pow(Y,Q),_=W;while(R.cmp(C)!==0){var f=R;for(var p=0;f.cmp(C)!==0;p++)f=f.redSqr();K(p<_);var o=this.pow(O,new $(1).iushln(_-p-1));P=P.redMul(o),O=o.redSqr(),R=R.redMul(O),_=p}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,Q=Array(1<<I);Q[0]=new $(1).toRed(this),Q[1]=Y;for(var W=2;W<Q.length;W++)Q[W]=this.mul(Q[W-1],Y);var C=Q[0],z=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!==Q[0])C=this.sqr(C);if(R===0&&z===0){H=0;continue}if(z<<=1,z|=R,H++,H!==I&&(W!==0||P!==0))continue;C=this.mul(C,Q[z]),H=0,z=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),Q=I.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),W=I.isub(Q).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),Q=I.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),W=I.isub(Q).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,Z)=>{var X=wF(),G=yF();Z.exports=function(L){return new F(L)};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(L){if(this.curveType=K[L],!this.curveType)this.curveType={name:L};this.curve=new X.ec(this.curveType.name),this.keys=void 0}F.prototype.generateKeys=function(L,M){return this.keys=this.curve.genKeyPair(),this.getPublicKey(L,M)},F.prototype.computeSecret=function(L,M,D){if(M=M||"utf8",!Buffer.isBuffer(L))L=new Buffer(L,M);var T=this.curve.keyFromPublic(L).getPublic(),A=T.mul(this.keys.getPrivate()).getX();return $(A,D,this.curveType.byteLength)},F.prototype.getPublicKey=function(L,M){var D=this.keys.getPublic(M==="compressed",!0);if(M==="hybrid")if(D[D.length-1]%2)D[0]=7;else D[0]=6;return $(D,L)},F.prototype.getPrivateKey=function(L){return $(this.keys.getPrivate(),L)},F.prototype.setPublicKey=function(L,M){if(M=M||"utf8",!Buffer.isBuffer(L))L=new Buffer(L,M);return this.keys._importPublic(L),this},F.prototype.setPrivateKey=function(L,M){if(M=M||"utf8",!Buffer.isBuffer(L))L=new Buffer(L,M);var D=new G(L);return D=D.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(D),this};function $(L,M,D){if(!Array.isArray(L))L=L.toArray();var T=new Buffer(L);if(D&&T.length<D){var A=new Buffer(D-T.length);A.fill(0),T=Buffer.concat([A,T])}if(!M)return T;else return T.toString(M)}}),cF=$0((U,Z)=>{var X=(UU(),m0(e1)).createECDH;Z.exports=X||pF()}),hF=$0((U,Z)=>{(function(X,G){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 G.BN=$;$.BN=$,$.wordSize=26;var L;try{if(typeof window<"u"&&typeof window.Buffer<"u")L=window.Buffer;else L=(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 Q=0;if(Y[0]==="-")Q++,this.negative=1;if(Q<Y.length){if(V===16)this._parseHex(Y,Q,I);else if(this._parseBase(Y,V,Q),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 Q=0;Q<this.length;Q++)this.words[Q]=0;var W,C,z=0;if(I==="be"){for(Q=Y.length-1,W=0;Q>=0;Q-=3)if(C=Y[Q]|Y[Q-1]<<8|Y[Q-2]<<16,this.words[W]|=C<<z&67108863,this.words[W+1]=C>>>26-z&67108863,z+=24,z>=26)z-=26,W++}else if(I==="le"){for(Q=0,W=0;Q<Y.length;Q+=3)if(C=Y[Q]|Y[Q+1]<<8|Y[Q+2]<<16,this.words[W]|=C<<z&67108863,this.words[W+1]=C>>>26-z&67108863,z+=24,z>=26)z-=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 D(Y,V,I){var Q=M(Y,I);if(I-1>=V)Q|=M(Y,I-1)<<4;return Q}$.prototype._parseHex=function(Y,V,I){this.length=Math.ceil((Y.length-V)/6),this.words=Array(this.length);for(var Q=0;Q<this.length;Q++)this.words[Q]=0;var W=0,C=0,z;if(I==="be")for(Q=Y.length-1;Q>=V;Q-=2)if(z=D(Y,V,Q)<<W,this.words[C]|=z&67108863,W>=18)W-=18,C+=1,this.words[C]|=z>>>26;else W+=8;else{var H=Y.length-V;for(Q=H%2===0?V+1:V;Q<Y.length;Q+=2)if(z=D(Y,V,Q)<<W,this.words[C]|=z&67108863,W>=18)W-=18,C+=1,this.words[C]|=z>>>26;else W+=8}this.strip()};function T(Y,V,I,Q){var W=0,C=Math.min(Y.length,I);for(var z=V;z<C;z++){var H=Y.charCodeAt(z)-48;if(W*=Q,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 Q=0,W=1;W<=67108863;W*=V)Q++;Q--,W=W/V|0;var C=Y.length-I,z=C%Q,H=Math.min(C,C-z)+I,J=0;for(var O=I;O<H;O+=Q)if(J=T(Y,O,O+Q,V),this.imuln(W),this.words[0]+J<67108864)this.words[0]+=J;else this._iaddn(J);if(z!==0){var P=1;J=T(Y,O,Y.length,V);for(O=0;O<z;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"],q=[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],S=[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 Q=0,W=0;for(var C=0;C<this.length;C++){var z=this.words[C],H=((z<<Q|W)&16777215).toString(16);if(W=z>>>24-Q&16777215,Q+=2,Q>=26)Q-=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=q[Y],O=S[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 L<"u"),this.toArrayLike(L,Y,V)},$.prototype.toArray=function(Y,V){return this.toArrayLike(Array,Y,V)},$.prototype.toArrayLike=function(Y,V,I){var Q=this.byteLength(),W=I||Math.max(1,Q);K(Q<=W,"byte array longer than desired length"),K(W>0,"Requested array length <= 0"),this.strip();var C=V==="le",z=new Y(W),H,J,O=this.clone();if(!C){for(J=0;J<W-Q;J++)z[J]=0;for(J=0;!O.isZero();J++)H=O.andln(255),O.iushrn(8),z[W-J-1]=H}else{for(J=0;!O.isZero();J++)H=O.andln(255),O.iushrn(8),z[J]=H;for(;J<W;J++)z[J]=0}return z},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 E(Y){var V=Array(Y.bitLength());for(var I=0;I<V.length;I++){var Q=I/26|0,W=I%26;V[I]=(Y.words[Q]&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 Q=0;Q<I.length;Q++)this.words[Q]=V.words[Q]^I.words[Q];if(this!==V)for(;Q<V.length;Q++)this.words[Q]=V.words[Q];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 Q=0;Q<V;Q++)this.words[Q]=~this.words[Q]&67108863;if(I>0)this.words[Q]=~this.words[Q]&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,Q=Y%26;if(this._expand(I+1),V)this.words[I]=this.words[I]|1<<Q;else this.words[I]=this.words[I]&~(1<<Q);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,Q;if(this.length>Y.length)I=this,Q=Y;else I=Y,Q=this;var W=0;for(var C=0;C<Q.length;C++)V=(I.words[C]|0)+(Q.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 Q,W;if(I>0)Q=this,W=Y;else Q=Y,W=this;var C=0;for(var z=0;z<W.length;z++)V=(Q.words[z]|0)-(W.words[z]|0)+C,C=V>>26,this.words[z]=V&67108863;for(;C!==0&&z<Q.length;z++)V=(Q.words[z]|0)+C,C=V>>26,this.words[z]=V&67108863;if(C===0&&z<Q.length&&Q!==this)for(;z<Q.length;z++)this.words[z]=Q.words[z];if(this.length=Math.max(this.length,z),Q!==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 Q=Y.length+V.length|0;I.length=Q,Q=Q-1|0;var W=Y.words[0]|0,C=V.words[0]|0,z=W*C,H=z&67108863,J=z/67108864|0;I.words[0]=H;for(var O=1;O<Q;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 p=O-f|0;W=Y.words[p]|0,C=V.words[f]|0,z=W*C+R,P+=z/67108864|0,R=z&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 Q=Y.words,W=V.words,C=I.words,z=0,H,J,O,P=Q[0]|0,R=P&8191,_=P>>>13,f=Q[1]|0,p=f&8191,o=f>>>13,K0=Q[2]|0,a=K0&8191,l=K0>>>13,G0=Q[3]|0,n=G0&8191,s=G0>>>13,f0=Q[4]|0,y=f0&8191,h=f0>>>13,Q0=Q[5]|0,t=Q0&8191,U0=Q0>>>13,q0=Q[6]|0,c=q0&8191,m=q0>>>13,g0=Q[7]|0,r=g0&8191,J0=g0>>>13,h0=Q[8]|0,H0=h0&8191,O0=h0>>>13,J1=Q[9]|0,I0=J1&8191,C0=J1>>>13,K1=W[0]|0,L0=K1&8191,D0=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,S0=h1>>>13,_1=W[4]|0,B0=_1&8191,x0=_1>>>13,B1=W[5]|0,E0=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,G1=W[8]|0,P0=G1&8191,N0=G1>>>13,u1=W[9]|0,k0=u1&8191,M0=u1>>>13;I.negative=Y.negative^V.negative,I.length=19,H=Math.imul(R,L0),J=Math.imul(R,D0),J=J+Math.imul(_,L0)|0,O=Math.imul(_,D0);var Q1=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(Q1>>>26)|0,Q1&=67108863,H=Math.imul(p,L0),J=Math.imul(p,D0),J=J+Math.imul(o,L0)|0,O=Math.imul(o,D0),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=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(l0>>>26)|0,l0&=67108863,H=Math.imul(a,L0),J=Math.imul(a,D0),J=J+Math.imul(l,L0)|0,O=Math.imul(l,D0),H=H+Math.imul(p,T0)|0,J=J+Math.imul(p,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=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(b0>>>26)|0,b0&=67108863,H=Math.imul(n,L0),J=Math.imul(n,D0),J=J+Math.imul(s,L0)|0,O=Math.imul(s,D0),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(p,v0)|0,J=J+Math.imul(p,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,S0)|0,J=J+Math.imul(_,_0)|0,O=O+Math.imul(_,S0)|0;var t0=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(t0>>>26)|0,t0&=67108863,H=Math.imul(y,L0),J=Math.imul(y,D0),J=J+Math.imul(h,L0)|0,O=Math.imul(h,D0),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(p,_0)|0,J=J+Math.imul(p,S0)|0,J=J+Math.imul(o,_0)|0,O=O+Math.imul(o,S0)|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=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(r0>>>26)|0,r0&=67108863,H=Math.imul(t,L0),J=Math.imul(t,D0),J=J+Math.imul(U0,L0)|0,O=Math.imul(U0,D0),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,S0)|0,J=J+Math.imul(l,_0)|0,O=O+Math.imul(l,S0)|0,H=H+Math.imul(p,B0)|0,J=J+Math.imul(p,x0)|0,J=J+Math.imul(o,B0)|0,O=O+Math.imul(o,x0)|0,H=H+Math.imul(R,E0)|0,J=J+Math.imul(R,g)|0,J=J+Math.imul(_,E0)|0,O=O+Math.imul(_,g)|0;var H1=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(H1>>>26)|0,H1&=67108863,H=Math.imul(c,L0),J=Math.imul(c,D0),J=J+Math.imul(m,L0)|0,O=Math.imul(m,D0),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,S0)|0,J=J+Math.imul(s,_0)|0,O=O+Math.imul(s,S0)|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(p,E0)|0,J=J+Math.imul(p,g)|0,J=J+Math.imul(o,E0)|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=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(O1>>>26)|0,O1&=67108863,H=Math.imul(r,L0),J=Math.imul(r,D0),J=J+Math.imul(J0,L0)|0,O=Math.imul(J0,D0),H=H+Math.imul(c,T0)|0,J=J+Math.imul(c,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,S0)|0,J=J+Math.imul(h,_0)|0,O=O+Math.imul(h,S0)|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,E0)|0,J=J+Math.imul(a,g)|0,J=J+Math.imul(l,E0)|0,O=O+Math.imul(l,g)|0,H=H+Math.imul(p,e)|0,J=J+Math.imul(p,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=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(C1>>>26)|0,C1&=67108863,H=Math.imul(H0,L0),J=Math.imul(H0,D0),J=J+Math.imul(O0,L0)|0,O=Math.imul(O0,D0),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(c,v0)|0,J=J+Math.imul(c,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,S0)|0,J=J+Math.imul(U0,_0)|0,O=O+Math.imul(U0,S0)|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,E0)|0,J=J+Math.imul(n,g)|0,J=J+Math.imul(s,E0)|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(p,F0)|0,J=J+Math.imul(p,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=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(A1>>>26)|0,A1&=67108863,H=Math.imul(I0,L0),J=Math.imul(I0,D0),J=J+Math.imul(C0,L0)|0,O=Math.imul(C0,D0),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(c,_0)|0,J=J+Math.imul(c,S0)|0,J=J+Math.imul(m,_0)|0,O=O+Math.imul(m,S0)|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,E0)|0,J=J+Math.imul(y,g)|0,J=J+Math.imul(h,E0)|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(p,P0)|0,J=J+Math.imul(p,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 D1=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(D1>>>26)|0,D1&=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,S0)|0,J=J+Math.imul(J0,_0)|0,O=O+Math.imul(J0,S0)|0,H=H+Math.imul(c,B0)|0,J=J+Math.imul(c,x0)|0,J=J+Math.imul(m,B0)|0,O=O+Math.imul(m,x0)|0,H=H+Math.imul(t,E0)|0,J=J+Math.imul(t,g)|0,J=J+Math.imul(U0,E0)|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(p,k0)|0,J=J+Math.imul(p,M0)|0,J=J+Math.imul(o,k0)|0,O=O+Math.imul(o,M0)|0;var z1=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(z1>>>26)|0,z1&=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,S0)|0,J=J+Math.imul(O0,_0)|0,O=O+Math.imul(O0,S0)|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(c,E0)|0,J=J+Math.imul(c,g)|0,J=J+Math.imul(m,E0)|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 L1=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(L1>>>26)|0,L1&=67108863,H=Math.imul(I0,_0),J=Math.imul(I0,S0),J=J+Math.imul(C0,_0)|0,O=Math.imul(C0,S0),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,E0)|0,J=J+Math.imul(r,g)|0,J=J+Math.imul(J0,E0)|0,O=O+Math.imul(J0,g)|0,H=H+Math.imul(c,e)|0,J=J+Math.imul(c,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=(z+H|0)+((J&8191)<<13)|0;z=(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,E0)|0,J=J+Math.imul(H0,g)|0,J=J+Math.imul(O0,E0)|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(c,F0)|0,J=J+Math.imul(c,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 q1=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(q1>>>26)|0,q1&=67108863,H=Math.imul(I0,E0),J=Math.imul(I0,g),J=J+Math.imul(C0,E0)|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(c,P0)|0,J=J+Math.imul(c,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=(z+H|0)+((J&8191)<<13)|0;z=(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(c,k0)|0,J=J+Math.imul(c,M0)|0,J=J+Math.imul(m,k0)|0,O=O+Math.imul(m,M0)|0;var R1=(z+H|0)+((J&8191)<<13)|0;z=(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 S1=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(S1>>>26)|0,S1&=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 E1=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(E1>>>26)|0,E1&=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=(z+H|0)+((J&8191)<<13)|0;if(z=(O+(J>>>13)|0)+(P1>>>26)|0,P1&=67108863,C[0]=Q1,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]=D1,C[10]=z1,C[11]=L1,C[12]=M1,C[13]=q1,C[14]=T1,C[15]=R1,C[16]=S1,C[17]=E1,C[18]=P1,z!==0)C[19]=z,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 Q=0,W=0;for(var C=0;C<I.length-1;C++){var z=W;W=0;var H=Q&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*_,p=f&67108863;z=z+(f/67108864|0)|0,p=p+H|0,H=p&67108863,z=z+(p>>>26)|0,W+=z>>>26,z&=67108863}I.words[C]=H,Q=z,z=W}if(Q!==0)I.words[C]=Q;else I.length--;return I.strip()}function v(Y,V,I){var Q=new x;return Q.mulp(Y,V,I)}$.prototype.mulTo=function(Y,V){var I,Q=this.length+Y.length;if(this.length===10&&Y.length===10)I=k(this,Y,V);else if(Q<63)I=j(this,Y,V);else if(Q<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 Q=0;Q<Y;Q++)V[Q]=this.revBin(Q,I,Y);return V},x.prototype.revBin=function(Y,V,I){if(Y===0||Y===I-1)return Y;var Q=0;for(var W=0;W<V;W++)Q|=(Y&1)<<V-W-1,Y>>=1;return Q},x.prototype.permute=function(Y,V,I,Q,W,C){for(var z=0;z<C;z++)Q[z]=V[Y[z]],W[z]=I[Y[z]]},x.prototype.transform=function(Y,V,I,Q,W,C){this.permute(C,Y,V,I,Q,W);for(var z=1;z<W;z<<=1){var H=z<<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<z;f++){var p=I[P+f],o=Q[P+f],K0=I[P+f+z],a=Q[P+f+z],l=R*K0-_*a;if(a=R*a+_*K0,K0=l,I[P+f]=p+K0,Q[P+f]=o+a,I[P+f+z]=p-K0,Q[P+f+z]=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,Q=I&1,W=0;for(I=I/2|0;I;I=I>>>1)W++;return 1<<W+1+Q},x.prototype.conjugate=function(Y,V,I){if(I<=1)return;for(var Q=0;Q<I/2;Q++){var W=Y[Q];Y[Q]=Y[I-Q-1],Y[I-Q-1]=W,W=V[Q],V[Q]=-V[I-Q-1],V[I-Q-1]=-W}},x.prototype.normalize13b=function(Y,V){var I=0;for(var Q=0;Q<V/2;Q++){var W=Math.round(Y[2*Q+1]/V)*8192+Math.round(Y[2*Q]/V)+I;if(Y[Q]=W&67108863,W<67108864)I=0;else I=W/67108864|0}return Y},x.prototype.convert13b=function(Y,V,I,Q){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<Q;++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 Q=2*this.guessLen13b(Y.length,V.length),W=this.makeRBT(Q),C=this.stub(Q),z=Array(Q),H=Array(Q),J=Array(Q),O=Array(Q),P=Array(Q),R=Array(Q),_=I.words;_.length=Q,this.convert13b(Y.words,Y.length,z,Q),this.convert13b(V.words,V.length,O,Q),this.transform(z,C,H,J,Q,W),this.transform(O,C,P,R,Q,W);for(var f=0;f<Q;f++){var p=H[f]*P[f]-J[f]*R[f];J[f]=H[f]*R[f]+J[f]*P[f],H[f]=p}return this.conjugate(H,J,Q),this.transform(H,J,_,C,Q,W),this.conjugate(_,C,Q),this.normalize13b(_,Q),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 Q=(this.words[I]|0)*Y,W=(Q&67108863)+(V&67108863);V>>=26,V+=Q/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=E(Y);if(V.length===0)return new $(1);var I=this;for(var Q=0;Q<V.length;Q++,I=I.sqr())if(V[Q]!==0)break;if(++Q<V.length)for(var W=I.sqr();Q<V.length;Q++,W=W.sqr()){if(V[Q]===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,Q=67108863>>>26-V<<26-V,W;if(V!==0){var C=0;for(W=0;W<this.length;W++){var z=this.words[W]&Q,H=(this.words[W]|0)-z<<V;this.words[W]=H|C,C=z>>>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 Q;if(V)Q=(V-V%26)/26;else Q=0;var W=Y%26,C=Math.min((Y-W)/26,this.length),z=67108863^67108863>>>W<<W,H=I;if(Q-=C,Q=Math.max(0,Q),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>=Q);J--){var P=this.words[J]|0;this.words[J]=O<<26-W|P>>>W,O=P&z}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,Q=1<<V;if(this.length<=I)return!1;var W=this.words[I];return!!(W&Q)},$.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 Q=67108863^67108863>>>V<<V;this.words[this.length-1]&=Q}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 Q=Y.length+I,W;this._expand(Q);var C,z=0;for(W=0;W<Y.length;W++){C=(this.words[W+I]|0)+z;var H=(Y.words[W]|0)*V;C-=H&67108863,z=(C>>26)-(H/67108864|0),this.words[W+I]=C&67108863}for(;W<this.length-I;W++)C=(this.words[W+I]|0)+z,z=C>>26,this.words[W+I]=C&67108863;if(z===0)return this.strip();K(z===-1),z=0;for(W=0;W<this.length;W++)C=-(this.words[W]|0)+z,z=C>>26,this.words[W]=C&67108863;return this.negative=1,this.strip()},$.prototype._wordDiv=function(Y,V){var I=this.length-Y.length,Q=this.clone(),W=Y,C=W.words[W.length-1]|0,z=this._countBits(C);if(I=26-z,I!==0)W=W.ushln(I),Q.iushln(I),C=W.words[W.length-1]|0;var H=Q.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=Q.clone()._ishlnsubmul(W,1,H);if(P.negative===0){if(Q=P,J)J.words[H]=1}for(var R=H-1;R>=0;R--){var _=(Q.words[W.length+R]|0)*67108864+(Q.words[W.length+R-1]|0);_=Math.min(_/C|0,67108863),Q._ishlnsubmul(W,_,R);while(Q.negative!==0)if(_--,Q.negative=0,Q._ishlnsubmul(W,1,R),!Q.isZero())Q.negative^=1;if(J)J.words[R]=_}if(J)J.strip();if(Q.strip(),V!=="div"&&I!==0)Q.iushrn(I);return{div:J||null,mod:Q}},$.prototype.divmod=function(Y,V,I){if(K(!Y.isZero()),this.isZero())return{div:new $(0),mod:new $(0)};var Q,W,C;if(this.negative!==0&&Y.negative===0){if(C=this.neg().divmod(Y,V),V!=="mod")Q=C.div.neg();if(V!=="div"){if(W=C.mod.neg(),I&&W.negative!==0)W.iadd(Y)}return{div:Q,mod:W}}if(this.negative===0&&Y.negative!==0){if(C=this.divmod(Y.neg(),V),V!=="mod")Q=C.div.neg();return{div:Q,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,Q=Y.ushrn(1),W=Y.andln(1),C=I.cmp(Q);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 Q=this.length-1;Q>=0;Q--)I=(V*I+(this.words[Q]|0))%Y;return I},$.prototype.idivn=function(Y){K(Y<=67108863);var V=0;for(var I=this.length-1;I>=0;I--){var Q=(this.words[I]|0)+V*67108864;this.words[I]=Q/Y|0,V=Q%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 Q=new $(1),W=new $(0),C=new $(0),z=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(Q.isOdd()||W.isOdd())Q.iadd(J),W.isub(O);Q.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()||z.isOdd())C.iadd(J),z.isub(O);C.iushrn(1),z.iushrn(1)}}if(V.cmp(I)>=0)V.isub(I),Q.isub(C),W.isub(z);else I.isub(V),C.isub(Q),z.isub(W)}return{a:C,b:z,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 Q=new $(1),W=new $(0),C=I.clone();while(V.cmpn(1)>0&&I.cmpn(1)>0){for(var z=0,H=1;(V.words[0]&H)===0&&z<26;++z,H<<=1);if(z>0){V.iushrn(z);while(z-- >0){if(Q.isOdd())Q.iadd(C);Q.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),Q.isub(W);else I.isub(V),W.isub(Q)}var P;if(V.cmpn(1)===0)P=Q;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 Q=0;V.isEven()&&I.isEven();Q++)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(Q)},$.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,Q=1<<V;if(this.length<=I)return this._expand(I+1),this.words[I]|=Q,this;var W=Q;for(var C=I;W!==0&&C<this.length;C++){var z=this.words[C]|0;z+=W,W=z>>>26,z&=67108863,this.words[C]=z}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 Q=this.words[0]|0;I=Q===Y?0:Q<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 Q=this.words[I]|0,W=Y.words[I]|0;if(Q===W)continue;if(Q<W)V=-1;else if(Q>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 Q=I<this.n?-1:V.ucmp(this.p);if(Q===0)V.words[0]=0,V.length=1;else if(Q>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,Q=Math.min(Y.length,9);for(var W=0;W<Q;W++)V.words[W]=Y.words[W];if(V.length=Q,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 z=Y.words[W]|0;Y.words[W-10]=(z&I)<<4|C>>>22,C=z}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 Q=Y.words[I]|0;V+=Q*977,Y.words[I]=V&67108863,V=Q*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 Q=(Y.words[I]|0)*19+V,W=Q&67108863;Q>>>=26,Y.words[I]=W,V=Q}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 Q=this.m.subn(1),W=0;while(!Q.isZero()&&Q.andln(1)===0)W++,Q.iushrn(1);K(!Q.isZero());var C=new $(1).toRed(this),z=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(z)!==0)J.redIAdd(z);var O=this.pow(J,Q),P=this.pow(Y,Q.addn(1).iushrn(1)),R=this.pow(Y,Q),_=W;while(R.cmp(C)!==0){var f=R;for(var p=0;f.cmp(C)!==0;p++)f=f.redSqr();K(p<_);var o=this.pow(O,new $(1).iushln(_-p-1));P=P.redMul(o),O=o.redSqr(),R=R.redMul(O),_=p}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,Q=Array(1<<I);Q[0]=new $(1).toRed(this),Q[1]=Y;for(var W=2;W<Q.length;W++)Q[W]=this.mul(Q[W-1],Y);var C=Q[0],z=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!==Q[0])C=this.sqr(C);if(R===0&&z===0){H=0;continue}if(z<<=1,z|=R,H++,H!==I&&(W!==0||P!==0))continue;C=this.mul(C,Q[z]),H=0,z=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),Q=I.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),W=I.isub(Q).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),Q=I.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),W=I.isub(Q).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)}),uF=$0((U)=>{var Z=uZ(),X=YU(),G=U;G.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
|
-
this._initNamed(entity);
|
|
14
|
-
})`)}catch(L){$=function(M){this._initNamed(M)}}return X($,F),$.prototype._initNamed=function(L){F.call(this,L)},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,$,L){return this._getDecoder($).decode(F,L)},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,$,L){return this._getEncoder($).encode(F,L)}}),bF=$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 G},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 L=this._reporterState;if(this.exitKey(K),L.obj!==null)L.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,L=K instanceof G;if(L)F=K;else F=new G($.path.map(function(M){return"["+JSON.stringify(M)+"]"}).join(""),K.message||K,K.stack);if(!$.options.partial)throw F;if(!L)$.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 G(K,F){this.path=K,this.rethrow(F)}Z(G,Error),G.prototype.rethrow=function(K){if(this.message=K+" at: "+(this.path||"(shallow)"),Error.captureStackTrace)Error.captureStackTrace(this,G);if(!this.stack)try{throw Error(this.message)}catch(F){this.stack=F.stack}return this}}),lQ=$0((U)=>{var Z=YU(),X=wZ().Reporter,G=(g1(),m0(N1)).Buffer;function K($,L){if(X.call(this,L),!G.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 L=new K(this.base);return L.offset=$.offset,L.length=this.offset,this.offset=$.offset,X.prototype.restore.call(this,$.reporter),L},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($,L){if(!(this.offset+$<=this.length))return this.error(L||"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($,L){if(Array.isArray($))this.length=0,this.value=$.map(function(M){if(!(M instanceof F))M=new F(M,L);return this.length+=M.length,M},this);else if(typeof $==="number"){if(!(0<=$&&$<=255))return L.error("non-byte EncoderBuffer value");this.value=$,this.length=1}else if(typeof $==="string")this.value=$,this.length=G.byteLength($);else if(G.isBuffer($))this.value=$,this.length=$.length;else return L.error("Unsupported type: "+typeof $)}U.EncoderBuffer=F,F.prototype.join=function($,L){if(!$)$=new G(this.length);if(!L)L=0;if(this.length===0)return $;if(Array.isArray(this.value))this.value.forEach(function(M){M.join($,L),L+=M.length});else{if(typeof this.value==="number")$[L]=this.value;else if(typeof this.value==="string")$.write(this.value,L);else if(G.isBuffer(this.value))this.value.copy($,L);L+=this.length}return $}}),dF=$0((U,Z)=>{var X=wZ().Reporter,G=wZ().EncoderBuffer,K=wZ().DecoderBuffer,F=pU(),$=["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"],L=["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 D(A,q){var S={};if(this._baseState=S,S.enc=A,S.parent=q||null,S.children=null,S.tag=null,S.args=null,S.reverseArgs=null,S.choice=null,S.optional=!1,S.any=!1,S.obj=!1,S.use=null,S.useDecoder=null,S.key=null,S.default=null,S.explicit=null,S.implicit=null,S.contains=null,!S.parent)S.children=[],this._wrap()}Z.exports=D;var T=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];D.prototype.clone=function(){var A=this._baseState,q={};T.forEach(function(E){q[E]=A[E]});var S=new this.constructor(q.parent);return S._baseState=q,S},D.prototype._wrap=function(){var A=this._baseState;L.forEach(function(q){this[q]=function(){var S=new this.constructor(this);return A.children.push(S),S[q].apply(S,arguments)}},this)},D.prototype._init=function(A){var q=this._baseState;F(q.parent===null),A.call(this),q.children=q.children.filter(function(S){return S._baseState.parent===this},this),F.equal(q.children.length,1,"Root node can have only one child")},D.prototype._useArgs=function(A){var q=this._baseState,S=A.filter(function(E){return E instanceof this.constructor},this);if(A=A.filter(function(E){return!(E instanceof this.constructor)},this),S.length!==0)F(q.children===null),q.children=S,S.forEach(function(E){E._baseState.parent=this},this);if(A.length!==0)F(q.args===null),q.args=A,q.reverseArgs=A.map(function(E){if(typeof E!=="object"||E.constructor!==Object)return E;var j={};return Object.keys(E).forEach(function(k){if(k==(k|0))k|=0;var B=E[k];j[B]=k}),j})},M.forEach(function(A){D.prototype[A]=function(){var q=this._baseState;throw Error(A+" not implemented for encoding: "+q.enc)}}),$.forEach(function(A){D.prototype[A]=function(){var q=this._baseState,S=Array.prototype.slice.call(arguments);return F(q.tag===null),q.tag=A,this._useArgs(S),this}}),D.prototype.use=function(A){F(A);var q=this._baseState;return F(q.use===null),q.use=A,this},D.prototype.optional=function(){var A=this._baseState;return A.optional=!0,this},D.prototype.def=function(A){var q=this._baseState;return F(q.default===null),q.default=A,q.optional=!0,this},D.prototype.explicit=function(A){var q=this._baseState;return F(q.explicit===null&&q.implicit===null),q.explicit=A,this},D.prototype.implicit=function(A){var q=this._baseState;return F(q.explicit===null&&q.implicit===null),q.implicit=A,this},D.prototype.obj=function(){var A=this._baseState,q=Array.prototype.slice.call(arguments);if(A.obj=!0,q.length!==0)this._useArgs(q);return this},D.prototype.key=function(A){var q=this._baseState;return F(q.key===null),q.key=A,this},D.prototype.any=function(){var A=this._baseState;return A.any=!0,this},D.prototype.choice=function(A){var q=this._baseState;return F(q.choice===null),q.choice=A,this._useArgs(Object.keys(A).map(function(S){return A[S]})),this},D.prototype.contains=function(A){var q=this._baseState;return F(q.use===null),q.contains=A,this},D.prototype._decode=function(A,q){var S=this._baseState;if(S.parent===null)return A.wrapResult(S.children[0]._decode(A,q));var E=S.default,j=!0,k=null;if(S.key!==null)k=A.enterKey(S.key);if(S.optional){var B=null;if(S.explicit!==null)B=S.explicit;else if(S.implicit!==null)B=S.implicit;else if(S.tag!==null)B=S.tag;if(B===null&&!S.any){var v=A.save();try{if(S.choice===null)this._decodeGeneric(S.tag,A,q);else this._decodeChoice(A,q);j=!0}catch(V0){j=!1}A.restore(v)}else if(j=this._peekTag(A,B,S.any),A.isError(j))return j}var x;if(S.obj&&j)x=A.enterObject();if(j){if(S.explicit!==null){var N=this._decodeTag(A,S.explicit);if(A.isError(N))return N;A=N}var w=A.offset;if(S.use===null&&S.choice===null){if(S.any)var v=A.save();var u=this._decodeTag(A,S.implicit!==null?S.implicit:S.tag,S.any);if(A.isError(u))return u;if(S.any)E=A.raw(v);else A=u}if(q&&q.track&&S.tag!==null)q.track(A.path(),w,A.length,"tagged");if(q&&q.track&&S.tag!==null)q.track(A.path(),A.offset,A.length,"content");if(S.any)E=E;else if(S.choice===null)E=this._decodeGeneric(S.tag,A,q);else E=this._decodeChoice(A,q);if(A.isError(E))return E;if(!S.any&&S.choice===null&&S.children!==null)S.children.forEach(function(V0){V0._decode(A,q)});if(S.contains&&(S.tag==="octstr"||S.tag==="bitstr")){var Z0=new K(E);E=this._getUse(S.contains,A._reporterState.obj)._decode(Z0,q)}}if(S.obj&&j)E=A.leaveObject(x);if(S.key!==null&&(E!==null||j===!0))A.leaveKey(k,S.key,E);else if(k!==null)A.exitKey(k);return E},D.prototype._decodeGeneric=function(A,q,S){var E=this._baseState;if(A==="seq"||A==="set")return null;if(A==="seqof"||A==="setof")return this._decodeList(q,A,E.args[0],S);else if(/str$/.test(A))return this._decodeStr(q,A,S);else if(A==="objid"&&E.args)return this._decodeObjid(q,E.args[0],E.args[1],S);else if(A==="objid")return this._decodeObjid(q,null,null,S);else if(A==="gentime"||A==="utctime")return this._decodeTime(q,A,S);else if(A==="null_")return this._decodeNull(q,S);else if(A==="bool")return this._decodeBool(q,S);else if(A==="objDesc")return this._decodeStr(q,A,S);else if(A==="int"||A==="enum")return this._decodeInt(q,E.args&&E.args[0],S);if(E.use!==null)return this._getUse(E.use,q._reporterState.obj)._decode(q,S);else return q.error("unknown tag: "+A)},D.prototype._getUse=function(A,q){var S=this._baseState;if(S.useDecoder=this._use(A,q),F(S.useDecoder._baseState.parent===null),S.useDecoder=S.useDecoder._baseState.children[0],S.implicit!==S.useDecoder._baseState.implicit)S.useDecoder=S.useDecoder.clone(),S.useDecoder._baseState.implicit=S.implicit;return S.useDecoder},D.prototype._decodeChoice=function(A,q){var S=this._baseState,E=null,j=!1;if(Object.keys(S.choice).some(function(k){var B=A.save(),v=S.choice[k];try{var x=v._decode(A,q);if(A.isError(x))return!1;E={type:k,value:x},j=!0}catch(N){return A.restore(B),!1}return!0},this),!j)return A.error("Choice not matched");return E},D.prototype._createEncoderBuffer=function(A){return new G(A,this.reporter)},D.prototype._encode=function(A,q,S){var E=this._baseState;if(E.default!==null&&E.default===A)return;var j=this._encodeValue(A,q,S);if(j===void 0)return;if(this._skipDefault(j,q,S))return;return j},D.prototype._encodeValue=function(A,q,S){var E=this._baseState;if(E.parent===null)return E.children[0]._encode(A,q||new X);var v=null;if(this.reporter=q,E.optional&&A===void 0)if(E.default!==null)A=E.default;else return;var j=null,k=!1;if(E.any)v=this._createEncoderBuffer(A);else if(E.choice)v=this._encodeChoice(A,q);else if(E.contains)j=this._getUse(E.contains,S)._encode(A,q),k=!0;else if(E.children)j=E.children.map(function(w){if(w._baseState.tag==="null_")return w._encode(null,q,A);if(w._baseState.key===null)return q.error("Child should have a key");var u=q.enterKey(w._baseState.key);if(typeof A!=="object")return q.error("Child expected, but input is not object");var Z0=w._encode(A[w._baseState.key],q,A);return q.leaveKey(u),Z0},this).filter(function(w){return w}),j=this._createEncoderBuffer(j);else if(E.tag==="seqof"||E.tag==="setof"){if(!(E.args&&E.args.length===1))return q.error("Too many args for : "+E.tag);if(!Array.isArray(A))return q.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,q)},B))}else if(E.use!==null)v=this._getUse(E.use,S)._encode(A,q);else j=this._encodePrimitive(E.tag,A),k=!0;var v;if(!E.any&&E.choice===null){var x=E.implicit!==null?E.implicit:E.tag,N=E.implicit===null?"universal":"context";if(x===null){if(E.use===null)q.error("Tag could be omitted only for .use()")}else if(E.use===null)v=this._encodeComposite(x,k,N,j)}if(E.explicit!==null)v=this._encodeComposite(E.explicit,!1,"context",v);return v},D.prototype._encodeChoice=function(A,q){var S=this._baseState,E=S.choice[A.type];if(!E)F(!1,A.type+" not found in "+JSON.stringify(Object.keys(S.choice)));return E._encode(A.value,q)},D.prototype._encodePrimitive=function(A,q){var S=this._baseState;if(/str$/.test(A))return this._encodeStr(q,A);else if(A==="objid"&&S.args)return this._encodeObjid(q,S.reverseArgs[0],S.args[1]);else if(A==="objid")return this._encodeObjid(q,null,null);else if(A==="gentime"||A==="utctime")return this._encodeTime(q,A);else if(A==="null_")return this._encodeNull();else if(A==="int"||A==="enum")return this._encodeInt(q,S.args&&S.reverseArgs[0]);else if(A==="bool")return this._encodeBool(q);else if(A==="objDesc")return this._encodeStr(q,A);else throw Error("Unsupported tag: "+A)},D.prototype._isNumstr=function(A){return/^[0-9 ]*$/.test(A)},D.prototype._isPrintstr=function(A){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(A)}}),wZ=$0((U)=>{var Z=U;Z.Reporter=bF().Reporter,Z.DecoderBuffer=lQ().DecoderBuffer,Z.EncoderBuffer=lQ().EncoderBuffer,Z.Node=dF()}),lF=$0((U)=>{var Z=KV();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)}),KV=$0((U)=>{var Z=U;Z._reverse=function(X){var G={};return Object.keys(X).forEach(function(K){if((K|0)==K)K=K|0;var F=X[K];G[F]=K}),G},Z.der=lF()}),WV=$0((U,Z)=>{var X=YU(),G=uZ(),K=G.base,F=G.bignum,$=G.constants.der;function L(A){this.enc="der",this.name=A.name,this.entity=A,this.tree=new M,this.tree._init(A.body)}Z.exports=L,L.prototype.decode=function(A,q){if(!(A instanceof K.DecoderBuffer))A=new K.DecoderBuffer(A,q);return this.tree._decode(A,q)};function M(A){K.Node.call(this,"der",A)}X(M,K.Node),M.prototype._peekTag=function(A,q,S){if(A.isEmpty())return!1;var E=A.save(),j=D(A,'Failed to peek tag: "'+q+'"');if(A.isError(j))return j;return A.restore(E),j.tag===q||j.tagStr===q||j.tagStr+"of"===q||S},M.prototype._decodeTag=function(A,q,S){var E=D(A,'Failed to decode tag of "'+q+'"');if(A.isError(E))return E;var j=T(A,E.primitive,'Failed to get length of "'+q+'"');if(A.isError(j))return j;if(!S&&E.tag!==q&&E.tagStr!==q&&E.tagStr+"of"!==q)return A.error('Failed to match tag: "'+q+'"');if(E.primitive||j!==null)return A.skip(j,'Failed to match body of: "'+q+'"');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: "'+q+'"')},M.prototype._skipUntilEnd=function(A,q){while(!0){var S=D(A,q);if(A.isError(S))return S;var E=T(A,S.primitive,q);if(A.isError(E))return E;var j;if(S.primitive||E!==null)j=A.skip(E);else j=this._skipUntilEnd(A,q);if(A.isError(j))return j;if(S.tagStr==="end")break}},M.prototype._decodeList=function(A,q,S,E){var j=[];while(!A.isEmpty()){var k=this._peekTag(A,"end");if(A.isError(k))return k;var B=S.decode(A,"der",E);if(A.isError(B)&&k)break;j.push(B)}return j},M.prototype._decodeStr=function(A,q){if(q==="bitstr"){var S=A.readUInt8();if(A.isError(S))return S;return{unused:S,data:A.raw()}}else if(q==="bmpstr"){var E=A.raw();if(E.length%2===1)return A.error("Decoding of string type: bmpstr length mismatch");var j="";for(var k=0;k<E.length/2;k++)j+=String.fromCharCode(E.readUInt16BE(k*2));return j}else if(q==="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(q==="octstr")return A.raw();else if(q==="objDesc")return A.raw();else if(q==="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(q))return A.raw().toString();else return A.error("Decoding of string type: "+q+" unsupported")},M.prototype._decodeObjid=function(A,q,S){var E,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(S)E=j;else E=[v,x].concat(j.slice(1));if(q){var N=q[E.join(" ")];if(N===void 0)N=q[E.join(".")];if(N!==void 0)E=N}return E},M.prototype._decodeTime=function(A,q){var S=A.raw().toString();if(q==="gentime")var E=S.slice(0,4)|0,j=S.slice(4,6)|0,k=S.slice(6,8)|0,B=S.slice(8,10)|0,v=S.slice(10,12)|0,x=S.slice(12,14)|0;else if(q==="utctime"){var E=S.slice(0,2)|0,j=S.slice(2,4)|0,k=S.slice(4,6)|0,B=S.slice(6,8)|0,v=S.slice(8,10)|0,x=S.slice(10,12)|0;if(E<70)E=2000+E;else E=1900+E}else return A.error("Decoding "+q+" time is not supported yet");return Date.UTC(E,j-1,k,B,v,x,0)},M.prototype._decodeNull=function(A){return null},M.prototype._decodeBool=function(A){var q=A.readUInt8();if(A.isError(q))return q;else return q!==0},M.prototype._decodeInt=function(A,q){var S=A.raw(),E=new F(S);if(q)E=q[E.toString(10)]||E;return E},M.prototype._use=function(A,q){if(typeof A==="function")A=A(q);return A._getDecoder("der").tree};function D(A,q){var S=A.readUInt8(q);if(A.isError(S))return S;var E=$.tagClass[S>>6],j=(S&32)===0;if((S&31)===31){var k=S;S=0;while((k&128)===128){if(k=A.readUInt8(q),A.isError(k))return k;S<<=7,S|=k&127}}else S&=31;var B=$.tag[S];return{cls:E,primitive:j,tag:S,tagStr:B}}function T(A,q,S){var E=A.readUInt8(S);if(A.isError(E))return E;if(!q&&E===128)return null;if((E&128)===0)return E;var j=E&127;if(j>4)return A.error("length octect is too long");E=0;for(var k=0;k<j;k++){E<<=8;var B=A.readUInt8(S);if(A.isError(B))return B;E|=B}return E}}),oF=$0((U,Z)=>{var X=YU(),G=(g1(),m0(N1)).Buffer,K=WV();function F($){K.call(this,$),this.enc="pem"}X(F,K),Z.exports=F,F.prototype.decode=function($,L){var M=$.toString().split(/[\r\n]+/g),D=L.label.toUpperCase(),T=/^-----(BEGIN|END) ([^-]+)-----$/,A=-1,q=-1;for(var S=0;S<M.length;S++){var E=M[S].match(T);if(E===null)continue;if(E[2]!==D)continue;if(A===-1){if(E[1]!=="BEGIN")break;A=S}else{if(E[1]!=="END")break;q=S;break}}if(A===-1||q===-1)throw Error("PEM section not found for: "+D);var j=M.slice(A+1,q).join("");j.replace(/[^a-z0-9\+\/=]+/gi,"");var k=new G(j,"base64");return K.prototype.decode.call(this,k,L)}}),nF=$0((U)=>{var Z=U;Z.der=WV(),Z.pem=oF()}),IV=$0((U,Z)=>{var X=YU(),G=(g1(),m0(N1)).Buffer,K=uZ(),F=K.base,$=K.constants.der;function L(A){this.enc="der",this.name=A.name,this.entity=A,this.tree=new M,this.tree._init(A.body)}Z.exports=L,L.prototype.encode=function(A,q){return this.tree._encode(A,q).join()};function M(A){F.Node.call(this,"der",A)}X(M,F.Node),M.prototype._encodeComposite=function(A,q,S,E){var j=T(A,q,S,this.reporter);if(E.length<128){var v=new G(2);return v[0]=j,v[1]=E.length,this._createEncoderBuffer([v,E])}var k=1;for(var B=E.length;B>=256;B>>=8)k++;var v=new G(2+k);v[0]=j,v[1]=128|k;for(var B=1+k,x=E.length;x>0;B--,x>>=8)v[B]=x&255;return this._createEncoderBuffer([v,E])},M.prototype._encodeStr=function(A,q){if(q==="bitstr")return this._createEncoderBuffer([A.unused|0,A.data]);else if(q==="bmpstr"){var S=new G(A.length*2);for(var E=0;E<A.length;E++)S.writeUInt16BE(A.charCodeAt(E),E*2);return this._createEncoderBuffer(S)}else if(q==="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(q==="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(q))return this._createEncoderBuffer(A);else if(q==="objDesc")return this._createEncoderBuffer(A);else return this.reporter.error("Encoding of string type: "+q+" unsupported")},M.prototype._encodeObjid=function(A,q,S){if(typeof A==="string"){if(!q)return this.reporter.error("string objid given, but no values map found");if(!q.hasOwnProperty(A))return this.reporter.error("objid not found in values map");A=q[A].split(/[\s\.]+/g);for(var E=0;E<A.length;E++)A[E]|=0}else if(Array.isArray(A)){A=A.slice();for(var E=0;E<A.length;E++)A[E]|=0}if(!Array.isArray(A))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(A));if(!S){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 E=0;E<A.length;E++){var k=A[E];for(j++;k>=128;k>>=7)j++}var B=new G(j),v=B.length-1;for(var E=A.length-1;E>=0;E--){var k=A[E];B[v--]=k&127;while((k>>=7)>0)B[v--]=128|k&127}return this._createEncoderBuffer(B)};function D(A){if(A<10)return"0"+A;else return A}M.prototype._encodeTime=function(A,q){var S,E=new Date(A);if(q==="gentime")S=[D(E.getFullYear()),D(E.getUTCMonth()+1),D(E.getUTCDate()),D(E.getUTCHours()),D(E.getUTCMinutes()),D(E.getUTCSeconds()),"Z"].join("");else if(q==="utctime")S=[D(E.getFullYear()%100),D(E.getUTCMonth()+1),D(E.getUTCDate()),D(E.getUTCHours()),D(E.getUTCMinutes()),D(E.getUTCSeconds()),"Z"].join("");else this.reporter.error("Encoding "+q+" time is not supported yet");return this._encodeStr(S,"octstr")},M.prototype._encodeNull=function(){return this._createEncoderBuffer("")},M.prototype._encodeInt=function(A,q){if(typeof A==="string"){if(!q)return this.reporter.error("String int or enum given, but no values map");if(!q.hasOwnProperty(A))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(A));A=q[A]}if(typeof A!=="number"&&!G.isBuffer(A)){var S=A.toArray();if(!A.sign&&S[0]&128)S.unshift(0);A=new G(S)}if(G.isBuffer(A)){var E=A.length;if(A.length===0)E++;var k=new G(E);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 E=1;for(var j=A;j>=256;j>>=8)E++;var k=Array(E);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 G(k))},M.prototype._encodeBool=function(A){return this._createEncoderBuffer(A?255:0)},M.prototype._use=function(A,q){if(typeof A==="function")A=A(q);return A._getEncoder("der").tree},M.prototype._skipDefault=function(A,q,S){var E=this._baseState,j;if(E.default===null)return!1;var k=A.join();if(E.defaultBuffer===void 0)E.defaultBuffer=this._encodeValue(E.default,q,S).join();if(k.length!==E.defaultBuffer.length)return!1;for(j=0;j<k.length;j++)if(k[j]!==E.defaultBuffer[j])return!1;return!0};function T(A,q,S,E){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 E.error("Unknown tag: "+A);if(j>=31)return E.error("Multi-octet tag encoding unsupported");if(!q)j|=32;return j|=$.tagClassByName[S||"universal"]<<6,j}}),mF=$0((U,Z)=>{var X=YU(),G=IV();function K(F){G.call(this,F),this.enc="pem"}X(K,G),Z.exports=K,K.prototype.encode=function(F,$){var L=G.prototype.encode.call(this,F),M=L.toString("base64"),D=["-----BEGIN "+$.label+"-----"];for(var T=0;T<M.length;T+=64)D.push(M.slice(T,T+64));return D.push("-----END "+$.label+"-----"),D.join(`
|
|
15
|
-
`)}}),sF=$0((U)=>{var Z=U;Z.der=IV(),Z.pem=mF()}),uZ=$0((U)=>{var Z=U;Z.bignum=hF(),Z.define=uF().define,Z.base=wZ(),Z.constants=KV(),Z.decoders=nF(),Z.encoders=sF()}),rF=$0((U,Z)=>{var X=uZ(),G=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())}),L=X.define("RelativeDistinguishedName",function(){this.setof(K)}),M=X.define("RDNSequence",function(){this.seqof(L)}),D=X.define("Name",function(){this.choice({rdnSequence:this.use(M)})}),T=X.define("Validity",function(){this.seq().obj(this.key("notBefore").use(G),this.key("notAfter").use(G))}),A=X.define("Extension",function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())}),q=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(D),this.key("validity").use(T),this.key("subject").use(D),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())}),S=X.define("X509Certificate",function(){this.seq().obj(this.key("tbsCertificate").use(q),this.key("signatureAlgorithm").use(F),this.key("signatureValue").bitstr())});Z.exports=S}),aF=$0((U)=>{var Z=uZ();U.certificate=rF();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 G=Z.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});U.RSAPublicKey=G;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 L=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=L;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 D=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(D),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())})}),tF=$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"}}),iF=$0((U,Z)=>{var X=m1().Buffer,G=rY().Transform,K=YU();function F(D){G.call(this),this._block=X.allocUnsafe(D),this._blockSize=D,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}K(F,G),F.prototype._transform=function(D,T,A){var q=null;try{this.update(D,T)}catch(S){q=S}A(q)},F.prototype._flush=function(D){var T=null;try{this.push(this.digest())}catch(A){T=A}D(T)};var $=typeof Uint8Array<"u",L=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&ArrayBuffer.isView&&(X.prototype instanceof Uint8Array||X.TYPED_ARRAY_SUPPORT);function M(D,T){if(D instanceof X)return D;if(typeof D==="string")return X.from(D,T);if(L&&ArrayBuffer.isView(D)){if(D.byteLength===0)return X.alloc(0);var A=X.from(D.buffer,D.byteOffset,D.byteLength);if(A.byteLength===D.byteLength)return A}if($&&D instanceof Uint8Array)return X.from(D);if(X.isBuffer(D)&&D.constructor&&typeof D.constructor.isBuffer==="function"&&D.constructor.isBuffer(D))return X.from(D);throw TypeError('The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView.')}F.prototype.update=function(D,T){if(this._finalized)throw Error("Digest already called");D=M(D,T);var A=this._block,q=0;while(this._blockOffset+D.length-q>=this._blockSize){for(var S=this._blockOffset;S<this._blockSize;)A[S++]=D[q++];this._update(),this._blockOffset=0}while(q<D.length)A[this._blockOffset++]=D[q++];for(var E=0,j=D.length*8;j>0;++E)if(this._length[E]+=j,j=this._length[E]/4294967296|0,j>0)this._length[E]-=4294967296*j;return this},F.prototype._update=function(){throw Error("_update is not implemented")},F.prototype.digest=function(D){if(this._finalized)throw Error("Digest already called");this._finalized=!0;var T=this._digest();if(D!==void 0)T=T.toString(D);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}),eF=$0((U,Z)=>{var X=YU(),G=iF(),K=m1().Buffer,F=Array(16);function $(){G.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}X($,G),$.prototype._update=function(){var q=F;for(var S=0;S<16;++S)q[S]=this._block.readInt32LE(S*4);var E=this._a,j=this._b,k=this._c,B=this._d;E=M(E,j,k,B,q[0],3614090360,7),B=M(B,E,j,k,q[1],3905402710,12),k=M(k,B,E,j,q[2],606105819,17),j=M(j,k,B,E,q[3],3250441966,22),E=M(E,j,k,B,q[4],4118548399,7),B=M(B,E,j,k,q[5],1200080426,12),k=M(k,B,E,j,q[6],2821735955,17),j=M(j,k,B,E,q[7],4249261313,22),E=M(E,j,k,B,q[8],1770035416,7),B=M(B,E,j,k,q[9],2336552879,12),k=M(k,B,E,j,q[10],4294925233,17),j=M(j,k,B,E,q[11],2304563134,22),E=M(E,j,k,B,q[12],1804603682,7),B=M(B,E,j,k,q[13],4254626195,12),k=M(k,B,E,j,q[14],2792965006,17),j=M(j,k,B,E,q[15],1236535329,22),E=D(E,j,k,B,q[1],4129170786,5),B=D(B,E,j,k,q[6],3225465664,9),k=D(k,B,E,j,q[11],643717713,14),j=D(j,k,B,E,q[0],3921069994,20),E=D(E,j,k,B,q[5],3593408605,5),B=D(B,E,j,k,q[10],38016083,9),k=D(k,B,E,j,q[15],3634488961,14),j=D(j,k,B,E,q[4],3889429448,20),E=D(E,j,k,B,q[9],568446438,5),B=D(B,E,j,k,q[14],3275163606,9),k=D(k,B,E,j,q[3],4107603335,14),j=D(j,k,B,E,q[8],1163531501,20),E=D(E,j,k,B,q[13],2850285829,5),B=D(B,E,j,k,q[2],4243563512,9),k=D(k,B,E,j,q[7],1735328473,14),j=D(j,k,B,E,q[12],2368359562,20),E=T(E,j,k,B,q[5],4294588738,4),B=T(B,E,j,k,q[8],2272392833,11),k=T(k,B,E,j,q[11],1839030562,16),j=T(j,k,B,E,q[14],4259657740,23),E=T(E,j,k,B,q[1],2763975236,4),B=T(B,E,j,k,q[4],1272893353,11),k=T(k,B,E,j,q[7],4139469664,16),j=T(j,k,B,E,q[10],3200236656,23),E=T(E,j,k,B,q[13],681279174,4),B=T(B,E,j,k,q[0],3936430074,11),k=T(k,B,E,j,q[3],3572445317,16),j=T(j,k,B,E,q[6],76029189,23),E=T(E,j,k,B,q[9],3654602809,4),B=T(B,E,j,k,q[12],3873151461,11),k=T(k,B,E,j,q[15],530742520,16),j=T(j,k,B,E,q[2],3299628645,23),E=A(E,j,k,B,q[0],4096336452,6),B=A(B,E,j,k,q[7],1126891415,10),k=A(k,B,E,j,q[14],2878612391,15),j=A(j,k,B,E,q[5],4237533241,21),E=A(E,j,k,B,q[12],1700485571,6),B=A(B,E,j,k,q[3],2399980690,10),k=A(k,B,E,j,q[10],4293915773,15),j=A(j,k,B,E,q[1],2240044497,21),E=A(E,j,k,B,q[8],1873313359,6),B=A(B,E,j,k,q[15],4264355552,10),k=A(k,B,E,j,q[6],2734768916,15),j=A(j,k,B,E,q[13],1309151649,21),E=A(E,j,k,B,q[4],4149444226,6),B=A(B,E,j,k,q[11],3174756917,10),k=A(k,B,E,j,q[2],718787259,15),j=A(j,k,B,E,q[9],3951481745,21),this._a=this._a+E|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 q=K.allocUnsafe(16);return q.writeInt32LE(this._a,0),q.writeInt32LE(this._b,4),q.writeInt32LE(this._c,8),q.writeInt32LE(this._d,12),q};function L(q,S){return q<<S|q>>>32-S}function M(q,S,E,j,k,B,v){return L(q+(S&E|~S&j)+k+B|0,v)+S|0}function D(q,S,E,j,k,B,v){return L(q+(S&j|E&~j)+k+B|0,v)+S|0}function T(q,S,E,j,k,B,v){return L(q+(S^E^j)+k+B|0,v)+S|0}function A(q,S,E,j,k,B,v){return L(q+(E^(S|~j))+k+B|0,v)+S|0}Z.exports=$}),UH=$0((U,Z)=>{var X=m1().Buffer,G=eF();function K(F,$,L,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 D=L/8,T=X.alloc(D),A=X.alloc(M||0),q=X.alloc(0);while(D>0||M>0){var S=new G;if(S.update(q),S.update(F),$)S.update($);q=S.digest();var E=0;if(D>0){var j=T.length-D;E=Math.min(D,q.length),q.copy(T,j,0,E),D-=E}if(E<q.length&&M>0){var k=A.length-M,B=Math.min(M,q.length-E);q.copy(A,k,E,E+B),M-=B}}return q.fill(0),{key:T,iv:A}}Z.exports=K}),FV=$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}),ZH=$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,G=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,K=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m,F=UH(),$=FV(),L=m1().Buffer;Z.exports=function(M,D){var T=M.toString(),A=T.match(X),q;if(!A){var S=T.match(K);q=L.from(S[2].replace(/[\r\n]/g,""),"base64")}else{var E="aes"+A[1],j=L.from(A[2],"hex"),k=L.from(A[3].replace(/[\r\n]/g,""),"base64"),B=F(D,j.slice(0,8),parseInt(A[1],10)).key,v=[],x=$.createDecipheriv(E,B,j);v.push(x.update(k)),v.push(x.final()),q=L.concat(v)}var N=T.match(G)[1];return{tag:N,data:q}}}),HV=$0((U,Z)=>{var X=aF(),G=tF(),K=ZH(),F=FV(),$=XV().pbkdf2Sync,L=m1().Buffer;function M(T,A){var q=T.algorithm.decrypt.kde.kdeparams.salt,S=parseInt(T.algorithm.decrypt.kde.kdeparams.iters.toString(),10),E=G[T.algorithm.decrypt.cipher.algo.join(".")],j=T.algorithm.decrypt.cipher.iv,k=T.subjectPrivateKey,B=parseInt(E.split("-")[1],10)/8,v=$(A,q,S,B,"sha1"),x=F.createDecipheriv(E,v,j),N=[];return N.push(x.update(k)),N.push(x.final()),L.concat(N)}function D(T){var A;if(typeof T==="object"&&!L.isBuffer(T))A=T.passphrase,T=T.key;if(typeof T==="string")T=L.from(T);var q=K(T,A),S=q.tag,E=q.data,j,k;switch(S){case"CERTIFICATE":k=X.certificate.decode(E,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":if(!k)k=X.PublicKey.decode(E,"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":E=X.EncryptedPrivateKey.decode(E,"der"),E=M(E,A);case"PRIVATE KEY":switch(k=X.PrivateKey.decode(E,"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(E,"der");case"RSA PRIVATE KEY":return X.RSAPrivateKey.decode(E,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:X.DSAPrivateKey.decode(E,"der")};case"EC PRIVATE KEY":return E=X.ECPrivateKey.decode(E,"der"),{curve:E.parameters.value,privateKey:E.privateKey};default:throw Error("unknown key type "+S)}}D.signature=X.signature,Z.exports=D}),OV=$0((U,Z)=>{var X=BX(),G=m1().Buffer;Z.exports=function(F,$){var L=G.alloc(0),M=0,D;while(L.length<$)D=K(M++),L=G.concat([L,X("sha1").update(F).update(D).digest()]);return L.slice(0,$)};function K(F){var $=G.allocUnsafe(4);return $.writeUInt32BE(F,0),$}}),CV=$0((U,Z)=>{Z.exports=function(X,G){var K=X.length,F=-1;while(++F<K)X[F]^=G[F];return X}}),GJ=$0((U,Z)=>{(function(X,G){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 G.BN=$;$.BN=$,$.wordSize=26;var L;try{if(typeof window<"u"&&typeof window.Buffer<"u")L=window.Buffer;else L=(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 Q=0;if(Y[0]==="-")Q++,this.negative=1;if(Q<Y.length){if(V===16)this._parseHex(Y,Q,I);else if(this._parseBase(Y,V,Q),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 Q=0;Q<this.length;Q++)this.words[Q]=0;var W,C,z=0;if(I==="be"){for(Q=Y.length-1,W=0;Q>=0;Q-=3)if(C=Y[Q]|Y[Q-1]<<8|Y[Q-2]<<16,this.words[W]|=C<<z&67108863,this.words[W+1]=C>>>26-z&67108863,z+=24,z>=26)z-=26,W++}else if(I==="le"){for(Q=0,W=0;Q<Y.length;Q+=3)if(C=Y[Q]|Y[Q+1]<<8|Y[Q+2]<<16,this.words[W]|=C<<z&67108863,this.words[W+1]=C>>>26-z&67108863,z+=24,z>=26)z-=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 D(Y,V,I){var Q=M(Y,I);if(I-1>=V)Q|=M(Y,I-1)<<4;return Q}$.prototype._parseHex=function(Y,V,I){this.length=Math.ceil((Y.length-V)/6),this.words=Array(this.length);for(var Q=0;Q<this.length;Q++)this.words[Q]=0;var W=0,C=0,z;if(I==="be")for(Q=Y.length-1;Q>=V;Q-=2)if(z=D(Y,V,Q)<<W,this.words[C]|=z&67108863,W>=18)W-=18,C+=1,this.words[C]|=z>>>26;else W+=8;else{var H=Y.length-V;for(Q=H%2===0?V+1:V;Q<Y.length;Q+=2)if(z=D(Y,V,Q)<<W,this.words[C]|=z&67108863,W>=18)W-=18,C+=1,this.words[C]|=z>>>26;else W+=8}this.strip()};function T(Y,V,I,Q){var W=0,C=Math.min(Y.length,I);for(var z=V;z<C;z++){var H=Y.charCodeAt(z)-48;if(W*=Q,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 Q=0,W=1;W<=67108863;W*=V)Q++;Q--,W=W/V|0;var C=Y.length-I,z=C%Q,H=Math.min(C,C-z)+I,J=0;for(var O=I;O<H;O+=Q)if(J=T(Y,O,O+Q,V),this.imuln(W),this.words[0]+J<67108864)this.words[0]+=J;else this._iaddn(J);if(z!==0){var P=1;J=T(Y,O,Y.length,V);for(O=0;O<z;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"],q=[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],S=[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 Q=0,W=0;for(var C=0;C<this.length;C++){var z=this.words[C],H=((z<<Q|W)&16777215).toString(16);if(W=z>>>24-Q&16777215,Q+=2,Q>=26)Q-=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=q[Y],O=S[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 L<"u"),this.toArrayLike(L,Y,V)},$.prototype.toArray=function(Y,V){return this.toArrayLike(Array,Y,V)},$.prototype.toArrayLike=function(Y,V,I){var Q=this.byteLength(),W=I||Math.max(1,Q);K(Q<=W,"byte array longer than desired length"),K(W>0,"Requested array length <= 0"),this.strip();var C=V==="le",z=new Y(W),H,J,O=this.clone();if(!C){for(J=0;J<W-Q;J++)z[J]=0;for(J=0;!O.isZero();J++)H=O.andln(255),O.iushrn(8),z[W-J-1]=H}else{for(J=0;!O.isZero();J++)H=O.andln(255),O.iushrn(8),z[J]=H;for(;J<W;J++)z[J]=0}return z},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 E(Y){var V=Array(Y.bitLength());for(var I=0;I<V.length;I++){var Q=I/26|0,W=I%26;V[I]=(Y.words[Q]&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 Q=0;Q<I.length;Q++)this.words[Q]=V.words[Q]^I.words[Q];if(this!==V)for(;Q<V.length;Q++)this.words[Q]=V.words[Q];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 Q=0;Q<V;Q++)this.words[Q]=~this.words[Q]&67108863;if(I>0)this.words[Q]=~this.words[Q]&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,Q=Y%26;if(this._expand(I+1),V)this.words[I]=this.words[I]|1<<Q;else this.words[I]=this.words[I]&~(1<<Q);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,Q;if(this.length>Y.length)I=this,Q=Y;else I=Y,Q=this;var W=0;for(var C=0;C<Q.length;C++)V=(I.words[C]|0)+(Q.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 Q,W;if(I>0)Q=this,W=Y;else Q=Y,W=this;var C=0;for(var z=0;z<W.length;z++)V=(Q.words[z]|0)-(W.words[z]|0)+C,C=V>>26,this.words[z]=V&67108863;for(;C!==0&&z<Q.length;z++)V=(Q.words[z]|0)+C,C=V>>26,this.words[z]=V&67108863;if(C===0&&z<Q.length&&Q!==this)for(;z<Q.length;z++)this.words[z]=Q.words[z];if(this.length=Math.max(this.length,z),Q!==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 Q=Y.length+V.length|0;I.length=Q,Q=Q-1|0;var W=Y.words[0]|0,C=V.words[0]|0,z=W*C,H=z&67108863,J=z/67108864|0;I.words[0]=H;for(var O=1;O<Q;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 p=O-f|0;W=Y.words[p]|0,C=V.words[f]|0,z=W*C+R,P+=z/67108864|0,R=z&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 Q=Y.words,W=V.words,C=I.words,z=0,H,J,O,P=Q[0]|0,R=P&8191,_=P>>>13,f=Q[1]|0,p=f&8191,o=f>>>13,K0=Q[2]|0,a=K0&8191,l=K0>>>13,G0=Q[3]|0,n=G0&8191,s=G0>>>13,f0=Q[4]|0,y=f0&8191,h=f0>>>13,Q0=Q[5]|0,t=Q0&8191,U0=Q0>>>13,q0=Q[6]|0,c=q0&8191,m=q0>>>13,g0=Q[7]|0,r=g0&8191,J0=g0>>>13,h0=Q[8]|0,H0=h0&8191,O0=h0>>>13,J1=Q[9]|0,I0=J1&8191,C0=J1>>>13,K1=W[0]|0,L0=K1&8191,D0=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,S0=h1>>>13,_1=W[4]|0,B0=_1&8191,x0=_1>>>13,B1=W[5]|0,E0=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,G1=W[8]|0,P0=G1&8191,N0=G1>>>13,u1=W[9]|0,k0=u1&8191,M0=u1>>>13;I.negative=Y.negative^V.negative,I.length=19,H=Math.imul(R,L0),J=Math.imul(R,D0),J=J+Math.imul(_,L0)|0,O=Math.imul(_,D0);var Q1=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(Q1>>>26)|0,Q1&=67108863,H=Math.imul(p,L0),J=Math.imul(p,D0),J=J+Math.imul(o,L0)|0,O=Math.imul(o,D0),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=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(l0>>>26)|0,l0&=67108863,H=Math.imul(a,L0),J=Math.imul(a,D0),J=J+Math.imul(l,L0)|0,O=Math.imul(l,D0),H=H+Math.imul(p,T0)|0,J=J+Math.imul(p,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=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(b0>>>26)|0,b0&=67108863,H=Math.imul(n,L0),J=Math.imul(n,D0),J=J+Math.imul(s,L0)|0,O=Math.imul(s,D0),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(p,v0)|0,J=J+Math.imul(p,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,S0)|0,J=J+Math.imul(_,_0)|0,O=O+Math.imul(_,S0)|0;var t0=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(t0>>>26)|0,t0&=67108863,H=Math.imul(y,L0),J=Math.imul(y,D0),J=J+Math.imul(h,L0)|0,O=Math.imul(h,D0),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(p,_0)|0,J=J+Math.imul(p,S0)|0,J=J+Math.imul(o,_0)|0,O=O+Math.imul(o,S0)|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=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(r0>>>26)|0,r0&=67108863,H=Math.imul(t,L0),J=Math.imul(t,D0),J=J+Math.imul(U0,L0)|0,O=Math.imul(U0,D0),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,S0)|0,J=J+Math.imul(l,_0)|0,O=O+Math.imul(l,S0)|0,H=H+Math.imul(p,B0)|0,J=J+Math.imul(p,x0)|0,J=J+Math.imul(o,B0)|0,O=O+Math.imul(o,x0)|0,H=H+Math.imul(R,E0)|0,J=J+Math.imul(R,g)|0,J=J+Math.imul(_,E0)|0,O=O+Math.imul(_,g)|0;var H1=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(H1>>>26)|0,H1&=67108863,H=Math.imul(c,L0),J=Math.imul(c,D0),J=J+Math.imul(m,L0)|0,O=Math.imul(m,D0),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,S0)|0,J=J+Math.imul(s,_0)|0,O=O+Math.imul(s,S0)|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(p,E0)|0,J=J+Math.imul(p,g)|0,J=J+Math.imul(o,E0)|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=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(O1>>>26)|0,O1&=67108863,H=Math.imul(r,L0),J=Math.imul(r,D0),J=J+Math.imul(J0,L0)|0,O=Math.imul(J0,D0),H=H+Math.imul(c,T0)|0,J=J+Math.imul(c,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,S0)|0,J=J+Math.imul(h,_0)|0,O=O+Math.imul(h,S0)|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,E0)|0,J=J+Math.imul(a,g)|0,J=J+Math.imul(l,E0)|0,O=O+Math.imul(l,g)|0,H=H+Math.imul(p,e)|0,J=J+Math.imul(p,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=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(C1>>>26)|0,C1&=67108863,H=Math.imul(H0,L0),J=Math.imul(H0,D0),J=J+Math.imul(O0,L0)|0,O=Math.imul(O0,D0),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(c,v0)|0,J=J+Math.imul(c,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,S0)|0,J=J+Math.imul(U0,_0)|0,O=O+Math.imul(U0,S0)|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,E0)|0,J=J+Math.imul(n,g)|0,J=J+Math.imul(s,E0)|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(p,F0)|0,J=J+Math.imul(p,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=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(A1>>>26)|0,A1&=67108863,H=Math.imul(I0,L0),J=Math.imul(I0,D0),J=J+Math.imul(C0,L0)|0,O=Math.imul(C0,D0),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(c,_0)|0,J=J+Math.imul(c,S0)|0,J=J+Math.imul(m,_0)|0,O=O+Math.imul(m,S0)|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,E0)|0,J=J+Math.imul(y,g)|0,J=J+Math.imul(h,E0)|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(p,P0)|0,J=J+Math.imul(p,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 D1=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(D1>>>26)|0,D1&=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,S0)|0,J=J+Math.imul(J0,_0)|0,O=O+Math.imul(J0,S0)|0,H=H+Math.imul(c,B0)|0,J=J+Math.imul(c,x0)|0,J=J+Math.imul(m,B0)|0,O=O+Math.imul(m,x0)|0,H=H+Math.imul(t,E0)|0,J=J+Math.imul(t,g)|0,J=J+Math.imul(U0,E0)|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(p,k0)|0,J=J+Math.imul(p,M0)|0,J=J+Math.imul(o,k0)|0,O=O+Math.imul(o,M0)|0;var z1=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(z1>>>26)|0,z1&=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,S0)|0,J=J+Math.imul(O0,_0)|0,O=O+Math.imul(O0,S0)|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(c,E0)|0,J=J+Math.imul(c,g)|0,J=J+Math.imul(m,E0)|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 L1=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(L1>>>26)|0,L1&=67108863,H=Math.imul(I0,_0),J=Math.imul(I0,S0),J=J+Math.imul(C0,_0)|0,O=Math.imul(C0,S0),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,E0)|0,J=J+Math.imul(r,g)|0,J=J+Math.imul(J0,E0)|0,O=O+Math.imul(J0,g)|0,H=H+Math.imul(c,e)|0,J=J+Math.imul(c,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=(z+H|0)+((J&8191)<<13)|0;z=(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,E0)|0,J=J+Math.imul(H0,g)|0,J=J+Math.imul(O0,E0)|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(c,F0)|0,J=J+Math.imul(c,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 q1=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(q1>>>26)|0,q1&=67108863,H=Math.imul(I0,E0),J=Math.imul(I0,g),J=J+Math.imul(C0,E0)|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(c,P0)|0,J=J+Math.imul(c,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=(z+H|0)+((J&8191)<<13)|0;z=(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(c,k0)|0,J=J+Math.imul(c,M0)|0,J=J+Math.imul(m,k0)|0,O=O+Math.imul(m,M0)|0;var R1=(z+H|0)+((J&8191)<<13)|0;z=(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 S1=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(S1>>>26)|0,S1&=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 E1=(z+H|0)+((J&8191)<<13)|0;z=(O+(J>>>13)|0)+(E1>>>26)|0,E1&=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=(z+H|0)+((J&8191)<<13)|0;if(z=(O+(J>>>13)|0)+(P1>>>26)|0,P1&=67108863,C[0]=Q1,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]=D1,C[10]=z1,C[11]=L1,C[12]=M1,C[13]=q1,C[14]=T1,C[15]=R1,C[16]=S1,C[17]=E1,C[18]=P1,z!==0)C[19]=z,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 Q=0,W=0;for(var C=0;C<I.length-1;C++){var z=W;W=0;var H=Q&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*_,p=f&67108863;z=z+(f/67108864|0)|0,p=p+H|0,H=p&67108863,z=z+(p>>>26)|0,W+=z>>>26,z&=67108863}I.words[C]=H,Q=z,z=W}if(Q!==0)I.words[C]=Q;else I.length--;return I.strip()}function v(Y,V,I){var Q=new x;return Q.mulp(Y,V,I)}$.prototype.mulTo=function(Y,V){var I,Q=this.length+Y.length;if(this.length===10&&Y.length===10)I=k(this,Y,V);else if(Q<63)I=j(this,Y,V);else if(Q<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 Q=0;Q<Y;Q++)V[Q]=this.revBin(Q,I,Y);return V},x.prototype.revBin=function(Y,V,I){if(Y===0||Y===I-1)return Y;var Q=0;for(var W=0;W<V;W++)Q|=(Y&1)<<V-W-1,Y>>=1;return Q},x.prototype.permute=function(Y,V,I,Q,W,C){for(var z=0;z<C;z++)Q[z]=V[Y[z]],W[z]=I[Y[z]]},x.prototype.transform=function(Y,V,I,Q,W,C){this.permute(C,Y,V,I,Q,W);for(var z=1;z<W;z<<=1){var H=z<<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<z;f++){var p=I[P+f],o=Q[P+f],K0=I[P+f+z],a=Q[P+f+z],l=R*K0-_*a;if(a=R*a+_*K0,K0=l,I[P+f]=p+K0,Q[P+f]=o+a,I[P+f+z]=p-K0,Q[P+f+z]=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,Q=I&1,W=0;for(I=I/2|0;I;I=I>>>1)W++;return 1<<W+1+Q},x.prototype.conjugate=function(Y,V,I){if(I<=1)return;for(var Q=0;Q<I/2;Q++){var W=Y[Q];Y[Q]=Y[I-Q-1],Y[I-Q-1]=W,W=V[Q],V[Q]=-V[I-Q-1],V[I-Q-1]=-W}},x.prototype.normalize13b=function(Y,V){var I=0;for(var Q=0;Q<V/2;Q++){var W=Math.round(Y[2*Q+1]/V)*8192+Math.round(Y[2*Q]/V)+I;if(Y[Q]=W&67108863,W<67108864)I=0;else I=W/67108864|0}return Y},x.prototype.convert13b=function(Y,V,I,Q){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<Q;++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 Q=2*this.guessLen13b(Y.length,V.length),W=this.makeRBT(Q),C=this.stub(Q),z=Array(Q),H=Array(Q),J=Array(Q),O=Array(Q),P=Array(Q),R=Array(Q),_=I.words;_.length=Q,this.convert13b(Y.words,Y.length,z,Q),this.convert13b(V.words,V.length,O,Q),this.transform(z,C,H,J,Q,W),this.transform(O,C,P,R,Q,W);for(var f=0;f<Q;f++){var p=H[f]*P[f]-J[f]*R[f];J[f]=H[f]*R[f]+J[f]*P[f],H[f]=p}return this.conjugate(H,J,Q),this.transform(H,J,_,C,Q,W),this.conjugate(_,C,Q),this.normalize13b(_,Q),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 Q=(this.words[I]|0)*Y,W=(Q&67108863)+(V&67108863);V>>=26,V+=Q/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=E(Y);if(V.length===0)return new $(1);var I=this;for(var Q=0;Q<V.length;Q++,I=I.sqr())if(V[Q]!==0)break;if(++Q<V.length)for(var W=I.sqr();Q<V.length;Q++,W=W.sqr()){if(V[Q]===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,Q=67108863>>>26-V<<26-V,W;if(V!==0){var C=0;for(W=0;W<this.length;W++){var z=this.words[W]&Q,H=(this.words[W]|0)-z<<V;this.words[W]=H|C,C=z>>>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 Q;if(V)Q=(V-V%26)/26;else Q=0;var W=Y%26,C=Math.min((Y-W)/26,this.length),z=67108863^67108863>>>W<<W,H=I;if(Q-=C,Q=Math.max(0,Q),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>=Q);J--){var P=this.words[J]|0;this.words[J]=O<<26-W|P>>>W,O=P&z}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,Q=1<<V;if(this.length<=I)return!1;var W=this.words[I];return!!(W&Q)},$.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 Q=67108863^67108863>>>V<<V;this.words[this.length-1]&=Q}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 Q=Y.length+I,W;this._expand(Q);var C,z=0;for(W=0;W<Y.length;W++){C=(this.words[W+I]|0)+z;var H=(Y.words[W]|0)*V;C-=H&67108863,z=(C>>26)-(H/67108864|0),this.words[W+I]=C&67108863}for(;W<this.length-I;W++)C=(this.words[W+I]|0)+z,z=C>>26,this.words[W+I]=C&67108863;if(z===0)return this.strip();K(z===-1),z=0;for(W=0;W<this.length;W++)C=-(this.words[W]|0)+z,z=C>>26,this.words[W]=C&67108863;return this.negative=1,this.strip()},$.prototype._wordDiv=function(Y,V){var I=this.length-Y.length,Q=this.clone(),W=Y,C=W.words[W.length-1]|0,z=this._countBits(C);if(I=26-z,I!==0)W=W.ushln(I),Q.iushln(I),C=W.words[W.length-1]|0;var H=Q.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=Q.clone()._ishlnsubmul(W,1,H);if(P.negative===0){if(Q=P,J)J.words[H]=1}for(var R=H-1;R>=0;R--){var _=(Q.words[W.length+R]|0)*67108864+(Q.words[W.length+R-1]|0);_=Math.min(_/C|0,67108863),Q._ishlnsubmul(W,_,R);while(Q.negative!==0)if(_--,Q.negative=0,Q._ishlnsubmul(W,1,R),!Q.isZero())Q.negative^=1;if(J)J.words[R]=_}if(J)J.strip();if(Q.strip(),V!=="div"&&I!==0)Q.iushrn(I);return{div:J||null,mod:Q}},$.prototype.divmod=function(Y,V,I){if(K(!Y.isZero()),this.isZero())return{div:new $(0),mod:new $(0)};var Q,W,C;if(this.negative!==0&&Y.negative===0){if(C=this.neg().divmod(Y,V),V!=="mod")Q=C.div.neg();if(V!=="div"){if(W=C.mod.neg(),I&&W.negative!==0)W.iadd(Y)}return{div:Q,mod:W}}if(this.negative===0&&Y.negative!==0){if(C=this.divmod(Y.neg(),V),V!=="mod")Q=C.div.neg();return{div:Q,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,Q=Y.ushrn(1),W=Y.andln(1),C=I.cmp(Q);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 Q=this.length-1;Q>=0;Q--)I=(V*I+(this.words[Q]|0))%Y;return I},$.prototype.idivn=function(Y){K(Y<=67108863);var V=0;for(var I=this.length-1;I>=0;I--){var Q=(this.words[I]|0)+V*67108864;this.words[I]=Q/Y|0,V=Q%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 Q=new $(1),W=new $(0),C=new $(0),z=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(Q.isOdd()||W.isOdd())Q.iadd(J),W.isub(O);Q.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()||z.isOdd())C.iadd(J),z.isub(O);C.iushrn(1),z.iushrn(1)}}if(V.cmp(I)>=0)V.isub(I),Q.isub(C),W.isub(z);else I.isub(V),C.isub(Q),z.isub(W)}return{a:C,b:z,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 Q=new $(1),W=new $(0),C=I.clone();while(V.cmpn(1)>0&&I.cmpn(1)>0){for(var z=0,H=1;(V.words[0]&H)===0&&z<26;++z,H<<=1);if(z>0){V.iushrn(z);while(z-- >0){if(Q.isOdd())Q.iadd(C);Q.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),Q.isub(W);else I.isub(V),W.isub(Q)}var P;if(V.cmpn(1)===0)P=Q;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 Q=0;V.isEven()&&I.isEven();Q++)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(Q)},$.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,Q=1<<V;if(this.length<=I)return this._expand(I+1),this.words[I]|=Q,this;var W=Q;for(var C=I;W!==0&&C<this.length;C++){var z=this.words[C]|0;z+=W,W=z>>>26,z&=67108863,this.words[C]=z}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 Q=this.words[0]|0;I=Q===Y?0:Q<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 Q=this.words[I]|0,W=Y.words[I]|0;if(Q===W)continue;if(Q<W)V=-1;else if(Q>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 Q=I<this.n?-1:V.ucmp(this.p);if(Q===0)V.words[0]=0,V.length=1;else if(Q>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,Q=Math.min(Y.length,9);for(var W=0;W<Q;W++)V.words[W]=Y.words[W];if(V.length=Q,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 z=Y.words[W]|0;Y.words[W-10]=(z&I)<<4|C>>>22,C=z}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 Q=Y.words[I]|0;V+=Q*977,Y.words[I]=V&67108863,V=Q*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 Q=(Y.words[I]|0)*19+V,W=Q&67108863;Q>>>=26,Y.words[I]=W,V=Q}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 Q=this.m.subn(1),W=0;while(!Q.isZero()&&Q.andln(1)===0)W++,Q.iushrn(1);K(!Q.isZero());var C=new $(1).toRed(this),z=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(z)!==0)J.redIAdd(z);var O=this.pow(J,Q),P=this.pow(Y,Q.addn(1).iushrn(1)),R=this.pow(Y,Q),_=W;while(R.cmp(C)!==0){var f=R;for(var p=0;f.cmp(C)!==0;p++)f=f.redSqr();K(p<_);var o=this.pow(O,new $(1).iushln(_-p-1));P=P.redMul(o),O=o.redSqr(),R=R.redMul(O),_=p}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,Q=Array(1<<I);Q[0]=new $(1).toRed(this),Q[1]=Y;for(var W=2;W<Q.length;W++)Q[W]=this.mul(Q[W-1],Y);var C=Q[0],z=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!==Q[0])C=this.sqr(C);if(R===0&&z===0){H=0;continue}if(z<<=1,z|=R,H++,H!==I&&(W!==0||P!==0))continue;C=this.mul(C,Q[z]),H=0,z=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),Q=I.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),W=I.isub(Q).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),Q=I.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),W=I.isub(Q).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)}),AV=$0((U,Z)=>{var X=GJ(),G=m1().Buffer;function K(F,$){return G.from(F.toRed(X.mont($.modulus)).redPow(new X($.publicExponent)).fromRed().toArray())}Z.exports=K}),XH=$0((U,Z)=>{(function(X,G){function K(Q,W){if(!Q)throw Error(W||"Assertion failed")}function F(Q,W){Q.super_=W;var C=function(){};C.prototype=W.prototype,Q.prototype=new C,Q.prototype.constructor=Q}function $(Q,W,C){if($.isBN(Q))return Q;if(this.negative=0,this.words=null,this.length=0,this.red=null,Q!==null){if(W==="le"||W==="be")C=W,W=10;this._init(Q||0,W||10,C||"be")}}if(typeof X==="object")X.exports=$;else G.BN=$;$.BN=$,$.wordSize=26;var L;try{if(typeof window<"u"&&typeof window.Buffer<"u")L=window.Buffer;else L=(g1(),m0(N1)).Buffer}catch(Q){}$.isBN=function(Q){if(Q instanceof $)return!0;return Q!==null&&typeof Q==="object"&&Q.constructor.wordSize===$.wordSize&&Array.isArray(Q.words)},$.max=function(Q,W){if(Q.cmp(W)>0)return Q;return W},$.min=function(Q,W){if(Q.cmp(W)<0)return Q;return W},$.prototype._init=function(Q,W,C){if(typeof Q==="number")return this._initNumber(Q,W,C);if(typeof Q==="object")return this._initArray(Q,W,C);if(W==="hex")W=16;K(W===(W|0)&&W>=2&&W<=36),Q=Q.toString().replace(/\s+/g,"");var z=0;if(Q[0]==="-")z++,this.negative=1;if(z<Q.length){if(W===16)this._parseHex(Q,z,C);else if(this._parseBase(Q,W,z),C==="le")this._initArray(this.toArray(),W,C)}},$.prototype._initNumber=function(Q,W,C){if(Q<0)this.negative=1,Q=-Q;if(Q<67108864)this.words=[Q&67108863],this.length=1;else if(Q<4503599627370496)this.words=[Q&67108863,Q/67108864&67108863],this.length=2;else K(Q<9007199254740992),this.words=[Q&67108863,Q/67108864&67108863,1],this.length=3;if(C!=="le")return;this._initArray(this.toArray(),W,C)},$.prototype._initArray=function(Q,W,C){if(K(typeof Q.length==="number"),Q.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(Q.length/3),this.words=Array(this.length);for(var z=0;z<this.length;z++)this.words[z]=0;var H,J,O=0;if(C==="be"){for(z=Q.length-1,H=0;z>=0;z-=3)if(J=Q[z]|Q[z-1]<<8|Q[z-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(z=0,H=0;z<Q.length;z+=3)if(J=Q[z]|Q[z+1]<<8|Q[z+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(Q,W){var C=Q.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 "+Q)}function D(Q,W,C){var z=M(Q,C);if(C-1>=W)z|=M(Q,C-1)<<4;return z}$.prototype._parseHex=function(Q,W,C){this.length=Math.ceil((Q.length-W)/6),this.words=Array(this.length);for(var z=0;z<this.length;z++)this.words[z]=0;var H=0,J=0,O;if(C==="be")for(z=Q.length-1;z>=W;z-=2)if(O=D(Q,W,z)<<H,this.words[J]|=O&67108863,H>=18)H-=18,J+=1,this.words[J]|=O>>>26;else H+=8;else{var P=Q.length-W;for(z=P%2===0?W+1:W;z<Q.length;z+=2)if(O=D(Q,W,z)<<H,this.words[J]|=O&67108863,H>=18)H-=18,J+=1,this.words[J]|=O>>>26;else H+=8}this._strip()};function T(Q,W,C,z){var H=0,J=0,O=Math.min(Q.length,C);for(var P=W;P<O;P++){var R=Q.charCodeAt(P)-48;if(H*=z,R>=49)J=R-49+10;else if(R>=17)J=R-17+10;else J=R;K(R>=0&&J<z,"Invalid character"),H+=J}return H}$.prototype._parseBase=function(Q,W,C){this.words=[0],this.length=1;for(var z=0,H=1;H<=67108863;H*=W)z++;z--,H=H/W|0;var J=Q.length-C,O=J%z,P=Math.min(J,J-O)+C,R=0;for(var _=C;_<P;_+=z)if(R=T(Q,_,_+z,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(Q,_,Q.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(Q){Q.words=Array(this.length);for(var W=0;W<this.length;W++)Q.words[W]=this.words[W];Q.length=this.length,Q.negative=this.negative,Q.red=this.red};function A(Q,W){Q.words=W.words,Q.length=W.length,Q.negative=W.negative,Q.red=W.red}if($.prototype._move=function(Q){A(Q,this)},$.prototype.clone=function(){var Q=new $(null);return this.copy(Q),Q},$.prototype._expand=function(Q){while(this.length<Q)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")]=q}catch(Q){$.prototype.inspect=q}else $.prototype.inspect=q;function q(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var S=["","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"],E=[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(Q,W){Q=Q||10,W=W|0||1;var C;if(Q===16||Q==="hex"){C="";var z=0,H=0;for(var J=0;J<this.length;J++){var O=this.words[J],P=((O<<z|H)&16777215).toString(16);if(H=O>>>24-z&16777215,z+=2,z>=26)z-=26,J--;if(H!==0||J!==this.length-1)C=S[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(Q===(Q|0)&&Q>=2&&Q<=36){var R=E[Q],_=j[Q];C="";var f=this.clone();f.negative=0;while(!f.isZero()){var p=f.modrn(_).toString(Q);if(f=f.idivn(_),!f.isZero())C=S[R-p.length]+p+C;else C=p+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 Q=this.words[0];if(this.length===2)Q+=this.words[1]*67108864;else if(this.length===3&&this.words[2]===1)Q+=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?-Q:Q},$.prototype.toJSON=function(){return this.toString(16,2)},L)$.prototype.toBuffer=function(Q,W){return this.toArrayLike(L,Q,W)};$.prototype.toArray=function(Q,W){return this.toArrayLike(Array,Q,W)};var k=function(Q,W){if(Q.allocUnsafe)return Q.allocUnsafe(W);return new Q(W)};if($.prototype.toArrayLike=function(Q,W,C){this._strip();var z=this.byteLength(),H=C||Math.max(1,z);K(z<=H,"byte array longer than desired length"),K(H>0,"Requested array length <= 0");var J=k(Q,H),O=W==="le"?"LE":"BE";return this["_toArrayLike"+O](J,z),J},$.prototype._toArrayLikeLE=function(Q,W){var C=0,z=0;for(var H=0,J=0;H<this.length;H++){var O=this.words[H]<<J|z;if(Q[C++]=O&255,C<Q.length)Q[C++]=O>>8&255;if(C<Q.length)Q[C++]=O>>16&255;if(J===6){if(C<Q.length)Q[C++]=O>>24&255;z=0,J=0}else z=O>>>24,J+=2}if(C<Q.length){Q[C++]=z;while(C<Q.length)Q[C++]=0}},$.prototype._toArrayLikeBE=function(Q,W){var C=Q.length-1,z=0;for(var H=0,J=0;H<this.length;H++){var O=this.words[H]<<J|z;if(Q[C--]=O&255,C>=0)Q[C--]=O>>8&255;if(C>=0)Q[C--]=O>>16&255;if(J===6){if(C>=0)Q[C--]=O>>24&255;z=0,J=0}else z=O>>>24,J+=2}if(C>=0){Q[C--]=z;while(C>=0)Q[C--]=0}},Math.clz32)$.prototype._countBits=function(Q){return 32-Math.clz32(Q)};else $.prototype._countBits=function(Q){var W=Q,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(Q){if(Q===0)return 26;var W=Q,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 Q=this.words[this.length-1],W=this._countBits(Q);return(this.length-1)*26+W};function B(Q){var W=Array(Q.bitLength());for(var C=0;C<W.length;C++){var z=C/26|0,H=C%26;W[C]=Q.words[z]>>>H&1}return W}$.prototype.zeroBits=function(){if(this.isZero())return 0;var Q=0;for(var W=0;W<this.length;W++){var C=this._zeroBits(this.words[W]);if(Q+=C,C!==26)break}return Q},$.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},$.prototype.toTwos=function(Q){if(this.negative!==0)return this.abs().inotn(Q).iaddn(1);return this.clone()},$.prototype.fromTwos=function(Q){if(this.testn(Q-1))return this.notn(Q).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(Q){while(this.length<Q.length)this.words[this.length++]=0;for(var W=0;W<Q.length;W++)this.words[W]=this.words[W]|Q.words[W];return this._strip()},$.prototype.ior=function(Q){return K((this.negative|Q.negative)===0),this.iuor(Q)},$.prototype.or=function(Q){if(this.length>Q.length)return this.clone().ior(Q);return Q.clone().ior(this)},$.prototype.uor=function(Q){if(this.length>Q.length)return this.clone().iuor(Q);return Q.clone().iuor(this)},$.prototype.iuand=function(Q){var W;if(this.length>Q.length)W=Q;else W=this;for(var C=0;C<W.length;C++)this.words[C]=this.words[C]&Q.words[C];return this.length=W.length,this._strip()},$.prototype.iand=function(Q){return K((this.negative|Q.negative)===0),this.iuand(Q)},$.prototype.and=function(Q){if(this.length>Q.length)return this.clone().iand(Q);return Q.clone().iand(this)},$.prototype.uand=function(Q){if(this.length>Q.length)return this.clone().iuand(Q);return Q.clone().iuand(this)},$.prototype.iuxor=function(Q){var W,C;if(this.length>Q.length)W=this,C=Q;else W=Q,C=this;for(var z=0;z<C.length;z++)this.words[z]=W.words[z]^C.words[z];if(this!==W)for(;z<W.length;z++)this.words[z]=W.words[z];return this.length=W.length,this._strip()},$.prototype.ixor=function(Q){return K((this.negative|Q.negative)===0),this.iuxor(Q)},$.prototype.xor=function(Q){if(this.length>Q.length)return this.clone().ixor(Q);return Q.clone().ixor(this)},$.prototype.uxor=function(Q){if(this.length>Q.length)return this.clone().iuxor(Q);return Q.clone().iuxor(this)},$.prototype.inotn=function(Q){K(typeof Q==="number"&&Q>=0);var W=Math.ceil(Q/26)|0,C=Q%26;if(this._expand(W),C>0)W--;for(var z=0;z<W;z++)this.words[z]=~this.words[z]&67108863;if(C>0)this.words[z]=~this.words[z]&67108863>>26-C;return this._strip()},$.prototype.notn=function(Q){return this.clone().inotn(Q)},$.prototype.setn=function(Q,W){K(typeof Q==="number"&&Q>=0);var C=Q/26|0,z=Q%26;if(this._expand(C+1),W)this.words[C]=this.words[C]|1<<z;else this.words[C]=this.words[C]&~(1<<z);return this._strip()},$.prototype.iadd=function(Q){var W;if(this.negative!==0&&Q.negative===0)return this.negative=0,W=this.isub(Q),this.negative^=1,this._normSign();else if(this.negative===0&&Q.negative!==0)return Q.negative=0,W=this.isub(Q),Q.negative=1,W._normSign();var C,z;if(this.length>Q.length)C=this,z=Q;else C=Q,z=this;var H=0;for(var J=0;J<z.length;J++)W=(C.words[J]|0)+(z.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(Q){var W;if(Q.negative!==0&&this.negative===0)return Q.negative=0,W=this.sub(Q),Q.negative^=1,W;else if(Q.negative===0&&this.negative!==0)return this.negative=0,W=Q.sub(this),this.negative=1,W;if(this.length>Q.length)return this.clone().iadd(Q);return Q.clone().iadd(this)},$.prototype.isub=function(Q){if(Q.negative!==0){Q.negative=0;var W=this.iadd(Q);return Q.negative=1,W._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(Q),this.negative=1,this._normSign();var C=this.cmp(Q);if(C===0)return this.negative=0,this.length=1,this.words[0]=0,this;var z,H;if(C>0)z=this,H=Q;else z=Q,H=this;var J=0;for(var O=0;O<H.length;O++)W=(z.words[O]|0)-(H.words[O]|0)+J,J=W>>26,this.words[O]=W&67108863;for(;J!==0&&O<z.length;O++)W=(z.words[O]|0)+J,J=W>>26,this.words[O]=W&67108863;if(J===0&&O<z.length&&z!==this)for(;O<z.length;O++)this.words[O]=z.words[O];if(this.length=Math.max(this.length,O),z!==this)this.negative=1;return this._strip()},$.prototype.sub=function(Q){return this.clone().isub(Q)};function v(Q,W,C){C.negative=W.negative^Q.negative;var z=Q.length+W.length|0;C.length=z,z=z-1|0;var H=Q.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;_<z;_++){var f=R>>>26,p=R&67108863,o=Math.min(_,W.length-1);for(var K0=Math.max(0,_-Q.length+1);K0<=o;K0++){var a=_-K0|0;H=Q.words[a]|0,J=W.words[K0]|0,O=H*J+p,f+=O/67108864|0,p=O&67108863}C.words[_]=p|0,R=f|0}if(R!==0)C.words[_]=R|0;else C.length--;return C._strip()}var x=function(Q,W,C){var z=Q.words,H=W.words,J=C.words,O=0,P,R,_,f=z[0]|0,p=f&8191,o=f>>>13,K0=z[1]|0,a=K0&8191,l=K0>>>13,G0=z[2]|0,n=G0&8191,s=G0>>>13,f0=z[3]|0,y=f0&8191,h=f0>>>13,Q0=z[4]|0,t=Q0&8191,U0=Q0>>>13,q0=z[5]|0,c=q0&8191,m=q0>>>13,g0=z[6]|0,r=g0&8191,J0=g0>>>13,h0=z[7]|0,H0=h0&8191,O0=h0>>>13,J1=z[8]|0,I0=J1&8191,C0=J1>>>13,K1=z[9]|0,L0=K1&8191,D0=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,S0=h1>>>13,_1=H[3]|0,B0=_1&8191,x0=_1>>>13,B1=H[4]|0,E0=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,G1=H[7]|0,P0=G1&8191,N0=G1>>>13,u1=H[8]|0,k0=u1&8191,M0=u1>>>13,Q1=H[9]|0,l0=Q1&8191,b0=Q1>>>13;C.negative=Q.negative^W.negative,C.length=19,P=Math.imul(p,T0),R=Math.imul(p,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(p,v0)|0,R=R+Math.imul(p,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(p,_0)|0,R=R+Math.imul(p,S0)|0,R=R+Math.imul(o,_0)|0,_=_+Math.imul(o,S0)|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,S0)|0,R=R+Math.imul(l,_0)|0,_=_+Math.imul(l,S0)|0,P=P+Math.imul(p,B0)|0,R=R+Math.imul(p,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,S0)|0,R=R+Math.imul(s,_0)|0,_=_+Math.imul(s,S0)|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(p,E0)|0,R=R+Math.imul(p,g)|0,R=R+Math.imul(o,E0)|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(c,T0),R=Math.imul(c,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,S0)|0,R=R+Math.imul(h,_0)|0,_=_+Math.imul(h,S0)|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,E0)|0,R=R+Math.imul(a,g)|0,R=R+Math.imul(l,E0)|0,_=_+Math.imul(l,g)|0,P=P+Math.imul(p,e)|0,R=R+Math.imul(p,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(c,v0)|0,R=R+Math.imul(c,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,S0)|0,R=R+Math.imul(U0,_0)|0,_=_+Math.imul(U0,S0)|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,E0)|0,R=R+Math.imul(n,g)|0,R=R+Math.imul(s,E0)|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(p,F0)|0,R=R+Math.imul(p,A0)|0,R=R+Math.imul(o,F0)|0,_=_+Math.imul(o,A0)|0;var D1=(O+P|0)+((R&8191)<<13)|0;O=(_+(R>>>13)|0)+(D1>>>26)|0,D1&=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(c,_0)|0,R=R+Math.imul(c,S0)|0,R=R+Math.imul(m,_0)|0,_=_+Math.imul(m,S0)|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,E0)|0,R=R+Math.imul(y,g)|0,R=R+Math.imul(h,E0)|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(p,P0)|0,R=R+Math.imul(p,N0)|0,R=R+Math.imul(o,P0)|0,_=_+Math.imul(o,N0)|0;var z1=(O+P|0)+((R&8191)<<13)|0;O=(_+(R>>>13)|0)+(z1>>>26)|0,z1&=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,S0)|0,R=R+Math.imul(J0,_0)|0,_=_+Math.imul(J0,S0)|0,P=P+Math.imul(c,B0)|0,R=R+Math.imul(c,x0)|0,R=R+Math.imul(m,B0)|0,_=_+Math.imul(m,x0)|0,P=P+Math.imul(t,E0)|0,R=R+Math.imul(t,g)|0,R=R+Math.imul(U0,E0)|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(p,k0)|0,R=R+Math.imul(p,M0)|0,R=R+Math.imul(o,k0)|0,_=_+Math.imul(o,M0)|0;var L1=(O+P|0)+((R&8191)<<13)|0;O=(_+(R>>>13)|0)+(L1>>>26)|0,L1&=67108863,P=Math.imul(L0,T0),R=Math.imul(L0,j0),R=R+Math.imul(D0,T0)|0,_=Math.imul(D0,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,S0)|0,R=R+Math.imul(O0,_0)|0,_=_+Math.imul(O0,S0)|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(c,E0)|0,R=R+Math.imul(c,g)|0,R=R+Math.imul(m,E0)|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(p,l0)|0,R=R+Math.imul(p,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(L0,v0),R=Math.imul(L0,R0),R=R+Math.imul(D0,v0)|0,_=Math.imul(D0,R0),P=P+Math.imul(I0,_0)|0,R=R+Math.imul(I0,S0)|0,R=R+Math.imul(C0,_0)|0,_=_+Math.imul(C0,S0)|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,E0)|0,R=R+Math.imul(r,g)|0,R=R+Math.imul(J0,E0)|0,_=_+Math.imul(J0,g)|0,P=P+Math.imul(c,e)|0,R=R+Math.imul(c,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 q1=(O+P|0)+((R&8191)<<13)|0;O=(_+(R>>>13)|0)+(q1>>>26)|0,q1&=67108863,P=Math.imul(L0,_0),R=Math.imul(L0,S0),R=R+Math.imul(D0,_0)|0,_=Math.imul(D0,S0),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,E0)|0,R=R+Math.imul(H0,g)|0,R=R+Math.imul(O0,E0)|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(c,F0)|0,R=R+Math.imul(c,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(L0,B0),R=Math.imul(L0,x0),R=R+Math.imul(D0,B0)|0,_=Math.imul(D0,x0),P=P+Math.imul(I0,E0)|0,R=R+Math.imul(I0,g)|0,R=R+Math.imul(C0,E0)|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(c,P0)|0,R=R+Math.imul(c,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(L0,E0),R=Math.imul(L0,g),R=R+Math.imul(D0,E0)|0,_=Math.imul(D0,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(c,k0)|0,R=R+Math.imul(c,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 S1=(O+P|0)+((R&8191)<<13)|0;O=(_+(R>>>13)|0)+(S1>>>26)|0,S1&=67108863,P=Math.imul(L0,e),R=Math.imul(L0,X0),R=R+Math.imul(D0,e)|0,_=Math.imul(D0,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(c,l0)|0,R=R+Math.imul(c,b0)|0,R=R+Math.imul(m,l0)|0,_=_+Math.imul(m,b0)|0;var E1=(O+P|0)+((R&8191)<<13)|0;O=(_+(R>>>13)|0)+(E1>>>26)|0,E1&=67108863,P=Math.imul(L0,F0),R=Math.imul(L0,A0),R=R+Math.imul(D0,F0)|0,_=Math.imul(D0,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(L0,P0),R=Math.imul(L0,N0),R=R+Math.imul(D0,P0)|0,_=Math.imul(D0,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 FY=(O+P|0)+((R&8191)<<13)|0;O=(_+(R>>>13)|0)+(FY>>>26)|0,FY&=67108863,P=Math.imul(L0,k0),R=Math.imul(L0,M0),R=R+Math.imul(D0,k0)|0,_=Math.imul(D0,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 HY=(O+P|0)+((R&8191)<<13)|0;O=(_+(R>>>13)|0)+(HY>>>26)|0,HY&=67108863,P=Math.imul(L0,l0),R=Math.imul(L0,b0),R=R+Math.imul(D0,l0)|0,_=Math.imul(D0,b0);var OY=(O+P|0)+((R&8191)<<13)|0;if(O=(_+(R>>>13)|0)+(OY>>>26)|0,OY&=67108863,J[0]=t0,J[1]=r0,J[2]=H1,J[3]=O1,J[4]=C1,J[5]=A1,J[6]=D1,J[7]=z1,J[8]=L1,J[9]=M1,J[10]=q1,J[11]=T1,J[12]=R1,J[13]=S1,J[14]=E1,J[15]=P1,J[16]=FY,J[17]=HY,J[18]=OY,O!==0)J[19]=O,C.length++;return C};if(!Math.imul)x=v;function N(Q,W,C){C.negative=W.negative^Q.negative,C.length=Q.length+W.length;var z=0,H=0;for(var J=0;J<C.length-1;J++){var O=H;H=0;var P=z&67108863,R=Math.min(J,W.length-1);for(var _=Math.max(0,J-Q.length+1);_<=R;_++){var f=J-_,p=Q.words[f]|0,o=W.words[_]|0,K0=p*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,z=O,O=H}if(z!==0)C.words[J]=z;else C.length--;return C._strip()}function w(Q,W,C){return N(Q,W,C)}$.prototype.mulTo=function(Q,W){var C,z=this.length+Q.length;if(this.length===10&&Q.length===10)C=x(this,Q,W);else if(z<63)C=v(this,Q,W);else if(z<1024)C=N(this,Q,W);else C=w(this,Q,W);return C};function u(Q,W){this.x=Q,this.y=W}u.prototype.makeRBT=function(Q){var W=Array(Q),C=$.prototype._countBits(Q)-1;for(var z=0;z<Q;z++)W[z]=this.revBin(z,C,Q);return W},u.prototype.revBin=function(Q,W,C){if(Q===0||Q===C-1)return Q;var z=0;for(var H=0;H<W;H++)z|=(Q&1)<<W-H-1,Q>>=1;return z},u.prototype.permute=function(Q,W,C,z,H,J){for(var O=0;O<J;O++)z[O]=W[Q[O]],H[O]=C[Q[O]]},u.prototype.transform=function(Q,W,C,z,H,J){this.permute(J,Q,W,C,z,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 p=R,o=_;for(var K0=0;K0<O;K0++){var a=C[f+K0],l=z[f+K0],G0=C[f+K0+O],n=z[f+K0+O],s=p*G0-o*n;if(n=p*n+o*G0,G0=s,C[f+K0]=a+G0,z[f+K0]=l+n,C[f+K0+O]=a-G0,z[f+K0+O]=l-n,K0!==P)s=R*p-_*o,o=R*o+_*p,p=s}}}},u.prototype.guessLen13b=function(Q,W){var C=Math.max(W,Q)|1,z=C&1,H=0;for(C=C/2|0;C;C=C>>>1)H++;return 1<<H+1+z},u.prototype.conjugate=function(Q,W,C){if(C<=1)return;for(var z=0;z<C/2;z++){var H=Q[z];Q[z]=Q[C-z-1],Q[C-z-1]=H,H=W[z],W[z]=-W[C-z-1],W[C-z-1]=-H}},u.prototype.normalize13b=function(Q,W){var C=0;for(var z=0;z<W/2;z++){var H=Math.round(Q[2*z+1]/W)*8192+Math.round(Q[2*z]/W)+C;if(Q[z]=H&67108863,H<67108864)C=0;else C=H/67108864|0}return Q},u.prototype.convert13b=function(Q,W,C,z){var H=0;for(var J=0;J<W;J++)H=H+(Q[J]|0),C[2*J]=H&8191,H=H>>>13,C[2*J+1]=H&8191,H=H>>>13;for(J=2*W;J<z;++J)C[J]=0;K(H===0),K((H&-8192)===0)},u.prototype.stub=function(Q){var W=Array(Q);for(var C=0;C<Q;C++)W[C]=0;return W},u.prototype.mulp=function(Q,W,C){var z=2*this.guessLen13b(Q.length,W.length),H=this.makeRBT(z),J=this.stub(z),O=Array(z),P=Array(z),R=Array(z),_=Array(z),f=Array(z),p=Array(z),o=C.words;o.length=z,this.convert13b(Q.words,Q.length,O,z),this.convert13b(W.words,W.length,_,z),this.transform(O,J,P,R,z,H),this.transform(_,J,f,p,z,H);for(var K0=0;K0<z;K0++){var a=P[K0]*f[K0]-R[K0]*p[K0];R[K0]=P[K0]*p[K0]+R[K0]*f[K0],P[K0]=a}return this.conjugate(P,R,z),this.transform(P,R,o,J,z,H),this.conjugate(o,J,z),this.normalize13b(o,z),C.negative=Q.negative^W.negative,C.length=Q.length+W.length,C._strip()},$.prototype.mul=function(Q){var W=new $(null);return W.words=Array(this.length+Q.length),this.mulTo(Q,W)},$.prototype.mulf=function(Q){var W=new $(null);return W.words=Array(this.length+Q.length),w(this,Q,W)},$.prototype.imul=function(Q){return this.clone().mulTo(Q,this)},$.prototype.imuln=function(Q){var W=Q<0;if(W)Q=-Q;K(typeof Q==="number"),K(Q<67108864);var C=0;for(var z=0;z<this.length;z++){var H=(this.words[z]|0)*Q,J=(H&67108863)+(C&67108863);C>>=26,C+=H/67108864|0,C+=J>>>26,this.words[z]=J&67108863}if(C!==0)this.words[z]=C,this.length++;return this.length=Q===0?1:this.length,W?this.ineg():this},$.prototype.muln=function(Q){return this.clone().imuln(Q)},$.prototype.sqr=function(){return this.mul(this)},$.prototype.isqr=function(){return this.imul(this.clone())},$.prototype.pow=function(Q){var W=B(Q);if(W.length===0)return new $(1);var C=this;for(var z=0;z<W.length;z++,C=C.sqr())if(W[z]!==0)break;if(++z<W.length)for(var H=C.sqr();z<W.length;z++,H=H.sqr()){if(W[z]===0)continue;C=C.mul(H)}return C},$.prototype.iushln=function(Q){K(typeof Q==="number"&&Q>=0);var W=Q%26,C=(Q-W)/26,z=67108863>>>26-W<<26-W,H;if(W!==0){var J=0;for(H=0;H<this.length;H++){var O=this.words[H]&z,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(Q){return K(this.negative===0),this.iushln(Q)},$.prototype.iushrn=function(Q,W,C){K(typeof Q==="number"&&Q>=0);var z;if(W)z=(W-W%26)/26;else z=0;var H=Q%26,J=Math.min((Q-H)/26,this.length),O=67108863^67108863>>>H<<H,P=C;if(z-=J,z=Math.max(0,z),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>=z);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(Q,W,C){return K(this.negative===0),this.iushrn(Q,W,C)},$.prototype.shln=function(Q){return this.clone().ishln(Q)},$.prototype.ushln=function(Q){return this.clone().iushln(Q)},$.prototype.shrn=function(Q){return this.clone().ishrn(Q)},$.prototype.ushrn=function(Q){return this.clone().iushrn(Q)},$.prototype.testn=function(Q){K(typeof Q==="number"&&Q>=0);var W=Q%26,C=(Q-W)/26,z=1<<W;if(this.length<=C)return!1;var H=this.words[C];return!!(H&z)},$.prototype.imaskn=function(Q){K(typeof Q==="number"&&Q>=0);var W=Q%26,C=(Q-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 z=67108863^67108863>>>W<<W;this.words[this.length-1]&=z}return this._strip()},$.prototype.maskn=function(Q){return this.clone().imaskn(Q)},$.prototype.iaddn=function(Q){if(K(typeof Q==="number"),K(Q<67108864),Q<0)return this.isubn(-Q);if(this.negative!==0){if(this.length===1&&(this.words[0]|0)<=Q)return this.words[0]=Q-(this.words[0]|0),this.negative=0,this;return this.negative=0,this.isubn(Q),this.negative=1,this}return this._iaddn(Q)},$.prototype._iaddn=function(Q){this.words[0]+=Q;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(Q){if(K(typeof Q==="number"),K(Q<67108864),Q<0)return this.iaddn(-Q);if(this.negative!==0)return this.negative=0,this.iaddn(Q),this.negative=1,this;if(this.words[0]-=Q,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(Q){return this.clone().iaddn(Q)},$.prototype.subn=function(Q){return this.clone().isubn(Q)},$.prototype.iabs=function(){return this.negative=0,this},$.prototype.abs=function(){return this.clone().iabs()},$.prototype._ishlnsubmul=function(Q,W,C){var z=Q.length+C,H;this._expand(z);var J,O=0;for(H=0;H<Q.length;H++){J=(this.words[H+C]|0)+O;var P=(Q.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(Q,W){var C=this.length-Q.length,z=this.clone(),H=Q,J=H.words[H.length-1]|0,O=this._countBits(J);if(C=26-O,C!==0)H=H.ushln(C),z.iushln(C),J=H.words[H.length-1]|0;var P=z.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=z.clone()._ishlnsubmul(H,1,P);if(f.negative===0){if(z=f,R)R.words[P]=1}for(var p=P-1;p>=0;p--){var o=(z.words[H.length+p]|0)*67108864+(z.words[H.length+p-1]|0);o=Math.min(o/J|0,67108863),z._ishlnsubmul(H,o,p);while(z.negative!==0)if(o--,z.negative=0,z._ishlnsubmul(H,1,p),!z.isZero())z.negative^=1;if(R)R.words[p]=o}if(R)R._strip();if(z._strip(),W!=="div"&&C!==0)z.iushrn(C);return{div:R||null,mod:z}},$.prototype.divmod=function(Q,W,C){if(K(!Q.isZero()),this.isZero())return{div:new $(0),mod:new $(0)};var z,H,J;if(this.negative!==0&&Q.negative===0){if(J=this.neg().divmod(Q,W),W!=="mod")z=J.div.neg();if(W!=="div"){if(H=J.mod.neg(),C&&H.negative!==0)H.iadd(Q)}return{div:z,mod:H}}if(this.negative===0&&Q.negative!==0){if(J=this.divmod(Q.neg(),W),W!=="mod")z=J.div.neg();return{div:z,mod:J.mod}}if((this.negative&Q.negative)!==0){if(J=this.neg().divmod(Q.neg(),W),W!=="div"){if(H=J.mod.neg(),C&&H.negative!==0)H.isub(Q)}return{div:J.div,mod:H}}if(Q.length>this.length||this.cmp(Q)<0)return{div:new $(0),mod:this};if(Q.length===1){if(W==="div")return{div:this.divn(Q.words[0]),mod:null};if(W==="mod")return{div:null,mod:new $(this.modrn(Q.words[0]))};return{div:this.divn(Q.words[0]),mod:new $(this.modrn(Q.words[0]))}}return this._wordDiv(Q,W)},$.prototype.div=function(Q){return this.divmod(Q,"div",!1).div},$.prototype.mod=function(Q){return this.divmod(Q,"mod",!1).mod},$.prototype.umod=function(Q){return this.divmod(Q,"mod",!0).mod},$.prototype.divRound=function(Q){var W=this.divmod(Q);if(W.mod.isZero())return W.div;var C=W.div.negative!==0?W.mod.isub(Q):W.mod,z=Q.ushrn(1),H=Q.andln(1),J=C.cmp(z);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(Q){var W=Q<0;if(W)Q=-Q;K(Q<=67108863);var C=67108864%Q,z=0;for(var H=this.length-1;H>=0;H--)z=(C*z+(this.words[H]|0))%Q;return W?-z:z},$.prototype.modn=function(Q){return this.modrn(Q)},$.prototype.idivn=function(Q){var W=Q<0;if(W)Q=-Q;K(Q<=67108863);var C=0;for(var z=this.length-1;z>=0;z--){var H=(this.words[z]|0)+C*67108864;this.words[z]=H/Q|0,C=H%Q}return this._strip(),W?this.ineg():this},$.prototype.divn=function(Q){return this.clone().idivn(Q)},$.prototype.egcd=function(Q){K(Q.negative===0),K(!Q.isZero());var W=this,C=Q.clone();if(W.negative!==0)W=W.umod(Q);else W=W.clone();var z=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,p=1;(W.words[0]&p)===0&&f<26;++f,p<<=1);if(f>0){W.iushrn(f);while(f-- >0){if(z.isOdd()||H.isOdd())z.iadd(R),H.isub(_);z.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),z.isub(J),H.isub(O);else C.isub(W),J.isub(z),O.isub(H)}return{a:J,b:O,gcd:C.iushln(P)}},$.prototype._invmp=function(Q){K(Q.negative===0),K(!Q.isZero());var W=this,C=Q.clone();if(W.negative!==0)W=W.umod(Q);else W=W.clone();var z=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(z.isOdd())z.iadd(J);z.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),z.isub(H);else C.isub(W),H.isub(z)}var f;if(W.cmpn(1)===0)f=z;else f=H;if(f.cmpn(0)<0)f.iadd(Q);return f},$.prototype.gcd=function(Q){if(this.isZero())return Q.abs();if(Q.isZero())return this.abs();var W=this.clone(),C=Q.clone();W.negative=0,C.negative=0;for(var z=0;W.isEven()&&C.isEven();z++)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(z)},$.prototype.invm=function(Q){return this.egcd(Q).a.umod(Q)},$.prototype.isEven=function(){return(this.words[0]&1)===0},$.prototype.isOdd=function(){return(this.words[0]&1)===1},$.prototype.andln=function(Q){return this.words[0]&Q},$.prototype.bincn=function(Q){K(typeof Q==="number");var W=Q%26,C=(Q-W)/26,z=1<<W;if(this.length<=C)return this._expand(C+1),this.words[C]|=z,this;var H=z;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(Q){var W=Q<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)Q=-Q;K(Q<=67108863,"Number is too big");var z=this.words[0]|0;C=z===Q?0:z<Q?-1:1}if(this.negative!==0)return-C|0;return C},$.prototype.cmp=function(Q){if(this.negative!==0&&Q.negative===0)return-1;if(this.negative===0&&Q.negative!==0)return 1;var W=this.ucmp(Q);if(this.negative!==0)return-W|0;return W},$.prototype.ucmp=function(Q){if(this.length>Q.length)return 1;if(this.length<Q.length)return-1;var W=0;for(var C=this.length-1;C>=0;C--){var z=this.words[C]|0,H=Q.words[C]|0;if(z===H)continue;if(z<H)W=-1;else if(z>H)W=1;break}return W},$.prototype.gtn=function(Q){return this.cmpn(Q)===1},$.prototype.gt=function(Q){return this.cmp(Q)===1},$.prototype.gten=function(Q){return this.cmpn(Q)>=0},$.prototype.gte=function(Q){return this.cmp(Q)>=0},$.prototype.ltn=function(Q){return this.cmpn(Q)===-1},$.prototype.lt=function(Q){return this.cmp(Q)===-1},$.prototype.lten=function(Q){return this.cmpn(Q)<=0},$.prototype.lte=function(Q){return this.cmp(Q)<=0},$.prototype.eqn=function(Q){return this.cmpn(Q)===0},$.prototype.eq=function(Q){return this.cmp(Q)===0},$.red=function(Q){return new V(Q)},$.prototype.toRed=function(Q){return K(!this.red,"Already a number in reduction context"),K(this.negative===0,"red works only with positives"),Q.convertTo(this)._forceRed(Q)},$.prototype.fromRed=function(){return K(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},$.prototype._forceRed=function(Q){return this.red=Q,this},$.prototype.forceRed=function(Q){return K(!this.red,"Already a number in reduction context"),this._forceRed(Q)},$.prototype.redAdd=function(Q){return K(this.red,"redAdd works only with red numbers"),this.red.add(this,Q)},$.prototype.redIAdd=function(Q){return K(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,Q)},$.prototype.redSub=function(Q){return K(this.red,"redSub works only with red numbers"),this.red.sub(this,Q)},$.prototype.redISub=function(Q){return K(this.red,"redISub works only with red numbers"),this.red.isub(this,Q)},$.prototype.redShl=function(Q){return K(this.red,"redShl works only with red numbers"),this.red.shl(this,Q)},$.prototype.redMul=function(Q){return K(this.red,"redMul works only with red numbers"),this.red._verify2(this,Q),this.red.mul(this,Q)},$.prototype.redIMul=function(Q){return K(this.red,"redMul works only with red numbers"),this.red._verify2(this,Q),this.red.imul(this,Q)},$.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(Q){return K(this.red&&!Q.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,Q)};var Z0={k256:null,p224:null,p192:null,p25519:null};function V0(Q,W){this.name=Q,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 Q=new $(null);return Q.words=Array(Math.ceil(this.n/13)),Q},V0.prototype.ireduce=function(Q){var W=Q,C;do this.split(W,this.tmp),W=this.imulK(W),W=W.iadd(this.tmp),C=W.bitLength();while(C>this.n);var z=C<this.n?-1:W.ucmp(this.p);if(z===0)W.words[0]=0,W.length=1;else if(z>0)W.isub(this.p);else if(W.strip!==void 0)W.strip();else W._strip();return W},V0.prototype.split=function(Q,W){Q.iushrn(this.n,0,W)},V0.prototype.imulK=function(Q){return Q.imul(this.k)};function Y0(){V0.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}F(Y0,V0),Y0.prototype.split=function(Q,W){var C=4194303,z=Math.min(Q.length,9);for(var H=0;H<z;H++)W.words[H]=Q.words[H];if(W.length=z,Q.length<=9){Q.words[0]=0,Q.length=1;return}var J=Q.words[9];W.words[W.length++]=J&C;for(H=10;H<Q.length;H++){var O=Q.words[H]|0;Q.words[H-10]=(O&C)<<4|J>>>22,J=O}if(J>>>=22,Q.words[H-10]=J,J===0&&Q.length>10)Q.length-=10;else Q.length-=9},Y0.prototype.imulK=function(Q){Q.words[Q.length]=0,Q.words[Q.length+1]=0,Q.length+=2;var W=0;for(var C=0;C<Q.length;C++){var z=Q.words[C]|0;W+=z*977,Q.words[C]=W&67108863,W=z*64+(W/67108864|0)}if(Q.words[Q.length-1]===0){if(Q.length--,Q.words[Q.length-1]===0)Q.length--}return Q};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(Q){var W=0;for(var C=0;C<Q.length;C++){var z=(Q.words[C]|0)*19+W,H=z&67108863;z>>>=26,Q.words[C]=H,W=z}if(W!==0)Q.words[Q.length++]=W;return Q},$._prime=function(Q){if(Z0[Q])return Z0[Q];var W;if(Q==="k256")W=new Y0;else if(Q==="p224")W=new b;else if(Q==="p192")W=new i;else if(Q==="p25519")W=new Y;else throw Error("Unknown prime "+Q);return Z0[Q]=W,W};function V(Q){if(typeof Q==="string"){var W=$._prime(Q);this.m=W.p,this.prime=W}else K(Q.gtn(1),"modulus must be greater than 1"),this.m=Q,this.prime=null}V.prototype._verify1=function(Q){K(Q.negative===0,"red works only with positives"),K(Q.red,"red works only with red numbers")},V.prototype._verify2=function(Q,W){K((Q.negative|W.negative)===0,"red works only with positives"),K(Q.red&&Q.red===W.red,"red works only with red numbers")},V.prototype.imod=function(Q){if(this.prime)return this.prime.ireduce(Q)._forceRed(this);return A(Q,Q.umod(this.m)._forceRed(this)),Q},V.prototype.neg=function(Q){if(Q.isZero())return Q.clone();return this.m.sub(Q)._forceRed(this)},V.prototype.add=function(Q,W){this._verify2(Q,W);var C=Q.add(W);if(C.cmp(this.m)>=0)C.isub(this.m);return C._forceRed(this)},V.prototype.iadd=function(Q,W){this._verify2(Q,W);var C=Q.iadd(W);if(C.cmp(this.m)>=0)C.isub(this.m);return C},V.prototype.sub=function(Q,W){this._verify2(Q,W);var C=Q.sub(W);if(C.cmpn(0)<0)C.iadd(this.m);return C._forceRed(this)},V.prototype.isub=function(Q,W){this._verify2(Q,W);var C=Q.isub(W);if(C.cmpn(0)<0)C.iadd(this.m);return C},V.prototype.shl=function(Q,W){return this._verify1(Q),this.imod(Q.ushln(W))},V.prototype.imul=function(Q,W){return this._verify2(Q,W),this.imod(Q.imul(W))},V.prototype.mul=function(Q,W){return this._verify2(Q,W),this.imod(Q.mul(W))},V.prototype.isqr=function(Q){return this.imul(Q,Q.clone())},V.prototype.sqr=function(Q){return this.mul(Q,Q)},V.prototype.sqrt=function(Q){if(Q.isZero())return Q.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(Q,C)}var z=this.m.subn(1),H=0;while(!z.isZero()&&z.andln(1)===0)H++,z.iushrn(1);K(!z.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,z),f=this.pow(Q,z.addn(1).iushrn(1)),p=this.pow(Q,z),o=H;while(p.cmp(J)!==0){var K0=p;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(),p=p.redMul(_),o=a}return f},V.prototype.invm=function(Q){var W=Q._invmp(this.m);if(W.negative!==0)return W.negative=0,this.imod(W).redNeg();else return this.imod(W)},V.prototype.pow=function(Q,W){if(W.isZero())return new $(1).toRed(this);if(W.cmpn(1)===0)return Q.clone();var C=4,z=Array(1<<C);z[0]=new $(1).toRed(this),z[1]=Q;for(var H=2;H<z.length;H++)z[H]=this.mul(z[H-1],Q);var J=z[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 p=_>>f&1;if(J!==z[0])J=this.sqr(J);if(p===0&&O===0){P=0;continue}if(O<<=1,O|=p,P++,P!==C&&(H!==0||f!==0))continue;J=this.mul(J,z[O]),P=0,O=0}R=26}return J},V.prototype.convertTo=function(Q){var W=Q.umod(this.m);return W===Q?W.clone():W},V.prototype.convertFrom=function(Q){var W=Q.clone();return W.red=null,W},$.mont=function(Q){return new I(Q)};function I(Q){if(V.call(this,Q),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(Q){return this.imod(Q.ushln(this.shift))},I.prototype.convertFrom=function(Q){var W=this.imod(Q.mul(this.rinv));return W.red=null,W},I.prototype.imul=function(Q,W){if(Q.isZero()||W.isZero())return Q.words[0]=0,Q.length=1,Q;var C=Q.imul(W),z=C.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),H=C.isub(z).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(Q,W){if(Q.isZero()||W.isZero())return new $(0)._forceRed(this);var C=Q.mul(W),z=C.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),H=C.isub(z).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(Q){var W=this.imod(Q._invmp(this.m).mul(this.r2));return W._forceRed(this)}})(typeof Z>"u"||Z,U)}),DV=$0((U,Z)=>{var X=XH(),G=_X(),K=m1().Buffer;function F(M){var D=M.modulus.byteLength(),T;do T=new X(G(D));while(T.cmp(M.modulus)>=0||!T.umod(M.prime1)||!T.umod(M.prime2));return T}function $(M){var D=F(M),T=D.toRed(X.mont(M.modulus)).redPow(new X(M.publicExponent)).fromRed();return{blinder:T,unblinder:D.invm(M.modulus)}}function L(M,D){var T=$(D),A=D.modulus.byteLength(),q=new X(M).mul(T.blinder).umod(D.modulus),S=q.toRed(X.mont(D.prime1)),E=q.toRed(X.mont(D.prime2)),j=D.coefficient,k=D.prime1,B=D.prime2,v=S.redPow(D.exponent1).fromRed(),x=E.redPow(D.exponent2).fromRed(),N=v.isub(x).imul(j).umod(k).imul(B);return x.iadd(N).imul(T.unblinder).umod(D.modulus).toArrayLike(K,"be",A)}L.getr=F,Z.exports=L}),YH=$0((U,Z)=>{var X=HV(),G=_X(),K=BX(),F=OV(),$=CV(),L=GJ(),M=AV(),D=DV(),T=m1().Buffer;Z.exports=function(E,j,k){var B;if(E.padding)B=E.padding;else if(k)B=1;else B=4;var v=X(E),x;if(B===4)x=A(v,j);else if(B===1)x=q(v,j,k);else if(B===3){if(x=new L(j),x.cmp(v.modulus)>=0)throw Error("data too long for modulus")}else throw Error("unknown padding");if(k)return D(x,v);else return M(x,v)};function A(E,j){var k=E.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=G(x),V0=$(T.concat([v,w,T.alloc(1,1),j],u),F(Z0,u)),Y0=$(Z0,F(V0,x));return new L(T.concat([T.alloc(1),Y0,V0],k))}function q(E,j,k){var B=j.length,v=E.modulus.byteLength();if(B>v-11)throw Error("message too long");var x;if(k)x=T.alloc(v-B-3,255);else x=S(v-B-3);return new L(T.concat([T.from([0,k?1:2]),x,T.alloc(1),j],v))}function S(E){var j=T.allocUnsafe(E),k=0,B=G(E*2),v=0,x;while(k<E){if(v===B.length)B=G(E*2),v=0;if(x=B[v++],x)j[k++]=x}return j}}),JH=$0((U,Z)=>{var X=HV(),G=OV(),K=CV(),F=GJ(),$=DV(),L=BX(),M=AV(),D=m1().Buffer;Z.exports=function(S,E,j){var k;if(S.padding)k=S.padding;else if(j)k=1;else k=4;var B=X(S),v=B.modulus.byteLength();if(E.length>v||new F(E).cmp(B.modulus)>=0)throw Error("decryption error");var x;if(j)x=M(new F(E),B);else x=$(E,B);var N=D.alloc(v-x.length);if(x=D.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(S,E){var j=S.modulus.byteLength(),k=L("sha1").update(D.alloc(0)).digest(),B=k.length;if(E[0]!==0)throw Error("decryption error");var v=E.slice(1,B+1),x=E.slice(B+1),N=K(v,G(x,B)),w=K(x,G(N,j-B-1));if(q(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(S,E,j){var k=E.slice(0,2),B=2,v=0;while(E[B++]!==0)if(B>=E.length){v++;break}var x=E.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 E.slice(B)}function q(S,E){S=D.from(S),E=D.from(E);var j=0,k=S.length;if(S.length!==E.length)j++,k=Math.min(S.length,E.length);var B=-1;while(++B<k)j+=S[B]^E[B];return j}}),aY=$0((U)=>{U.publicEncrypt=YH(),U.privateDecrypt=JH(),U.privateEncrypt=function(Z,X){return U.publicEncrypt(Z,X,!0)},U.publicDecrypt=function(Z,X){return U.privateDecrypt(Z,X,!0)}}),GH=$0((U)=>{var Z=(UU(),m0(e1));if(typeof Z.publicEncrypt!=="function")Z=aY();if(U.publicEncrypt=Z.publicEncrypt,U.privateDecrypt=Z.privateDecrypt,typeof Z.privateEncrypt!=="function")U.privateEncrypt=aY().privateEncrypt;else U.privateEncrypt=Z.privateEncrypt;if(typeof Z.publicDecrypt!=="function")U.publicDecrypt=aY().publicDecrypt;else U.publicDecrypt=Z.publicDecrypt}),QH=$0((U)=>{var Z=m1(),X=_X(),G=Z.Buffer,K=Z.kMaxLength,F=globalThis.crypto||globalThis.msCrypto,$=Math.pow(2,32)-1;function L(q,S){if(typeof q!=="number"||q!==q)throw TypeError("offset must be a number");if(q>$||q<0)throw TypeError("offset must be a uint32");if(q>K||q>S)throw RangeError("offset out of range")}function M(q,S,E){if(typeof q!=="number"||q!==q)throw TypeError("size must be a number");if(q>$||q<0)throw TypeError("size must be a uint32");if(q+S>E||q>K)throw RangeError("buffer too small")}F&&F.getRandomValues,U.randomFill=D,U.randomFillSync=A;function D(q,S,E,j){if(!G.isBuffer(q)&&!(q instanceof globalThis.Uint8Array))throw TypeError('"buf" argument must be a Buffer or Uint8Array');if(typeof S==="function")j=S,S=0,E=q.length;else if(typeof E==="function")j=E,E=q.length-S;else if(typeof j!=="function")throw TypeError('"cb" argument must be a function');return L(S,q.length),M(E,S,q.length),T(q,S,E,j)}function T(q,S,E,j){if(!1)var k,B;if(j){X(E,function(x,N){if(x)return j(x);N.copy(q,S),j(null,q)});return}var v=X(E);return v.copy(q,S),q}function A(q,S,E){if(typeof S>"u")S=0;if(!G.isBuffer(q)&&!(q instanceof globalThis.Uint8Array))throw TypeError('"buf" argument must be a Buffer or Uint8Array');if(L(S,q.length),E===void 0)E=q.length-S;return M(E,S,q.length),T(q,S,E)}}),VH=$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=QH()}),$H=$0((U)=>{U.randomBytes=U.rng=U.pseudoRandomBytes=U.prng=_X(),U.createHash=U.Hash=BX(),U.createHmac=U.Hmac=oQ();var Z=xI(),X=Object.keys(Z),G=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(X);U.getHashes=function(){return G};var K=XV();U.pbkdf2=K.pbkdf2,U.pbkdf2Sync=K.pbkdf2Sync;var F=OF();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 $=CF();U.DiffieHellmanGroup=$.DiffieHellmanGroup,U.createDiffieHellmanGroup=$.createDiffieHellmanGroup,U.getDiffieHellman=$.getDiffieHellman,U.createDiffieHellman=$.createDiffieHellman,U.DiffieHellman=$.DiffieHellman;var L=AF();U.createSign=L.createSign,U.Sign=L.Sign,U.createVerify=L.createVerify,U.Verify=L.Verify,U.createECDH=cF();var M=GH();U.publicEncrypt=M.publicEncrypt,U.privateEncrypt=M.privateEncrypt,U.publicDecrypt=M.publicDecrypt,U.privateDecrypt=M.privateDecrypt;var D=VH();U.randomFill=D.randomFill,U.randomFillSync=D.randomFillSync,U.createCredentials=function(){throw Error(`sorry, createCredentials is not implemented yet
|
|
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=BI($H(),1),KH=o0.prng,WH=o0.pseudoRandomBytes,IH=o0.rng,FH=o0.randomBytes,HH=o0.Hash,OH=o0.createHash,CH=o0.Hmac,AH=o0.createHmac,DH=o0.getHashes,zH=o0.pbkdf2,LH=o0.pbkdf2Sync,MH=o0.Cipher,qH=o0.createCipher,TH=o0.Cipheriv,RH=o0.createCipheriv,SH=o0.Decipher,EH=o0.createDecipher,PH=o0.Decipheriv,kH=o0.createDecipheriv,jH=o0.getCiphers,vH=o0.listCiphers,_H=o0.DiffieHellmanGroup,BH=o0.createDiffieHellmanGroup,xH=o0.getDiffieHellman,NH=o0.createDiffieHellman,gH=o0.DiffieHellman,fH=o0.createSign,wH=o0.Sign,yH=o0.createVerify,pH=o0.Verify,cH=o0.createECDH,hH=o0.publicEncrypt,uH=o0.privateEncrypt,bH=o0.publicDecrypt,dH=o0.privateDecrypt,lH=o0.randomFill,oH=o0.randomFillSync,nH=o0.createCredentials,mH=o0.constants,tH=["p192","p224","p256","p384","p521","curve25519","ed25519","secp256k1","secp224r1","prime256v1","prime192v1","ed25519","secp384r1","secp521r1"];eH=crypto,UO=crypto});var MG=`from codeop import compile_command
|
|
18
|
-
import sys
|
|
19
|
-
from _pyrepl.console import Console, Event
|
|
20
|
-
from collections import deque
|
|
21
|
-
import js
|
|
22
|
-
from pyodide.ffi import create_proxy
|
|
23
|
-
|
|
24
|
-
# ANSI prompt strings
|
|
25
|
-
PS1 = "\\x1b[32m>>> \\x1b[0m"
|
|
26
|
-
PS2 = "\\x1b[32m... \\x1b[0m"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
class BrowserConsole(Console):
|
|
30
|
-
def __init__(self, term):
|
|
31
|
-
# term is the xterm.js Terminal instance passed from JS
|
|
32
|
-
self.term = term
|
|
33
|
-
self.event_queue = deque()
|
|
34
|
-
self.encoding = "utf-8"
|
|
35
|
-
self.screen = []
|
|
36
|
-
self.posxy = (0, 0)
|
|
37
|
-
self.height, self.width = self.getheightwidth()
|
|
38
|
-
self._resolve_input = None
|
|
39
|
-
|
|
40
|
-
def getheightwidth(self):
|
|
41
|
-
return self.term.rows, self.term.cols
|
|
42
|
-
|
|
43
|
-
def refresh(self, screen, xy):
|
|
44
|
-
# TODO: redraw screen
|
|
45
|
-
pass
|
|
46
|
-
|
|
47
|
-
def prepare(self):
|
|
48
|
-
# TODO: setup
|
|
49
|
-
pass
|
|
50
|
-
|
|
51
|
-
def restore(self):
|
|
52
|
-
# TODO: teardown
|
|
53
|
-
pass
|
|
54
|
-
|
|
55
|
-
def move_cursor(self, x, y):
|
|
56
|
-
self.term.write(f"\\x1b[{y + 1};{x + 1}H")
|
|
57
|
-
self.posxy = (x, y)
|
|
58
|
-
|
|
59
|
-
def set_cursor_vis(self, visible):
|
|
60
|
-
self.term.write("\\x1b[?25h" if visible else "\\x1b[?25l")
|
|
61
|
-
|
|
62
|
-
def beep(self):
|
|
63
|
-
self.term.write("\\x07")
|
|
64
|
-
|
|
65
|
-
def clear(self):
|
|
66
|
-
self.term.write("\\x1b[2J\\x1b[H")
|
|
67
|
-
self.screen = []
|
|
68
|
-
self.posxy = (0, 0)
|
|
69
|
-
|
|
70
|
-
def flushoutput(self):
|
|
71
|
-
pass # xterm.js writes immediately
|
|
72
|
-
|
|
73
|
-
def finish(self):
|
|
74
|
-
pass
|
|
75
|
-
|
|
76
|
-
def forgetinput(self):
|
|
77
|
-
self.event_queue.clear()
|
|
78
|
-
|
|
79
|
-
def push_char(self, char):
|
|
80
|
-
self.event_queue.append(char)
|
|
81
|
-
|
|
82
|
-
if self._resolve_input:
|
|
83
|
-
resolve = self._resolve_input
|
|
84
|
-
self._resolve_input = None
|
|
85
|
-
resolve()
|
|
86
|
-
|
|
87
|
-
def getpending(self):
|
|
88
|
-
data = ""
|
|
89
|
-
raw = b""
|
|
90
|
-
while self.event_queue:
|
|
91
|
-
c = self.event_queue.popleft()
|
|
92
|
-
if isinstance(c, bytes):
|
|
93
|
-
raw += c
|
|
94
|
-
data += c.decode(self.encoding, errors="replace")
|
|
95
|
-
else:
|
|
96
|
-
raw += bytes([c])
|
|
97
|
-
data += chr(c)
|
|
98
|
-
return Event("key", data, raw)
|
|
99
|
-
|
|
100
|
-
def wait(self, timeout=None):
|
|
101
|
-
return len(self.event_queue) > 0
|
|
102
|
-
|
|
103
|
-
async def get_event(self, block=True):
|
|
104
|
-
if not block and not self.event_queue:
|
|
105
|
-
return None
|
|
106
|
-
|
|
107
|
-
while not self.event_queue:
|
|
108
|
-
promise = js.Promise.new(
|
|
109
|
-
create_proxy(
|
|
110
|
-
lambda resolve, reject: setattr(self, "_resolve_input", resolve)
|
|
111
|
-
)
|
|
112
|
-
)
|
|
113
|
-
await promise
|
|
114
|
-
|
|
115
|
-
char = self.event_queue.popleft()
|
|
116
|
-
if isinstance(char, int):
|
|
117
|
-
char_str = chr(char)
|
|
118
|
-
raw = bytes([char])
|
|
119
|
-
else:
|
|
120
|
-
char_str = char
|
|
121
|
-
raw = char.encode(self.encoding)
|
|
122
|
-
event = Event("key", char_str, raw)
|
|
123
|
-
return event
|
|
124
|
-
|
|
125
|
-
def repaint(self):
|
|
126
|
-
pass
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
async def start_repl():
|
|
130
|
-
# Create a new console for this terminal instance
|
|
131
|
-
browser_console = BrowserConsole(js.term)
|
|
132
|
-
|
|
133
|
-
# Capture startup script before JS moves to next REPL and overwrites it
|
|
134
|
-
startup_script = getattr(js, "pyreplStartupScript", None)
|
|
135
|
-
theme_name = getattr(js, "pyreplTheme", "catppuccin-mocha")
|
|
136
|
-
info_line = getattr(js, "pyreplInfo", "Python 3.13 (Pyodide)")
|
|
137
|
-
readonly = getattr(js, "pyreplReadonly", False)
|
|
138
|
-
|
|
139
|
-
# Expose to JS so it can send input (signals JS can proceed to next REPL)
|
|
140
|
-
js.currentBrowserConsole = browser_console
|
|
141
|
-
|
|
142
|
-
import micropip
|
|
143
|
-
import rlcompleter
|
|
144
|
-
import re
|
|
145
|
-
|
|
146
|
-
await micropip.install("catppuccin[pygments]")
|
|
147
|
-
|
|
148
|
-
from pygments import highlight
|
|
149
|
-
from pygments.lexers import Python3Lexer
|
|
150
|
-
from pygments.formatters import Terminal256Formatter
|
|
151
|
-
|
|
152
|
-
lexer = Python3Lexer()
|
|
153
|
-
formatter = Terminal256Formatter(style=theme_name)
|
|
154
|
-
|
|
155
|
-
def syntax_highlight(code):
|
|
156
|
-
if not code:
|
|
157
|
-
return ""
|
|
158
|
-
result = highlight(code, lexer, formatter)
|
|
159
|
-
return result.rstrip("\\n")
|
|
160
|
-
|
|
161
|
-
class TermWriter:
|
|
162
|
-
def write(self, data):
|
|
163
|
-
browser_console.term.write(data.replace("\\n", "\\r\\n"))
|
|
164
|
-
|
|
165
|
-
def flush(self):
|
|
166
|
-
pass
|
|
167
|
-
|
|
168
|
-
term_writer = TermWriter()
|
|
169
|
-
|
|
170
|
-
# Custom exec that redirects stdout/stderr to this REPL's terminal
|
|
171
|
-
import contextlib
|
|
172
|
-
|
|
173
|
-
def exec_with_redirect(code, globals_dict):
|
|
174
|
-
old_displayhook = sys.displayhook
|
|
175
|
-
|
|
176
|
-
def displayhook(value):
|
|
177
|
-
if value is not None:
|
|
178
|
-
globals_dict["_"] = value
|
|
179
|
-
browser_console.term.write(repr(value) + "\\r\\n")
|
|
180
|
-
|
|
181
|
-
sys.displayhook = displayhook
|
|
182
|
-
try:
|
|
183
|
-
with (
|
|
184
|
-
contextlib.redirect_stdout(term_writer),
|
|
185
|
-
contextlib.redirect_stderr(term_writer),
|
|
186
|
-
):
|
|
187
|
-
exec(code, globals_dict)
|
|
188
|
-
finally:
|
|
189
|
-
sys.displayhook = old_displayhook
|
|
190
|
-
|
|
191
|
-
def clear():
|
|
192
|
-
browser_console.clear()
|
|
193
|
-
browser_console.term.write(f"\\x1b[90m{info_line}\\x1b[0m\\r\\n")
|
|
194
|
-
|
|
195
|
-
class Exit:
|
|
196
|
-
def __repr__(self):
|
|
197
|
-
return "exit is not available in the browser"
|
|
198
|
-
|
|
199
|
-
def __call__(self):
|
|
200
|
-
browser_console.term.write("exit is not available in the browser\\r\\n")
|
|
201
|
-
|
|
202
|
-
repl_globals = {
|
|
203
|
-
"__builtins__": __builtins__,
|
|
204
|
-
"clear": clear,
|
|
205
|
-
"exit": Exit(),
|
|
206
|
-
"quit": Exit(),
|
|
207
|
-
}
|
|
208
|
-
completer = rlcompleter.Completer(repl_globals)
|
|
209
|
-
|
|
210
|
-
# Run startup script if one was provided (silently, just to populate namespace)
|
|
211
|
-
if startup_script:
|
|
212
|
-
try:
|
|
213
|
-
# Temporarily suppress stdout/stderr during startup
|
|
214
|
-
old_stdout, old_stderr = sys.stdout, sys.stderr
|
|
215
|
-
sys.stdout = sys.stderr = type(
|
|
216
|
-
"null", (), {"write": lambda s, x: None, "flush": lambda s: None}
|
|
217
|
-
)()
|
|
218
|
-
exec(startup_script, repl_globals)
|
|
219
|
-
sys.stdout, sys.stderr = old_stdout, old_stderr
|
|
220
|
-
except Exception as e:
|
|
221
|
-
sys.stdout, sys.stderr = old_stdout, old_stderr
|
|
222
|
-
browser_console.term.write(
|
|
223
|
-
f"\\x1b[31mStartup script error - {type(e).__name__}: {e}\\x1b[0m\\r\\n"
|
|
224
|
-
)
|
|
225
|
-
|
|
226
|
-
def get_completions(text):
|
|
227
|
-
"""Get all completions for the given text."""
|
|
228
|
-
completions = []
|
|
229
|
-
i = 0
|
|
230
|
-
while True:
|
|
231
|
-
c = completer.complete(text, i)
|
|
232
|
-
if c is None:
|
|
233
|
-
break
|
|
234
|
-
completions.append(c)
|
|
235
|
-
i += 1
|
|
236
|
-
return completions
|
|
237
|
-
|
|
238
|
-
def get_word_to_complete(line):
|
|
239
|
-
"""Extract the word to complete from the end of the line."""
|
|
240
|
-
match = re.search(r"[\\w.]*$", line)
|
|
241
|
-
return match.group(0) if match else ""
|
|
242
|
-
|
|
243
|
-
# In readonly mode, don't show prompt or accept input
|
|
244
|
-
if readonly:
|
|
245
|
-
return
|
|
246
|
-
|
|
247
|
-
browser_console.term.write(PS1)
|
|
248
|
-
lines = []
|
|
249
|
-
current_line = ""
|
|
250
|
-
|
|
251
|
-
history = []
|
|
252
|
-
history_index = 0
|
|
253
|
-
|
|
254
|
-
while True:
|
|
255
|
-
event = await browser_console.get_event(block=True)
|
|
256
|
-
if event is None:
|
|
257
|
-
continue
|
|
258
|
-
|
|
259
|
-
char = event.data
|
|
260
|
-
if char == "\\x03":
|
|
261
|
-
# Ctrl+C - interrupt/cancel current input
|
|
262
|
-
browser_console.term.write("^C\\r\\n")
|
|
263
|
-
lines = []
|
|
264
|
-
current_line = ""
|
|
265
|
-
history_index = len(history)
|
|
266
|
-
browser_console.term.write(PS1)
|
|
267
|
-
continue
|
|
268
|
-
|
|
269
|
-
if char == "\\x0c":
|
|
270
|
-
# Ctrl+L - clear screen
|
|
271
|
-
clear()
|
|
272
|
-
browser_console.term.write(PS1 + syntax_highlight(current_line))
|
|
273
|
-
continue
|
|
274
|
-
|
|
275
|
-
if char == "\\x1b":
|
|
276
|
-
# Might be an arrow key
|
|
277
|
-
event2 = await browser_console.get_event(block=True)
|
|
278
|
-
if event2 and event2.data == "[":
|
|
279
|
-
event3 = await browser_console.get_event(block=True)
|
|
280
|
-
if event3:
|
|
281
|
-
if event3.data == "A":
|
|
282
|
-
# Up arrow
|
|
283
|
-
if history:
|
|
284
|
-
history_index = max(0, history_index - 1)
|
|
285
|
-
# Clear current line
|
|
286
|
-
browser_console.term.write("\\r\\x1b[K")
|
|
287
|
-
hist_entry = history[history_index]
|
|
288
|
-
# For multiline entries, only show first line
|
|
289
|
-
current_line = (
|
|
290
|
-
hist_entry.split("\\n")[0]
|
|
291
|
-
if "\\n" in hist_entry
|
|
292
|
-
else hist_entry
|
|
293
|
-
)
|
|
294
|
-
browser_console.term.write(
|
|
295
|
-
PS1 + syntax_highlight(current_line)
|
|
296
|
-
)
|
|
297
|
-
elif event3.data == "B":
|
|
298
|
-
# Down arrow
|
|
299
|
-
if history:
|
|
300
|
-
history_index = min(len(history), history_index + 1)
|
|
301
|
-
# Clear current line
|
|
302
|
-
browser_console.term.write("\\r\\x1b[K")
|
|
303
|
-
if history_index < len(history):
|
|
304
|
-
hist_entry = history[history_index]
|
|
305
|
-
# For multiline entries, only show first line
|
|
306
|
-
current_line = (
|
|
307
|
-
hist_entry.split("\\n")[0]
|
|
308
|
-
if "\\n" in hist_entry
|
|
309
|
-
else hist_entry
|
|
310
|
-
)
|
|
311
|
-
else:
|
|
312
|
-
current_line = ""
|
|
313
|
-
browser_console.term.write(
|
|
314
|
-
PS1 + syntax_highlight(current_line)
|
|
315
|
-
)
|
|
316
|
-
# Left and Right arrows can be implemented similarly
|
|
317
|
-
continue
|
|
318
|
-
|
|
319
|
-
if char == "\\r":
|
|
320
|
-
browser_console.term.write("\\r\\n")
|
|
321
|
-
|
|
322
|
-
lines.append(current_line)
|
|
323
|
-
source = "\\n".join(lines)
|
|
324
|
-
|
|
325
|
-
if not source.strip():
|
|
326
|
-
lines = []
|
|
327
|
-
current_line = ""
|
|
328
|
-
browser_console.term.write(PS1)
|
|
329
|
-
continue
|
|
330
|
-
|
|
331
|
-
# If in multiline mode and user entered empty/whitespace line, execute
|
|
332
|
-
if len(lines) > 1 and not current_line.strip():
|
|
333
|
-
# Remove trailing empty lines
|
|
334
|
-
while lines and not lines[-1].strip():
|
|
335
|
-
lines.pop()
|
|
336
|
-
source = "\\n".join(lines)
|
|
337
|
-
try:
|
|
338
|
-
code = compile(source, "<console>", "single")
|
|
339
|
-
exec_with_redirect(code, repl_globals)
|
|
340
|
-
history.append(source)
|
|
341
|
-
history_index = len(history)
|
|
342
|
-
except SystemExit:
|
|
343
|
-
pass
|
|
344
|
-
except Exception as e:
|
|
345
|
-
browser_console.term.write(
|
|
346
|
-
f"\\x1b[31m{type(e).__name__}: {e}\\x1b[0m\\r\\n"
|
|
347
|
-
)
|
|
348
|
-
lines = []
|
|
349
|
-
current_line = ""
|
|
350
|
-
browser_console.term.write(PS1)
|
|
351
|
-
continue
|
|
352
|
-
|
|
353
|
-
try:
|
|
354
|
-
code = compile_command(source, "<console>", "single")
|
|
355
|
-
if code is None:
|
|
356
|
-
# Incomplete — need more input
|
|
357
|
-
prev_line = lines[-1] if lines else current_line
|
|
358
|
-
indent = len(prev_line) - len(prev_line.lstrip())
|
|
359
|
-
if prev_line.rstrip().endswith(":"):
|
|
360
|
-
indent += 4
|
|
361
|
-
browser_console.term.write(PS2 + " " * indent)
|
|
362
|
-
current_line = " " * indent
|
|
363
|
-
else:
|
|
364
|
-
# Complete code, execute it
|
|
365
|
-
if source.strip():
|
|
366
|
-
history.append(source)
|
|
367
|
-
history_index = len(history)
|
|
368
|
-
try:
|
|
369
|
-
exec_with_redirect(code, repl_globals)
|
|
370
|
-
except SystemExit:
|
|
371
|
-
pass
|
|
372
|
-
except Exception as e:
|
|
373
|
-
browser_console.term.write(
|
|
374
|
-
f"\\x1b[31m{type(e).__name__}: {e}\\x1b[0m\\r\\n"
|
|
375
|
-
)
|
|
376
|
-
lines = []
|
|
377
|
-
current_line = ""
|
|
378
|
-
browser_console.term.write(PS1)
|
|
379
|
-
except SyntaxError as e:
|
|
380
|
-
browser_console.term.write(f"\\x1b[31mSyntaxError: {e}\\x1b[0m\\r\\n")
|
|
381
|
-
lines = []
|
|
382
|
-
current_line = ""
|
|
383
|
-
browser_console.term.write(PS1)
|
|
384
|
-
except Exception as e:
|
|
385
|
-
browser_console.term.write(f"\\x1b[31mError: {e}\\x1b[0m\\r\\n")
|
|
386
|
-
lines = []
|
|
387
|
-
current_line = ""
|
|
388
|
-
browser_console.term.write(PS1)
|
|
389
|
-
elif char == "\\t":
|
|
390
|
-
# Tab completion
|
|
391
|
-
word = get_word_to_complete(current_line)
|
|
392
|
-
if word:
|
|
393
|
-
completions = get_completions(word)
|
|
394
|
-
if len(completions) == 1:
|
|
395
|
-
# Single match - complete it
|
|
396
|
-
completion = completions[0]
|
|
397
|
-
current_line = current_line[: -len(word)] + completion
|
|
398
|
-
browser_console.term.write("\\r\\x1b[K")
|
|
399
|
-
prompt = PS1 if len(lines) == 0 else PS2
|
|
400
|
-
browser_console.term.write(prompt + syntax_highlight(current_line))
|
|
401
|
-
elif len(completions) > 1:
|
|
402
|
-
# Multiple matches - show them in columns
|
|
403
|
-
browser_console.term.write("\\r\\n")
|
|
404
|
-
max_len = max(len(c) for c in completions) + 2
|
|
405
|
-
cols = max(1, browser_console.term.cols // max_len)
|
|
406
|
-
for i, c in enumerate(completions):
|
|
407
|
-
browser_console.term.write(c.ljust(max_len))
|
|
408
|
-
if (i + 1) % cols == 0:
|
|
409
|
-
browser_console.term.write("\\r\\n")
|
|
410
|
-
if len(completions) % cols != 0:
|
|
411
|
-
browser_console.term.write("\\r\\n")
|
|
412
|
-
prompt = PS1 if len(lines) == 0 else PS2
|
|
413
|
-
browser_console.term.write(prompt + syntax_highlight(current_line))
|
|
414
|
-
elif char == "\\x7f":
|
|
415
|
-
if current_line:
|
|
416
|
-
current_line = current_line[:-1]
|
|
417
|
-
browser_console.term.write("\\r\\x1b[K")
|
|
418
|
-
prompt = PS1 if len(lines) == 0 else PS2
|
|
419
|
-
browser_console.term.write(prompt + syntax_highlight(current_line))
|
|
420
|
-
else:
|
|
421
|
-
current_line += char
|
|
422
|
-
# Clear line and rewrite with highlighting
|
|
423
|
-
browser_console.term.write("\\r\\x1b[K") # Go to start, clear line
|
|
424
|
-
prompt = PS1 if len(lines) == 0 else PS2
|
|
425
|
-
browser_console.term.write(prompt + syntax_highlight(current_line))
|
|
426
|
-
`;var __dirname="/home/runner/work/pyrepl-web/pyrepl-web/node_modules/pyodide";var ZO=Object.defineProperty,c0=(U,Z)=>ZO(U,"name",{value:Z,configurable:!0}),MV=((U)=>SU)(function(U){return SU.apply(this,arguments)}),XO=(()=>{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 G=X.length,K=new Uint8Array((G-(X[G-1]=="=")-(X[G-2]=="="))*3/4|0),F=0,$=0;F<G;){var L=U[X.charCodeAt(F++)],M=U[X.charCodeAt(F++)],D=U[X.charCodeAt(F++)],T=U[X.charCodeAt(F++)];K[$++]=L<<2|M>>4,K[$++]=M<<4|D>>2,K[$++]=D<<6|T}return K}})();function qV(U){return!isNaN(parseFloat(U))&&isFinite(U)}c0(qV,"_isNumber");function cU(U){return U.charAt(0).toUpperCase()+U.substring(1)}c0(cU,"_capitalize");function fX(U){return function(){return this[U]}}c0(fX,"_getter");var LZ=["isConstructor","isEval","isNative","isToplevel"],MZ=["columnNumber","lineNumber"],qZ=["fileName","functionName","source"],YO=["args"],JO=["evalOrigin"],gX=LZ.concat(MZ,qZ,YO,JO);function JU(U){if(U)for(var Z=0;Z<gX.length;Z++)U[gX[Z]]!==void 0&&this["set"+cU(gX[Z])](U[gX[Z]])}c0(JU,"StackFrame");JU.prototype={getArgs:c0(function(){return this.args},"getArgs"),setArgs:c0(function(U){if(Object.prototype.toString.call(U)!=="[object Array]")throw TypeError("Args must be an Array");this.args=U},"setArgs"),getEvalOrigin:c0(function(){return this.evalOrigin},"getEvalOrigin"),setEvalOrigin:c0(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:c0(function(){var U=this.getFileName()||"",Z=this.getLineNumber()||"",X=this.getColumnNumber()||"",G=this.getFunctionName()||"";return this.getIsEval()?U?"[eval] ("+U+":"+Z+":"+X+")":"[eval]:"+Z+":"+X:G?G+" ("+U+":"+Z+":"+X+")":U+":"+Z+":"+X},"toString")};JU.fromString=c0(function(U){var Z=U.indexOf("("),X=U.lastIndexOf(")"),G=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,""),L=$[1],M=$[2],D=$[3];return new JU({functionName:G,args:K||void 0,fileName:L,lineNumber:M||void 0,columnNumber:D||void 0})},"StackFrame$$fromString");for(eU=0;eU<LZ.length;eU++)JU.prototype["get"+cU(LZ[eU])]=fX(LZ[eU]),JU.prototype["set"+cU(LZ[eU])]=function(U){return function(Z){this[U]=!!Z}}(LZ[eU]);var eU;for(UZ=0;UZ<MZ.length;UZ++)JU.prototype["get"+cU(MZ[UZ])]=fX(MZ[UZ]),JU.prototype["set"+cU(MZ[UZ])]=function(U){return function(Z){if(!qV(Z))throw TypeError(U+" must be a Number");this[U]=Number(Z)}}(MZ[UZ]);var UZ;for(ZZ=0;ZZ<qZ.length;ZZ++)JU.prototype["get"+cU(qZ[ZZ])]=fX(qZ[ZZ]),JU.prototype["set"+cU(qZ[ZZ])]=function(U){return function(Z){this[U]=String(Z)}}(qZ[ZZ]);var ZZ,QJ=JU;function TV(){var U=/^\s*at .*(\S+:\d+|\(native\))/m,Z=/^(eval@)?(\[native code])?$/;return{parse:c0(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:c0(function(X){if(X.indexOf(":")===-1)return[X];var G=/(.+?)(?::(\d+))?(?::(\d+))?$/,K=G.exec(X.replace(/[()]/g,""));return[K[1],K[2]||void 0,K[3]||void 0]},"ErrorStackParser$$extractLocation"),parseV8OrIE:c0(function(X){var G=X.stack.split(`
|
|
427
|
-
`).filter(function(K){return!!K.match(U)},this);return G.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 L=this.extractLocation($?$[1]:F),M=$&&F||void 0,D=["eval","<anonymous>"].indexOf(L[0])>-1?void 0:L[0];return new QJ({functionName:M,fileName:D,lineNumber:L[1],columnNumber:L[2],source:K})},this)},"ErrorStackParser$$parseV8OrIE"),parseFFOrSafari:c0(function(X){var G=X.stack.split(`
|
|
428
|
-
`).filter(function(K){return!K.match(Z)},this);return G.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 QJ({functionName:K});var F=/((.*".+"[^@]*)?[^@]*)(?:@)/,$=K.match(F),L=$&&$[1]?$[1]:void 0,M=this.extractLocation(K.replace(F,""));return new QJ({functionName:L,fileName:M[0],lineNumber:M[1],columnNumber:M[2],source:K})},this)},"ErrorStackParser$$parseFFOrSafari")}}c0(TV,"ErrorStackParser");var GO=new TV,QO=GO;function RV(){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,G=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent.indexOf("Chrome")===-1&&navigator.userAgent.indexOf("Safari")>-1;return SV({IN_BUN:U,IN_DENO:Z,IN_NODE:X,IN_SAFARI:G,IN_SHELL:typeof read=="function"&&typeof load=="function"})}c0(RV,"getGlobalRuntimeEnv");var o1=RV();function SV(U){let Z=U.IN_NODE&&typeof LV<"u"&&VA&&typeof MV=="function"&&typeof __dirname=="string",X=U.IN_NODE&&!Z,G=!U.IN_NODE&&!U.IN_DENO&&!U.IN_BUN,K=G&&typeof window<"u"&&typeof window.document<"u"&&typeof document.createElement=="function"&&"sessionStorage"in window&&typeof globalThis.importScripts!="function",F=G&&typeof globalThis.WorkerGlobalScope<"u"&&typeof globalThis.self<"u"&&globalThis.self instanceof globalThis.WorkerGlobalScope;return{...U,IN_BROWSER:G,IN_BROWSER_MAIN_THREAD:K,IN_BROWSER_WEB_WORKER:F,IN_NODE_COMMONJS:Z,IN_NODE_ESM:X}}c0(SV,"calculateDerivedFlags");var EV,VJ,PV,zV,KJ;async function WJ(){if(!o1.IN_NODE||(EV=(await Promise.resolve().then(() => (qY(),MY))).default,zV=await import("node:fs"),KJ=await import("node:fs/promises"),PV=(await import("node:vm")).default,VJ=await Promise.resolve().then(() => (SY(),RY)),IJ=VJ.sep,typeof MV<"u"))return;let U=zV,Z=await Promise.resolve().then(() => (UU(),e1)),X=await import("ws"),G=await import("node:child_process"),K={fs:U,crypto:Z,ws:X,child_process:G};globalThis.require=function(F){return K[F]}}c0(WJ,"initNodeModules");function kV(U,Z){return VJ.resolve(Z||".",U)}c0(kV,"node_resolvePath");function jV(U,Z){return Z===void 0&&(Z=location),new URL(U,Z).toString()}c0(jV,"browser_resolvePath");var lZ;o1.IN_NODE?lZ=kV:o1.IN_SHELL?lZ=c0((U)=>U,"resolvePath"):lZ=jV;var IJ;o1.IN_NODE||(IJ="/");function vV(U,Z){return U.startsWith("file://")&&(U=U.slice(7)),U.includes("://")?{response:fetch(U)}:{binary:KJ.readFile(U).then((X)=>new Uint8Array(X.buffer,X.byteOffset,X.byteLength))}}c0(vV,"node_getBinaryResponse");function _V(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)))}}c0(_V,"shell_getBinaryResponse");function BV(U,Z){let X=new URL(U,location);return{response:fetch(X,Z?{integrity:Z}:{})}}c0(BV,"browser_getBinaryResponse");var oZ;o1.IN_NODE?oZ=vV:o1.IN_SHELL?oZ=_V:oZ=BV;async function xV(U,Z){let{response:X,binary:G}=oZ(U,Z);if(G)return G;let K=await X;if(!K.ok)throw Error(`Failed to load '${U}': request failed.`);return new Uint8Array(await K.arrayBuffer())}c0(xV,"loadBinaryFile");var bZ;if(o1.IN_BROWSER_MAIN_THREAD)bZ=c0(async(U)=>await import(U),"loadScript");else if(o1.IN_BROWSER_WEB_WORKER)bZ=c0(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=NV;else if(o1.IN_SHELL)bZ=load;else throw Error("Cannot determine runtime environment");async function NV(U){U.startsWith("file://")&&(U=U.slice(7)),U.includes("://")?PV.runInThisContext(await(await fetch(U)).text()):await import(EV.pathToFileURL(U).href)}c0(NV,"nodeLoadScript");async function gV(U){if(o1.IN_NODE){await WJ();let Z=await KJ.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()}c0(gV,"loadLockFile");async function fV(){if(o1.IN_NODE_COMMONJS)return __dirname;let U;try{throw Error()}catch(G){U=G}let Z=QO.parse(U)[0].fileName;if(o1.IN_NODE&&!Z.startsWith("file://")&&(Z=`file://${Z}`),o1.IN_NODE_ESM){let G=await Promise.resolve().then(() => (SY(),RY));return(await Promise.resolve().then(() => (qY(),MY))).fileURLToPath(G.dirname(Z))}let X=Z.lastIndexOf(IJ);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)}c0(fV,"calculateDirname");function wV(U){return U.substring(0,U.lastIndexOf("/")+1)||globalThis.location?.toString()||"."}c0(wV,"calculateInstallBaseUrl");function yV(U){let Z=U.FS,X=U.FS.filesystems.MEMFS,G=U.PATH,K={DIR_MODE:16895,FILE_MODE:33279,mount:c0(function(F){if(!F.opts.fileSystemHandle)throw Error("opts.fileSystemHandle is required");return X.mount.apply(null,arguments)},"mount"),syncfs:c0(async(F,$,L)=>{try{let M=K.getLocalSet(F),D=await K.getRemoteSet(F),T=$?D:M,A=$?M:D;await K.reconcile(F,T,A),L(null)}catch(M){L(M)}},"syncfs"),getLocalSet:c0((F)=>{let $=Object.create(null);function L(T){return T!=="."&&T!==".."}c0(L,"isRealDir");function M(T){return(A)=>G.join2(T,A)}c0(M,"toAbsolute");let D=Z.readdir(F.mountpoint).filter(L).map(M(F.mountpoint));for(;D.length;){let T=D.pop(),A=Z.stat(T);Z.isDir(A.mode)&&D.push.apply(D,Z.readdir(T).filter(L).map(M(T))),$[T]={timestamp:A.mtime,mode:A.mode}}return{type:"local",entries:$}},"getLocalSet"),getRemoteSet:c0(async(F)=>{let $=Object.create(null),L=await VO(F.opts.fileSystemHandle);for(let[M,D]of L)M!=="."&&($[G.join2(F.mountpoint,M)]={timestamp:D.kind==="file"?new Date((await D.getFile()).lastModified):new Date,mode:D.kind==="file"?K.FILE_MODE:K.DIR_MODE});return{type:"remote",entries:$,handles:L}},"getRemoteSet"),loadLocalEntry:c0((F)=>{let $=Z.lookupPath(F,{}).node,L=Z.stat(F);if(Z.isDir(L.mode))return{timestamp:L.mtime,mode:L.mode};if(Z.isFile(L.mode))return $.contents=X.getFileDataAsTypedArray($),{timestamp:L.mtime,mode:L.mode,contents:$.contents};throw Error("node type not supported")},"loadLocalEntry"),storeLocalEntry:c0((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:c0((F)=>{var $=Z.stat(F);Z.isDir($.mode)?Z.rmdir(F):Z.isFile($.mode)&&Z.unlink(F)},"removeLocalEntry"),loadRemoteEntry:c0(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:c0(async(F,$,L)=>{let M=F.get(G.dirname($)),D=Z.isFile(L.mode)?await M.getFileHandle(G.basename($),{create:!0}):await M.getDirectoryHandle(G.basename($),{create:!0});if(D.kind==="file"){let T=await D.createWritable();await T.write(L.contents),await T.close()}F.set($,D)},"storeRemoteEntry"),removeRemoteEntry:c0(async(F,$)=>{await F.get(G.dirname($)).removeEntry(G.basename($)),F.delete($)},"removeRemoteEntry"),reconcile:c0(async(F,$,L)=>{let M=0,D=[];Object.keys($.entries).forEach(function(q){let S=$.entries[q],E=L.entries[q];(!E||Z.isFile(S.mode)&&S.timestamp.getTime()>E.timestamp.getTime())&&(D.push(q),M++)}),D.sort();let T=[];if(Object.keys(L.entries).forEach(function(q){$.entries[q]||(T.push(q),M++)}),T.sort().reverse(),!M)return;let A=$.type==="remote"?$.handles:L.handles;for(let q of D){let S=G.normalize(q.replace(F.mountpoint,"/")).substring(1);if(L.type==="local"){let E=A.get(S),j=await K.loadRemoteEntry(E);K.storeLocalEntry(q,j)}else{let E=K.loadLocalEntry(q);await K.storeRemoteEntry(A,S,E)}}for(let q of T)if(L.type==="local")K.removeLocalEntry(q);else{let S=G.normalize(q.replace(F.mountpoint,"/")).substring(1);await K.removeRemoteEntry(A,S)}},"reconcile")};U.FS.filesystems.NATIVEFS_ASYNC=K}c0(yV,"initializeNativeFS");var VO=c0(async(U)=>{let Z=[];async function X(K){for await(let F of K.values())Z.push(F),F.kind==="directory"&&await X(F)}c0(X,"collect"),await X(U);let G=new Map;G.set(".",U);for(let K of Z){let F=(await U.resolve(K)).join("/");G.set(F,K)}return G},"getFsHandles"),$O=XO("AGFzbQEAAAABDANfAGAAAW9gAW8BfwMDAgECByECD2NyZWF0ZV9zZW50aW5lbAAAC2lzX3NlbnRpbmVsAAEKEwIHAPsBAPsbCwkAIAD7GvsUAAs="),KO=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($O);return await WebAssembly.instantiate(U)}catch(U){if(U instanceof WebAssembly.CompileError)return;throw U}}();async function pV(){let U=await KO;if(U)return U.exports;let Z=Symbol("error marker");return{create_sentinel:c0(()=>Z,"create_sentinel"),is_sentinel:c0((X)=>X===Z,"is_sentinel")}}c0(pV,"getSentinelImport");function cV(U){let Z={config:U,runtimeEnv:o1},X={noImageDecoding:!0,noAudioDecoding:!0,noWasmDecoding:!1,preRun:oV(U),print:U.stdout,printErr:U.stderr,onExit(G){X.exitCode=G},thisProgram:U._sysExecutable,arguments:U.args,API:Z,locateFile:c0((G)=>U.indexURL+G,"locateFile"),instantiateWasm:nV(U.indexURL)};return X}c0(cV,"createSettings");function hV(U){return function(Z){let X="/";try{Z.FS.mkdirTree(U)}catch(G){console.error(`Error occurred while making a home directory '${U}':`),console.error(G),console.error(`Using '${X}' for a home directory instead`),U=X}Z.FS.chdir(U)}}c0(hV,"createHomeDirectory");function uV(U){return function(Z){Object.assign(Z.ENV,U)}}c0(uV,"setEnvironment");function bV(U){return U?[async(Z)=>{Z.addRunDependency("fsInitHook");try{await U(Z.FS,{sitePackages:Z.API.sitePackages})}finally{Z.removeRunDependency("fsInitHook")}}]:[]}c0(bV,"callFsInitHook");function dV(U){let Z=U.HEAPU32[U._Py_Version>>>2],X=Z>>>24&255,G=Z>>>16&255,K=Z>>>8&255;return[X,G,K]}c0(dV,"computeVersionTuple");function lV(U){let Z=xV(U);return async(X)=>{X.API.pyVersionTuple=dV(X);let[G,K]=X.API.pyVersionTuple;X.FS.mkdirTree("/lib"),X.API.sitePackages=`/lib/python${G}.${K}/site-packages`,X.FS.mkdirTree(X.API.sitePackages),X.addRunDependency("install-stdlib");try{let F=await Z;X.FS.writeFile(`/lib/python${G}${K}.zip`,F)}catch(F){console.error("Error occurred while installing the standard library:"),console.error(F)}finally{X.removeRunDependency("install-stdlib")}}}c0(lV,"installStdlib");function oV(U){let Z;return U.stdLibURL!=null?Z=U.stdLibURL:Z=U.indexURL+"python_stdlib.zip",[lV(Z),hV(U.env.HOME),uV(U.env),yV,...bV(U.fsInit)]}c0(oV,"getFileSystemInitializationFuncs");function nV(U){if(typeof WasmOffsetConverter<"u")return;let{binary:Z,response:X}=oZ(U+"pyodide.asm.wasm"),G=pV();return function(K,F){return async function(){K.sentinel=await G;try{let $;X?$=await WebAssembly.instantiateStreaming(X,K):$=await WebAssembly.instantiate(await Z,K);let{instance:L,module:M}=$;F(L,M)}catch($){console.warn("wasm instantiation failed!"),console.warn($)}}(),{}}}c0(nV,"getInstantiateWasmFunc");var WO="0.29.1";function dZ(U){return U===void 0||U.endsWith("/")?U:U+"/"}c0(dZ,"withTrailingSlash");var $J=WO;async function mV(U={}){if(await WJ(),U.lockFileContents&&U.lockFileURL)throw Error("Can't pass both lockFileContents and lockFileURL");let Z=U.indexURL||await fV();if(Z=dZ(lZ(Z)),U.packageBaseUrl=dZ(U.packageBaseUrl),U.cdnUrl=dZ(U.packageBaseUrl??`https://cdn.jsdelivr.net/pyodide/v${$J}/full/`),!U.lockFileContents){let K=U.lockFileURL??Z+"pyodide-lock.json";U.lockFileContents=gV(K),U.packageBaseUrl??=wV(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"},G=Object.assign(X,U);return G.env.HOME??="/home/pyodide",G.env.PYTHONINSPECT??="1",G}c0(mV,"initializeConfiguration");function sV(U){let Z=cV(U),X=Z.API;return X.lockFilePromise=Promise.resolve(U.lockFileContents),Z}c0(sV,"createEmscriptenSettings");async function rV(U){if(typeof _createPyodideModule!="function"){let Z=`${U.indexURL}pyodide.asm.js`;await bZ(Z)}}c0(rV,"loadWasmScript");async function aV(U,Z){if(!U._loadSnapshot)return;let X=await U._loadSnapshot,G=ArrayBuffer.isView(X)?X:new Uint8Array(X);return Z.noInitialRun=!0,Z.INITIAL_MEMORY=G.length,G}c0(aV,"prepareSnapshot");async function tV(U){let Z=await _createPyodideModule(U);if(U.exitCode!==void 0)throw new Z.ExitStatus(U.exitCode);return Z}c0(tV,"createPyodideModule");function iV(U,Z){let X=U.API;if(Z.pyproxyToStringRepr&&X.setPyProxyToStringMethod(!0),Z.convertNullToNone&&X.setCompatNullToNone(!0),Z.toJsLiteralMap&&X.setCompatToJsLiteralMap(!0),X.version!==$J&&Z.checkAPIVersion)throw Error(`Pyodide version does not match: '${$J}' <==> '${X.version}'. If you updated the Pyodide version, make sure you also updated the 'indexURL' parameter passed to loadPyodide.`);U.locateFile=(G)=>{throw G.endsWith(".so")?Error(`Failed to find dynamic library "${G}"`):Error(`Unexpected call to locateFile("${G}")`)}}c0(iV,"configureAPI");function eV(U,Z,X){let G=U.API,K;return Z&&(K=G.restoreSnapshot(Z)),G.finalizeBootstrap(K,X._snapshotDeserializer)}c0(eV,"bootstrapPyodide");async function U$(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}c0(U$,"finalizeSetup");async function FJ(U={}){let Z=await mV(U),X=sV(Z);await rV(Z);let G=await aV(Z,X),K=await tV(X);iV(K,Z);let F=eV(K,G,Z);return await U$(F,Z)}c0(FJ,"loadPyodide");var{defineProperty:JK,getOwnPropertyDescriptor:IO}=Object,FO=(U,Z)=>{for(var X in Z)JK(U,X,{get:Z[X],enumerable:!0})},$1=(U,Z,X,G)=>{for(var K=G>1?void 0:G?IO(Z,X):Z,F=U.length-1,$;F>=0;F--)($=U[F])&&(K=(G?$(Z,X,K):$(K))||K);return G&&K&&JK(Z,X,K),K},p0=(U,Z)=>(X,G)=>Z(X,G,U),Z$="Terminal input",vJ={get:()=>Z$,set:(U)=>Z$=U},X$="Too much output to announce, navigate to rows manually to read",_J={get:()=>X$,set:(U)=>X$=U};function HO(U){return U.replace(/\r?\n/g,"\r")}function OO(U,Z){return Z?"\x1B[200~"+U+"\x1B[201~":U}function CO(U,Z){U.clipboardData&&U.clipboardData.setData("text/plain",Z.selectionText),U.preventDefault()}function AO(U,Z,X,G){if(U.stopPropagation(),U.clipboardData){let K=U.clipboardData.getData("text/plain");GK(K,Z,X,G)}}function GK(U,Z,X,G){U=HO(U),U=OO(U,X.decPrivateModes.bracketedPasteMode&&G.rawOptions.ignoreBracketedPasteMode!==!0),X.triggerDataEvent(U,!0),Z.value=""}function QK(U,Z,X){let G=X.getBoundingClientRect(),K=U.clientX-G.left-10,F=U.clientY-G.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 Y$(U,Z,X,G,K){QK(U,Z,X),K&&G.rightClickSelect(U),Z.value=G.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 JY(U,Z=0,X=U.length){let G="";for(let K=Z;K<X;++K){let F=U[K];F>65535?(F-=65536,G+=String.fromCharCode((F>>10)+55296)+String.fromCharCode(F%1024+56320)):G+=String.fromCharCode(F)}return G}var DO=class{constructor(){this._interim=0}clear(){this._interim=0}decode(U,Z){let X=U.length;if(!X)return 0;let G=0,K=0;if(this._interim){let F=U.charCodeAt(K++);56320<=F&&F<=57343?Z[G++]=(this._interim-55296)*1024+F-56320+65536:(Z[G++]=this._interim,Z[G++]=F),this._interim=0}for(let F=K;F<X;++F){let $=U.charCodeAt(F);if(55296<=$&&$<=56319){if(++F>=X)return this._interim=$,G;let L=U.charCodeAt(F);56320<=L&&L<=57343?Z[G++]=($-55296)*1024+L-56320+65536:(Z[G++]=$,Z[G++]=L);continue}$!==65279&&(Z[G++]=$)}return G}},zO=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(U,Z){let X=U.length;if(!X)return 0;let G=0,K,F,$,L,M=0,D=0;if(this.interim[0]){let q=!1,S=this.interim[0];S&=(S&224)===192?31:(S&240)===224?15:7;let E=0,j;for(;(j=this.interim[++E]&63)&&E<4;)S<<=6,S|=j;let k=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,B=k-E;for(;D<B;){if(D>=X)return 0;if(j=U[D++],(j&192)!==128){D--,q=!0;break}else this.interim[E++]=j,S<<=6,S|=j&63}q||(k===2?S<128?D--:Z[G++]=S:k===3?S<2048||S>=55296&&S<=57343||S===65279||(Z[G++]=S):S<65536||S>1114111||(Z[G++]=S)),this.interim.fill(0)}let T=X-4,A=D;for(;A<X;){for(;A<T&&!((K=U[A])&128)&&!((F=U[A+1])&128)&&!(($=U[A+2])&128)&&!((L=U[A+3])&128);)Z[G++]=K,Z[G++]=F,Z[G++]=$,Z[G++]=L,A+=4;if(K=U[A++],K<128)Z[G++]=K;else if((K&224)===192){if(A>=X)return this.interim[0]=K,G;if(F=U[A++],(F&192)!==128){A--;continue}if(M=(K&31)<<6|F&63,M<128){A--;continue}Z[G++]=M}else if((K&240)===224){if(A>=X)return this.interim[0]=K,G;if(F=U[A++],(F&192)!==128){A--;continue}if(A>=X)return this.interim[0]=K,this.interim[1]=F,G;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[G++]=M}else if((K&248)===240){if(A>=X)return this.interim[0]=K,G;if(F=U[A++],(F&192)!==128){A--;continue}if(A>=X)return this.interim[0]=K,this.interim[1]=F,G;if($=U[A++],($&192)!==128){A--;continue}if(A>=X)return this.interim[0]=K,this.interim[1]=F,this.interim[2]=$,G;if(L=U[A++],(L&192)!==128){A--;continue}if(M=(K&7)<<18|(F&63)<<12|($&63)<<6|L&63,M<65536||M>1114111)continue;Z[G++]=M}}return G}},VK="",oU=" ",IX=class U{constructor(){this.fg=0,this.bg=0,this.extended=new rX}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}},rX=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 rX,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 G=Z[1].charCodeAt(0);if(55296<=G&&G<=56319){let K=Z[1].charCodeAt(1);56320<=K&&K<=57343?this.content=(G-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()]}},J$="di$target",BJ="di$dependencies",HJ=new Map;function LO(U){return U[BJ]||[]}function c1(U){if(HJ.has(U))return HJ.get(U);let Z=function(X,G,K){if(arguments.length!==3)throw Error("@IServiceName-decorator can only be used to decorate a parameter");MO(Z,X,K)};return Z._id=U,HJ.set(U,Z),Z}function MO(U,Z,X){Z[J$]===Z?Z[BJ].push({id:U,index:X}):(Z[BJ]=[{id:U,index:X}],Z[J$]=Z)}var r1=c1("BufferService"),$K=c1("CoreMouseService"),KZ=c1("CoreService"),qO=c1("CharsetService"),GG=c1("InstantiationService"),KK=c1("LogService"),a1=c1("OptionsService"),WK=c1("OscLinkService"),TO=c1("UnicodeService"),FX=c1("DecorationService"),xJ=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 G=[],K=this._optionsService.rawOptions.linkHandler,F=new HU,$=X.getTrimmedLength(),L=-1,M=-1,D=!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,L=F.extended.urlId;continue}else D=F.extended.urlId!==L;else M!==-1&&(D=!0);if(D||M!==-1&&T===$-1){let A=this._oscLinkService.getLinkData(L)?.uri;if(A){let q={start:{x:M+1,y:U},end:{x:T+(!D&&T===$-1?1:0),y:U}},S=!1;if(!K?.allowNonHttpProtocols)try{let E=new URL(A);["http:","https:"].includes(E.protocol)||(S=!0)}catch{S=!0}S||G.push({text:A,range:q,activate:(E,j)=>K?K.activate(E,j,q):RO(E,j),hover:(E,j)=>K?.hover?.(E,j,q),leave:(E,j)=>K?.leave?.(E,j,q)})}D=!1,F.hasExtendedAttrs()&&F.extended.urlId?(M=T,L=F.extended.urlId):(M=-1,L=-1)}}Z(G)}};xJ=$1([p0(0,r1),p0(1,a1),p0(2,WK)],xJ);function RO(U,Z){if(confirm(`Do you want to navigate to ${Z}?
|
|
429
|
-
|
|
430
|
-
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 GY=c1("CharSizeService"),NU=c1("CoreBrowserService"),QG=c1("MouseService"),gU=c1("RenderService"),SO=c1("SelectionService"),IK=c1("CharacterJoinerService"),EZ=c1("ThemeService"),FK=c1("LinkProviderService"),EO=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(U){setTimeout(()=>{throw U.stack?G$.isErrorNoTelemetry(U)?new G$(U.message+`
|
|
431
|
-
|
|
432
|
-
`+U.stack):Error(U.message+`
|
|
433
|
-
|
|
434
|
-
`+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)}},PO=new EO;function uX(U){kO(U)||PO.onUnexpectedError(U)}var NJ="Canceled";function kO(U){return U instanceof jO?!0:U instanceof Error&&U.name===NJ&&U.message===NJ}var jO=class extends Error{constructor(){super(NJ),this.name=this.message}};function vO(U){return U?Error(`Illegal argument: ${U}`):Error("Illegal argument")}var G$=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"}},gJ=class U extends Error{constructor(Z){super(Z||"An unexpected bug occurred."),Object.setPrototypeOf(this,U.prototype)}};function _O(U,Z,X=0,G=U.length){let K=X,F=G;for(;K<F;){let $=Math.floor((K+F)/2);Z(U[$])?K=$+1:F=$}return K-1}var BO=class U{constructor(Z){this._array=Z,this._findLastMonotonousLastIdx=0}findLastMonotonous(Z){if(U.assertInvariants){if(this._prevFindLastPredicate){for(let G of this._array)if(this._prevFindLastPredicate(G)&&!Z(G))throw Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=Z}let X=_O(this._array,Z,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=X+1,X===-1?void 0:this._array[X]}};BO.assertInvariants=!1;function GU(U,Z=0){return U[U.length-(1+Z)]}var HK;((U)=>{function Z(F){return F<0}U.isLessThan=Z;function X(F){return F<=0}U.isLessThanOrEqual=X;function G(F){return F>0}U.isGreaterThan=G;function K(F){return F===0}U.isNeitherLessOrGreaterThan=K,U.greaterThan=1,U.lessThan=-1,U.neitherLessOrGreaterThan=0})(HK||={});function xO(U,Z){return(X,G)=>Z(U(X),U(G))}var NO=(U,Z)=>U-Z,Q$=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((G)=>Z(G)?X(G):!0))}map(Z){return new U((X)=>this.iterate((G)=>X(Z(G))))}some(Z){let X=!1;return this.iterate((G)=>(X=Z(G),!X)),X}findFirst(Z){let X;return this.iterate((G)=>Z(G)?(X=G,!1):!0),X}findLast(Z){let X;return this.iterate((G)=>(Z(G)&&(X=G),!0)),X}findLastMaxBy(Z){let X,G=!0;return this.iterate((K)=>((G||HK.isGreaterThan(Z(K,X)))&&(G=!1,X=K),!0)),X}};Q$.empty=new Q$((U)=>{});function gO(U,Z){let X=Object.create(null);for(let G of U){let K=Z(G),F=X[K];F||(F=X[K]=[]),F.push(G)}return X}var V$,$$,KA=class{constructor(U,Z){this.toKey=Z,this._map=new Map,this[V$]="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))}[($$=Symbol.iterator,V$=Symbol.toStringTag,$$)](){return this.values()}},fO=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 wO(U,Z){let X=this,G=!1,K;return function(){if(G)return K;if(G=!0,Z)try{K=U.apply(X,arguments)}finally{Z()}else K=U.apply(X,arguments);return K}}var OK;((U)=>{function Z(N){return N&&typeof N=="object"&&typeof N[Symbol.iterator]=="function"}U.is=Z;let X=Object.freeze([]);function G(){return X}U.empty=G;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*L(N){for(let w=N.length-1;w>=0;w--)yield N[w]}U.reverse=L;function M(N){return!N||N[Symbol.iterator]().next().done===!0}U.isEmpty=M;function D(N){return N[Symbol.iterator]().next().value}U.first=D;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*q(N,w){for(let u of N)w(u)&&(yield u)}U.filter=q;function*S(N,w){let u=0;for(let Z0 of N)yield w(Z0,u++)}U.map=S;function*E(N,w){let u=0;for(let Z0 of N)yield*w(Z0,u++)}U.flatMap=E;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})(OK||={});var yO=!1,QZ=null,pO=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 G=this.getDisposableData(Z);G.parent=X}markAsDisposed(Z){this.livingDisposables.delete(Z)}markAsSingleton(Z){this.getDisposableData(Z).isSingleton=!0}getRootParent(Z,X){let G=X.get(Z);if(G)return G;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 G;if(X)G=X;else{let M=new Map,D=[...this.livingDisposables.values()].filter((A)=>A.source!==null&&!this.getRootParent(A,M).isSingleton);if(D.length===0)return;let T=new Set(D.map((A)=>A.value));if(G=D.filter((A)=>!(A.parent&&T.has(A.parent))),G.length===0)throw Error("There are cyclic diposable chains!")}if(!G)return;function K(M){function D(A,q){for(;A.length>0&&q.some((S)=>typeof S=="string"?S===A[0]:A[0].match(S));)A.shift()}let T=M.source.split(`
|
|
435
|
-
`).map((A)=>A.trim().replace("at ","")).filter((A)=>A!=="");return D(T,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),T.reverse()}let F=new fO;for(let M of G){let D=K(M);for(let T=0;T<=D.length;T++)F.add(D.slice(0,T).join(`
|
|
436
|
-
`),M)}G.sort(xO((M)=>M.idx,NO));let $="",L=0;for(let M of G.slice(0,Z)){L++;let D=K(M),T=[];for(let A=0;A<D.length;A++){let q=D[A];q=`(shared with ${F.get(D.slice(0,A+1).join(`
|
|
437
|
-
`)).size}/${G.length} leaks) at ${q}`;let S=F.get(D.slice(0,A).join(`
|
|
438
|
-
`)),E=gO([...S].map((j)=>K(j)[A]),(j)=>j);delete E[D[A]];for(let[j,k]of Object.entries(E))T.unshift(` - stacktraces of ${k.length} other leaks continue with ${j}`);T.unshift(q)}$+=`
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
==================== Leaking disposable ${L}/${G.length}: ${M.value.constructor.name} ====================
|
|
442
|
-
${T.join(`
|
|
443
|
-
`)}
|
|
444
|
-
============================================================
|
|
445
|
-
|
|
446
|
-
`}return G.length>Z&&($+=`
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
... and ${G.length-Z} more leaking disposables
|
|
450
|
-
|
|
451
|
-
`),{leaks:G,details:$}}};pO.idx=0;function cO(U){QZ=U}if(yO){let U="__is_disposable_tracked__";cO(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 QZ?.trackDisposable(U),U}function VY(U){QZ?.markAsDisposed(U)}function VX(U,Z){QZ?.setParent(U,Z)}function hO(U,Z){if(QZ)for(let X of U)QZ.setParent(X,Z)}function K$(U){return QZ?.markAsSingleton(U),U}function VZ(U){if(OK.is(U)){let Z=[];for(let X of U)if(X)try{X.dispose()}catch(G){Z.push(G)}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 uO(...U){let Z=U1(()=>VZ(U));return hO(U,Z),Z}function U1(U){let Z=QY({dispose:wO(()=>{VY(Z),U()})});return Z}var CK=class U{constructor(){this._toDispose=new Set,this._isDisposed=!1,QY(this)}dispose(){this._isDisposed||(VY(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))}};CK.DISABLE_DISPOSED_WARNING=!1;var nU=CK,d0=class{constructor(){this._store=new nU,QY(this),VX(this._store,this)}dispose(){VY(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 SZ=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,VY(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,fJ=class U{constructor(Z){this.element=Z,this.next=U.Undefined,this.prev=U.Undefined}};fJ.Undefined=new fJ(void 0);var X1=fJ,W$=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 G=!1;return()=>{G||(G=!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}},bO=globalThis.performance&&typeof globalThis.performance.now=="function",dO=class U{static create(Z){return new U(Z)}constructor(Z){this._now=bO&&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}},lO=!1,I$=!1,oO=!1,b1;((U)=>{U.None=()=>d0.None;function Z(V){if(oO){let{onDidAddListener:I}=V,Q=yJ.create(),W=0;V.onDidAddListener=()=>{++W===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),Q.print()),I?.()}}}function X(V,I){return q(V,()=>{},0,void 0,!0,void 0,I)}U.defer=X;function G(V){return(I,Q=null,W)=>{let C=!1,z;return z=V((H)=>{if(!C)return z?z.dispose():C=!0,I.call(Q,H)},null,W),C&&z.dispose(),z}}U.once=G;function K(V,I,Q){return T((W,C=null,z)=>V((H)=>W.call(C,I(H)),null,z),Q)}U.map=K;function F(V,I,Q){return T((W,C=null,z)=>V((H)=>{I(H),W.call(C,H)},null,z),Q)}U.forEach=F;function $(V,I,Q){return T((W,C=null,z)=>V((H)=>I(H)&&W.call(C,H),null,z),Q)}U.filter=$;function L(V){return V}U.signal=L;function M(...V){return(I,Q=null,W)=>{let C=uO(...V.map((z)=>z((H)=>I.call(Q,H))));return A(C,W)}}U.any=M;function D(V,I,Q,W){let C=Q;return K(V,(z)=>(C=I(C,z),C),W)}U.reduce=D;function T(V,I){let Q,W={onWillAddFirstListener(){Q=V(C.fire,C)},onDidRemoveLastListener(){Q?.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 q(V,I,Q=100,W=!1,C=!1,z,H){let J,O,P,R=0,_,f={leakWarningThreshold:z,onWillAddFirstListener(){J=V((o)=>{R++,O=I(O,o),W&&!P&&(p.fire(O),O=void 0),_=()=>{let K0=O;O=void 0,P=void 0,(!W||R>1)&&p.fire(K0),R=0},typeof Q=="number"?(clearTimeout(P),P=setTimeout(_,Q)):P===void 0&&(P=0,queueMicrotask(_))})},onWillRemoveListener(){C&&R>0&&_?.()},onDidRemoveLastListener(){_=void 0,J.dispose()}};H||Z(f);let p=new w0(f);return H?.add(p),p.event}U.debounce=q;function S(V,I=0,Q){return U.debounce(V,(W,C)=>W?(W.push(C),W):[C],I,void 0,!0,void 0,Q)}U.accumulate=S;function E(V,I=(W,C)=>W===C,Q){let W=!0,C;return $(V,(z)=>{let H=W||!I(z,C);return W=!1,C=z,H},Q)}U.latch=E;function j(V,I,Q){return[U.filter(V,I,Q),U.filter(V,(W)=>!I(W),Q)]}U.split=j;function k(V,I=!1,Q=[],W){let C=Q.slice(),z=V((O)=>{C?C.push(O):J.fire(O)});W&&W.add(z);let H=()=>{C?.forEach((O)=>J.fire(O)),C=null},J=new w0({onWillAddFirstListener(){z||(z=V((O)=>J.fire(O)),W&&W.add(z))},onDidAddFirstListener(){C&&(I?setTimeout(H):H())},onDidRemoveLastListener(){z&&z.dispose(),z=null}});return W&&W.add(J),J.event}U.buffer=k;function B(V,I){return(Q,W,C)=>{let z=I(new x);return V(function(H){let J=z.evaluate(H);J!==v&&Q.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 Q=I;return this.steps.push((W)=>(Q=V(Q,W),Q)),this}latch(V=(I,Q)=>I===Q){let I=!0,Q;return this.steps.push((W)=>{let C=I||!V(W,Q);return I=!1,Q=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,Q=(W)=>W){let W=(...J)=>H.fire(Q(...J)),C=()=>V.on(I,W),z=()=>V.removeListener(I,W),H=new w0({onWillAddFirstListener:C,onDidRemoveLastListener:z});return H.event}U.fromNodeEventEmitter=N;function w(V,I,Q=(W)=>W){let W=(...J)=>H.fire(Q(...J)),C=()=>V.addEventListener(I,W),z=()=>V.removeEventListener(I,W),H=new w0({onWillAddFirstListener:C,onDidRemoveLastListener:z});return H.event}U.fromDOMEventEmitter=w;function u(V){return new Promise((I)=>G(V)(I))}U.toPromise=u;function Z0(V){let I=new w0;return V.then((Q)=>{I.fire(Q)},()=>{I.fire(void 0)}).finally(()=>{I.dispose()}),I.event}U.fromPromise=Z0;function V0(V,I){return V((Q)=>I.fire(Q))}U.forward=V0;function Y0(V,I,Q){return I(Q),V((W)=>I(W))}U.runAndSubscribe=Y0;class b{constructor(V,I){this._observable=V,this._counter=0,this._hasChanged=!1;let Q={onWillAddFirstListener:()=>{V.addObserver(this)},onDidRemoveLastListener:()=>{V.removeObserver(this)}};I||Z(Q),this.emitter=new w0(Q),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,Q,W)=>{let C=0,z=!1,H={beginUpdate(){C++},endUpdate(){C--,C===0&&(V.reportChanges(),z&&(z=!1,I.call(Q)))},handlePossibleChange(){},handleChange(){z=!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 wJ=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 dO,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}}};wJ.all=new Set,wJ._idPool=0;var nO=wJ,F$=-1,AK=class U{constructor(Z,X,G=(U._idPool++).toString(16).padStart(3,"0")){this._errorHandler=Z,this.threshold=X,this.name=G,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(Z,X){let G=this.threshold;if(G<=0||X<G)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=G*0.5;let[F,$]=this.getMostFrequentStack(),L=`[${this.name}] potential listener LEAK detected, having ${X} listeners already. MOST frequent listener (${$}):`;console.warn(L),console.warn(F);let M=new sO(L,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[G,K]of this._stacks)(!Z||X<K)&&(Z=[G,K],X=K);return Z}};AK._idPool=1;var mO=AK,yJ=class U{constructor(Z){this.value=Z}static create(){let Z=Error();return new U(Z.stack??"")}print(){console.warn(this.value.split(`
|
|
452
|
-
`).slice(2).join(`
|
|
453
|
-
`))}},sO=class extends Error{constructor(U,Z){super(U),this.name="ListenerLeakError",this.stack=Z}},rO=class extends Error{constructor(U,Z){super(U),this.name="ListenerRefusalError",this.stack=Z}},aO=0,bX=class{constructor(U){this.value=U,this.id=aO++}},tO=2,iO=(U,Z)=>{if(U instanceof bX)Z(U);else for(let X=0;X<U.length;X++){let G=U[X];G&&Z(G)}},dX;if(lO){let U=[];setInterval(()=>{U.length!==0&&(console.warn("[LEAKING LISTENERS] GC'ed these listeners that were NOT yet disposed:"),console.warn(U.join(`
|
|
454
|
-
`)),U.length=0)},3000),dX=new FinalizationRegistry((Z)=>{typeof Z=="string"&&U.push(Z)})}var w0=class{constructor(U){this._size=0,this._options=U,this._leakageMon=F$>0||this._options?.leakWarningThreshold?new mO(U?.onListenerError??uX,this._options?.leakWarningThreshold??F$):void 0,this._perfMon=this._options?._profName?new nO(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(I$){let U=this._listeners;queueMicrotask(()=>{iO(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 L=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(L);let M=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],D=new rO(`${L}. HINT: Stack shows most frequent listener (${M[1]}-times)`,M[0]);return(this._options?.onListenerError||uX)(D),d0.None}if(this._disposed)return d0.None;Z&&(U=U.bind(Z));let G=new bX(U),K,F;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*0.2)&&(G.stack=yJ.create(),K=this._leakageMon.check(G.stack,this._size+1)),I$&&(G.stack=F??yJ.create()),this._listeners?this._listeners instanceof bX?(this._deliveryQueue??=new eO,this._listeners=[this._listeners,G]):this._listeners.push(G):(this._options?.onWillAddFirstListener?.(this),this._listeners=G,this._options?.onDidAddFirstListener?.(this)),this._size++;let $=U1(()=>{dX?.unregister($),K?.(),this._removeListener(G)});if(X instanceof nU?X.add($):Array.isArray(X)&&X.push($),dX){let L=Error().stack.split(`
|
|
455
|
-
`).slice(2,3).join(`
|
|
456
|
-
`).trim(),M=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(L);dX.register($,M?.[2]??L,$)}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 G=this._deliveryQueue.current===this;if(this._size*tO<=Z.length){let K=0;for(let F=0;F<Z.length;F++)Z[F]?Z[K++]=Z[F]:G&&(this._deliveryQueue.end--,K<this._deliveryQueue.i&&this._deliveryQueue.i--);Z.length=K}}_deliver(U,Z){if(!U)return;let X=this._options?.onListenerError||uX;if(!X){U.value(Z);return}try{U.value(Z)}catch(G){X(G)}}_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 bX)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}},eO=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}},pJ=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 G=this.getWindowId(X);this.mapWindowIdToZoomLevel.set(G,Z),this._onDidChangeZoomLevel.fire(G)}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 G=this.getWindowId(X);this.mapWindowIdToFullScreen.set(G,Z),this._onDidChangeFullscreen.fire(G)}isFullscreen(Z){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(Z))}getWindowId(Z){return Z.vscodeWindowId}};pJ.INSTANCE=new pJ;var VG=pJ;function U2(U,Z,X){typeof Z=="string"&&(Z=U.matchMedia(Z)),Z.addEventListener("change",X)}var WA=VG.INSTANCE.onDidChangeZoomLevel;function Z2(U){return VG.INSTANCE.getZoomFactor(U)}var IA=VG.INSTANCE.onDidChangeFullscreen,PZ=typeof navigator=="object"?navigator.userAgent:"",cJ=PZ.indexOf("Firefox")>=0,lX=PZ.indexOf("AppleWebKit")>=0,$G=PZ.indexOf("Chrome")>=0,DK=!$G&&PZ.indexOf("Safari")>=0,FA=PZ.indexOf("Electron/")>=0,HA=PZ.indexOf("Android")>=0,oX=!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)");oX=U.matches,U2($U,U,({matches:X})=>{oX&&Z.matches||(oX=X)})}function X2(){return oX}var RZ="en",aX=!1,tX=!1,GX=!1,Y2=!1,zK=!1,LK=!1,J2=!1,G2=!1,Q2=!1,V2=!1,wX,nX=RZ,H$=RZ,$2,_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 MK=typeof VU?.versions?.electron=="string",K2=MK&&VU?.type==="renderer";if(typeof VU=="object"){aX=VU.platform==="win32",tX=VU.platform==="darwin",GX=VU.platform==="linux",Y2=GX&&!!VU.env.SNAP&&!!VU.env.SNAP_REVISION,J2=MK,Q2=!!VU.env.CI||!!VU.env.BUILD_ARTIFACTSTAGINGDIRECTORY,wX=RZ,nX=RZ;let U=VU.env.VSCODE_NLS_CONFIG;if(U)try{let Z=JSON.parse(U);wX=Z.userLocale,H$=Z.osLocale,nX=Z.resolvedLanguage||RZ,$2=Z.languagePack?.translationsConfigFile}catch{}zK=!0}else typeof navigator=="object"&&!K2?(_U=navigator.userAgent,aX=_U.indexOf("Windows")>=0,tX=_U.indexOf("Macintosh")>=0,G2=(_U.indexOf("Macintosh")>=0||_U.indexOf("iPad")>=0||_U.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,GX=_U.indexOf("Linux")>=0,V2=_U?.indexOf("Mobi")>=0,LK=!0,nX=globalThis._VSCODE_NLS_LANGUAGE||RZ,wX=navigator.language.toLowerCase(),H$=wX):console.error("Unable to resolve platform.");var OJ=0;tX?OJ=1:aX?OJ=3:GX&&(OJ=2);var qK=aX,TU=tX,W2=GX,CJ=zK,I2=LK&&typeof xU.importScripts=="function",OA=I2?xU.origin:void 0,RU=_U,hU=nX,F2;((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 G(){return hU==="en"}U.isDefault=G})(F2||={});var H2=typeof xU.postMessage=="function"&&!xU.importScripts,O2=(()=>{if(H2){let U=[];xU.addEventListener("message",(X)=>{if(X.data&&X.data.vscodeScheduleAsyncWork)for(let G=0,K=U.length;G<K;G++){let F=U[G];if(F.id===X.data.vscodeScheduleAsyncWork){U.splice(G,1),F.callback();return}}});let Z=0;return(X)=>{let G=++Z;U.push({id:G,callback:X}),xU.postMessage({vscodeScheduleAsyncWork:G},"*")}}return(U)=>setTimeout(U)})(),C2=!!(RU&&RU.indexOf("Chrome")>=0),CA=!!(RU&&RU.indexOf("Firefox")>=0),AA=!!(!C2&&RU&&RU.indexOf("Safari")>=0),DA=!!(RU&&RU.indexOf("Edg/")>=0),zA=!!(RU&&RU.indexOf("Android")>=0),uU=typeof navigator=="object"?navigator:{},LA={clipboard:{writeText:CJ||document.queryCommandSupported&&document.queryCommandSupported("copy")||!!(uU&&uU.clipboard&&uU.clipboard.writeText),readText:CJ||!!(uU&&uU.clipboard&&uU.clipboard.readText)},keyboard:CJ||X2()?0:uU.keyboard||DK?1:2,touch:"ontouchstart"in $U||uU.maxTouchPoints>0,pointerEvents:$U.PointerEvent&&(("ontouchstart"in $U)||navigator.maxTouchPoints>0)},KG=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}},AJ=new KG,O$=new KG,C$=new KG,A2=Array(230),TK;((U)=>{function Z(L){return AJ.keyCodeToStr(L)}U.toString=Z;function X(L){return AJ.strToKeyCode(L)}U.fromString=X;function G(L){return O$.keyCodeToStr(L)}U.toUserSettingsUS=G;function K(L){return C$.keyCodeToStr(L)}U.toUserSettingsGeneral=K;function F(L){return O$.strToKeyCode(L)||C$.strToKeyCode(L)}U.fromUserSettings=F;function $(L){if(L>=98&&L<=113)return null;switch(L){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return AJ.keyCodeToStr(L)}U.toElectronAccelerator=$})(TK||={});var D2=class U{constructor(Z,X,G,K,F){this.ctrlKey=Z,this.shiftKey=X,this.altKey=G,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",G=this.altKey?"1":"0",K=this.metaKey?"1":"0";return`K${Z}${X}${G}${K}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new z2([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},z2=class{constructor(U){if(U.length===0)throw vO("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 L2(U){if(U.charCode){let X=String.fromCharCode(U.charCode).toUpperCase();return TK.fromString(X)}let Z=U.keyCode;if(Z===3)return 7;if(cJ)switch(Z){case 59:return 85;case 60:if(W2)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(lX){if(TU&&Z===93)return 57;if(!TU&&Z===92)return 57}return A2[Z]||0}var M2=TU?256:2048,q2=512,T2=1024,R2=TU?2048:256,hJ=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=L2(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|=M2),this.altKey&&(Z|=q2),this.shiftKey&&(Z|=T2),this.metaKey&&(Z|=R2),Z|=U,Z}_computeKeyCodeChord(){let U=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(U=this.keyCode),new D2(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,U)}},A$=new WeakMap;function S2(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 E2=class{static getSameOriginWindowChain(U){let Z=A$.get(U);if(!Z){Z=[],A$.set(U,Z);let X=U,G;do G=S2(X),G?Z.push({window:new WeakRef(X),iframeElement:X.frameElement||null}):Z.push({window:new WeakRef(X),iframeElement:null}),X=G;while(X)}return Z.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(U,Z){if(!Z||U===Z)return{top:0,left:0};let X=0,G=0,K=this.getSameOriginWindowChain(U);for(let F of K){let $=F.window.deref();if(X+=$?.scrollY??0,G+=$?.scrollX??0,$===Z||!F.iframeElement)break;let L=F.iframeElement.getBoundingClientRect();X+=L.top,G+=L.left}return{top:X,left:G}}},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=E2.getPositionOfChildWindowRelativeToAncestorWindow(U,Z.view);this.posx-=X.left,this.posy-=X.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},D$=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 G=!1;if($G){let K=navigator.userAgent.match(/Chrome\/(\d+)/);G=(K?parseInt(K[1]):123)<=122}if(U){let K=U,F=U,$=U.view?.devicePixelRatio||1;if(typeof K.wheelDeltaY<"u")G?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 L=U;L.deltaMode===L.DOM_DELTA_LINE?cJ&&!TU?this.deltaY=-U.deltaY/3:this.deltaY=-U.deltaY:this.deltaY=-U.deltaY/40}if(typeof K.wheelDeltaX<"u")DK&&qK?this.deltaX=-(K.wheelDeltaX/120):G?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 L=U;L.deltaMode===L.DOM_DELTA_LINE?cJ&&!TU?this.deltaX=-U.deltaX/3:this.deltaX=-U.deltaX:this.deltaX=-U.deltaX/40}this.deltaY===0&&this.deltaX===0&&U.wheelDelta&&(G?this.deltaY=U.wheelDelta/(120*$):this.deltaY=U.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},RK=Object.freeze(function(U,Z){let X=setTimeout(U.bind(Z),0);return{dispose(){clearTimeout(X)}}}),P2;((U)=>{function Z(X){return X===U.None||X===U.Cancelled||X instanceof k2?!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:RK})})(P2||={});var k2=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?RK:(this._emitter||(this._emitter=new w0),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},MA=Symbol("MicrotaskDelay"),WG=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 gJ("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,U()},Z)}setIfNotSet(U,Z){if(this._isDisposed)throw new gJ("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,U()},Z))}},j2=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 gJ("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let G=X.setInterval(()=>{U()},Z);this.disposable=U1(()=>{X.clearInterval(G),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},v2,DJ;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?DJ=(U,Z)=>{O2(()=>{if(X)return;let G=Date.now()+15;Z(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,G-Date.now())}}))});let X=!1;return{dispose(){X||(X=!0)}}}:DJ=(U,Z,X)=>{let G=U.requestIdleCallback(Z,typeof X=="number"?{timeout:X}:void 0),K=!1;return{dispose(){K||(K=!0,U.cancelIdleCallback(G))}}},v2=(U)=>DJ(globalThis,U)})();var _2;((U)=>{async function Z(G){let K,F=await Promise.all(G.map(($)=>$.then((L)=>L,(L)=>{K||(K=L)})));if(typeof K<"u")throw K;return F}U.settled=Z;function X(G){return new Promise(async(K,F)=>{try{await G(K,F)}catch($){F($)}})}U.withAsyncBody=X})(_2||={});var z$=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(G)=>X.emitOne(await G)))})}static merge(Z){return new U(async(X)=>{await Promise.all(Z.map(async(G)=>{for await(let K of G)X.emitOne(K)}))})}constructor(Z,X){this._state=0,this._results=[],this._error=null,this._onReturn=X,this._onStateChanged=new w0,queueMicrotask(async()=>{let G={emitOne:(K)=>this.emitOne(K),emitMany:(K)=>this.emitMany(K),reject:(K)=>this.reject(K)};try{await Promise.resolve(Z(G)),this.resolve()}catch(K){this.reject(K)}finally{G.emitOne=void 0,G.emitMany=void 0,G.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(G)=>{for await(let K of Z)G.emitOne(X(K))})}map(Z){return U.map(this,Z)}static filter(Z,X){return new U(async(G)=>{for await(let K of Z)X(K)&&G.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 G of Z)X.push(G);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())}};z$.EMPTY=z$.fromArray([]);function B2(U){return 55296<=U&&U<=56319}function L$(U){return 56320<=U&&U<=57343}function x2(U,Z){return(U-55296<<10)+(Z-56320)+65536}function N2(U){return IG(U,0)}function IG(U,Z){switch(typeof U){case"object":return U===null?BU(349,Z):Array.isArray(U)?f2(U,Z):w2(U,Z);case"string":return SK(U,Z);case"boolean":return g2(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 g2(U,Z){return BU(U?433:863,Z)}function SK(U,Z){Z=BU(149417,Z);for(let X=0,G=U.length;X<G;X++)Z=BU(U.charCodeAt(X),Z);return Z}function f2(U,Z){return Z=BU(104579,Z),U.reduce((X,G)=>IG(G,X),Z)}function w2(U,Z){return Z=BU(181387,Z),Object.keys(U).sort().reduce((X,G)=>(X=SK(G,X),IG(U[G],X)),Z)}function zJ(U,Z,X=32){let G=X-Z,K=~((1<<G)-1);return(U<<Z|(K&U)>>>G)>>>0}function M$(U,Z=0,X=U.byteLength,G=0){for(let K=0;K<X;K++)U[Z+K]=G}function y2(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(""):y2((U>>>0).toString(16),Z/4)}var p2=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 G=this._buff,K=this._buffLen,F=this._leftoverHighSurrogate,$,L;for(F!==0?($=F,L=-1,F=0):($=Z.charCodeAt(0),L=0);;){let M=$;if(B2($))if(L+1<X){let D=Z.charCodeAt(L+1);L$(D)?(L++,M=x2($,D)):M=65533}else{F=$;break}else L$($)&&(M=65533);if(K=this._push(G,K,M),L++,L<X)$=Z.charCodeAt(L);else break}this._buffLen=K,this._leftoverHighSurrogate=F}_push(Z,X,G){return G<128?Z[X++]=G:G<2048?(Z[X++]=192|(G&1984)>>>6,Z[X++]=128|(G&63)>>>0):G<65536?(Z[X++]=224|(G&61440)>>>12,Z[X++]=128|(G&4032)>>>6,Z[X++]=128|(G&63)>>>0):(Z[X++]=240|(G&1835008)>>>18,Z[X++]=128|(G&258048)>>>12,Z[X++]=128|(G&4032)>>>6,Z[X++]=128|(G&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,M$(this._buff,this._buffLen),this._buffLen>56&&(this._step(),M$(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,zJ(Z.getUint32(A-12,!1)^Z.getUint32(A-32,!1)^Z.getUint32(A-56,!1)^Z.getUint32(A-64,!1),1),!1);let G=this._h0,K=this._h1,F=this._h2,$=this._h3,L=this._h4,M,D,T;for(let A=0;A<80;A++)A<20?(M=K&F|~K&$,D=1518500249):A<40?(M=K^F^$,D=1859775393):A<60?(M=K&F|K&$|F&$,D=2400959708):(M=K^F^$,D=3395469782),T=zJ(G,5)+M+L+D+Z.getUint32(A*4,!1)&4294967295,L=$,$=F,F=zJ(K,30),K=G,G=T;this._h0=this._h0+G&4294967295,this._h1=this._h1+K&4294967295,this._h2=this._h2+F&4294967295,this._h3=this._h3+$&4294967295,this._h4=this._h4+L&4294967295}};p2._bigBlock32=new DataView(new ArrayBuffer(320));var{registerWindow:qA,getWindow:OU,getDocument:TA,getWindows:RA,getWindowsCount:SA,getWindowId:q$,getWindowById:EA,hasWindow:PA,onDidRegisterWindow:c2,onWillUnregisterWindow:kA,onDidUnregisterWindow:jA}=function(){let U=new Map,Z={window:$U,disposables:new nU};U.set($U.vscodeWindowId,Z);let X=new w0,G=new w0,K=new w0;function F($,L){return(typeof $=="number"?U.get($):void 0)??(L?Z:void 0)}return{onDidRegisterWindow:X.event,onWillUnregisterWindow:K.event,onDidUnregisterWindow:G.event,registerWindow($){if(U.has($.vscodeWindowId))return d0.None;let L=new nU,M={window:$,disposables:L.add(new nU)};return U.set($.vscodeWindowId,M),L.add(U1(()=>{U.delete($.vscodeWindowId),G.fire($)})),L.add(u0($,f1.BEFORE_UNLOAD,()=>{K.fire($)})),X.fire(M),L},getWindows(){return U.values()},getWindowsCount(){return U.size},getWindowId($){return $.vscodeWindowId},hasWindow($){return U.has($)},getWindowById:F,getWindow($){let L=$;if(L?.ownerDocument?.defaultView)return L.ownerDocument.defaultView.window;let M=$;return M?.view?M.view.window:$U},getDocument($){return OU($).document}}}(),h2=class{constructor(U,Z,X,G){this._node=U,this._type=Z,this._handler=X,this._options=G||!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,G){return new h2(U,Z,X,G)}function u2(U,Z){return function(X){return Z(new eZ(U,X))}}function b2(U){return function(Z){return U(new hJ(Z))}}var T$=function(U,Z,X,G){let K=X;return Z==="click"||Z==="mousedown"||Z==="contextmenu"?K=u2(OU(U),X):(Z==="keydown"||Z==="keypress"||Z==="keyup")&&(K=b2(X)),u0(U,Z,K,G)},d2,iX,l2=class extends j2{constructor(U){super(),this.defaultTarget=U&&OU(U)}cancelAndSet(U,Z,X){return super.cancelAndSet(U,Z,X??this.defaultTarget)}},LJ=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){uX(U)}}static sort(U,Z){return Z.priority-U.priority}};(function(){let U=new Map,Z=new Map,X=new Map,G=new Map,K=(F)=>{X.set(F,!1);let $=U.get(F)??[];for(Z.set(F,$),U.set(F,[]),G.set(F,!0);$.length>0;)$.sort(LJ.sort),$.shift().execute();G.set(F,!1)};iX=(F,$,L=0)=>{let M=q$(F),D=new LJ($,L),T=U.get(M);return T||(T=[],U.set(M,T)),T.push(D),X.get(M)||(X.set(M,!0),F.requestAnimationFrame(()=>K(M))),D},d2=(F,$,L)=>{let M=q$(F);if(G.get(M)){let D=new LJ($,L),T=Z.get(M);return T||(T=[],Z.set(M,T)),T.push(D),D}else return iX(F,$,L)}})();var R$=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}};R$.None=new R$(0,0);function o2(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 vA=new class{constructor(){this.mutationObservers=new Map}observe(U,Z,X){let G=this.mutationObservers.get(U);G||(G=new Map,this.mutationObservers.set(U,G));let K=N2(X),F=G.get(K);if(F)F.users+=1;else{let $=new w0,L=new MutationObserver((D)=>$.fire(D));L.observe(U,X);let M=F={users:1,observer:L,onDidMutate:$.event};Z.add(U1(()=>{M.users-=1,M.users===0&&($.dispose(),L.disconnect(),G?.delete(K),G?.size===0&&this.mutationObservers.delete(U))})),G.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:lX?"webkitAnimationStart":"animationstart",ANIMATION_END:lX?"webkitAnimationEnd":"animationend",ANIMATION_ITERATION:lX?"webkitAnimationIteration":"animationiteration"},n2=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function EK(U,Z,X,...G){let K=n2.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(([L,M])=>{typeof M>"u"||(/^on\w+$/.test(L)?$[L]=M:L==="selected"?M&&$.setAttribute(L,"true"):$.setAttribute(L,M))}),$.append(...G),$}function m2(U,Z,...X){return EK("http://www.w3.org/1999/xhtml",U,Z,...X)}m2.SVG=function(U,Z,...X){return EK("http://www.w3.org/2000/svg",U,Z,...X)};var s2=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 QX(U){return new s2(U)}var PK=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,G,K){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=G,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 r2(U,Z,X){let G=null,K=null;if(typeof X.value=="function"?(G="value",K=X.value,K.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof X.get=="function"&&(G="get",K=X.get),!K)throw Error("not supported");let F=`$memoize$${Z}`;X[G]=function(...$){return this.hasOwnProperty(F)||Object.defineProperty(this,F,{configurable:!1,enumerable:!1,writable:!1,value:K.apply(this,$)}),this[F]}}var qU;((U)=>(U.Tap="-xterm-gesturetap",U.Change="-xterm-gesturechange",U.Start="-xterm-gesturestart",U.End="-xterm-gesturesend",U.Contextmenu="-xterm-gesturecontextmenu"))(qU||={});var UX=class U extends d0{constructor(){super();this.dispatched=!1,this.targets=new W$,this.ignoreTargets=new W$,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(b1.runAndSubscribe(c2,({window:Z,disposables:X})=>{X.add(u0(Z.document,"touchstart",(G)=>this.onTouchStart(G),{passive:!1})),X.add(u0(Z.document,"touchend",(G)=>this.onTouchEnd(Z,G))),X.add(u0(Z.document,"touchmove",(G)=>this.onTouchMove(G),{passive:!1}))},{window:$U,disposables:this._store}))}static addTarget(Z){if(!U.isTouchDevice())return d0.None;U.INSTANCE||(U.INSTANCE=K$(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=K$(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 G=0,K=Z.targetTouches.length;G<K;G++){let F=Z.targetTouches.item(G);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(qU.Start,F.target);$.pageX=F.pageX,$.pageY=F.pageY,this.dispatchEvent($)}this.dispatched&&(Z.preventDefault(),Z.stopPropagation(),this.dispatched=!1)}onTouchEnd(Z,X){let G=Date.now(),K=Object.keys(this.activeTouches).length;for(let F=0,$=X.changedTouches.length;F<$;F++){let L=X.changedTouches.item(F);if(!this.activeTouches.hasOwnProperty(String(L.identifier))){console.warn("move of an UNKNOWN touch",L);continue}let M=this.activeTouches[L.identifier],D=Date.now()-M.initialTimeStamp;if(D<U.HOLD_DELAY&&Math.abs(M.initialPageX-GU(M.rollingPageX))<30&&Math.abs(M.initialPageY-GU(M.rollingPageY))<30){let T=this.newGestureEvent(qU.Tap,M.initialTarget);T.pageX=GU(M.rollingPageX),T.pageY=GU(M.rollingPageY),this.dispatchEvent(T)}else if(D>=U.HOLD_DELAY&&Math.abs(M.initialPageX-GU(M.rollingPageX))<30&&Math.abs(M.initialPageY-GU(M.rollingPageY))<30){let T=this.newGestureEvent(qU.Contextmenu,M.initialTarget);T.pageX=GU(M.rollingPageX),T.pageY=GU(M.rollingPageY),this.dispatchEvent(T)}else if(K===1){let T=GU(M.rollingPageX),A=GU(M.rollingPageY),q=GU(M.rollingTimestamps)-M.rollingTimestamps[0],S=T-M.rollingPageX[0],E=A-M.rollingPageY[0],j=[...this.targets].filter((k)=>M.initialTarget instanceof Node&&k.contains(M.initialTarget));this.inertia(Z,j,G,Math.abs(S)/q,S>0?1:-1,T,Math.abs(E)/q,E>0?1:-1,A)}this.dispatchEvent(this.newGestureEvent(qU.End,M.initialTarget)),delete this.activeTouches[L.identifier]}this.dispatched&&(X.preventDefault(),X.stopPropagation(),this.dispatched=!1)}newGestureEvent(Z,X){let G=document.createEvent("CustomEvent");return G.initEvent(Z,!1,!0),G.initialTarget=X,G.tapCount=0,G}dispatchEvent(Z){if(Z.type===qU.Tap){let X=new Date().getTime(),G=0;X-this._lastSetTapCountTime>U.CLEAR_TAP_COUNT_TIME?G=1:G=2,this._lastSetTapCountTime=X,Z.tapCount=G}else(Z.type===qU.Change||Z.type===qU.Contextmenu)&&(this._lastSetTapCountTime=0);if(Z.initialTarget instanceof Node){for(let G of this.ignoreTargets)if(G.contains(Z.initialTarget))return;let X=[];for(let G of this.targets)if(G.contains(Z.initialTarget)){let K=0,F=Z.initialTarget;for(;F&&F!==G;)K++,F=F.parentElement;X.push([K,G])}X.sort((G,K)=>G[0]-K[0]);for(let[G,K]of X)K.dispatchEvent(Z),this.dispatched=!0}}inertia(Z,X,G,K,F,$,L,M,D){this.handle=iX(Z,()=>{let T=Date.now(),A=T-G,q=0,S=0,E=!0;K+=U.SCROLL_FRICTION*A,L+=U.SCROLL_FRICTION*A,K>0&&(E=!1,q=F*K*A),L>0&&(E=!1,S=M*L*A);let j=this.newGestureEvent(qU.Change);j.translationX=q,j.translationY=S,X.forEach((k)=>k.dispatchEvent(j)),E||this.inertia(Z,X,T,K,F,$+q,L,M,D+S)})}onTouchMove(Z){let X=Date.now();for(let G=0,K=Z.changedTouches.length;G<K;G++){let F=Z.changedTouches.item(G);if(!this.activeTouches.hasOwnProperty(String(F.identifier))){console.warn("end of an UNKNOWN touch",F);continue}let $=this.activeTouches[F.identifier],L=this.newGestureEvent(qU.Change,$.initialTarget);L.translationX=F.pageX-GU($.rollingPageX),L.translationY=F.pageY-GU($.rollingPageY),L.pageX=F.pageX,L.pageY=F.pageY,this.dispatchEvent(L),$.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([r2],UX,"isTouchDevice",1);var a2=UX,FG=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 hJ(X))))}onkeyup(U,Z){this._register(u0(U,f1.KEY_UP,(X)=>Z(new hJ(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 a2.ignoreTarget(U)}},S$=11,t2=class extends FG{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=S$+"px",this.domNode.style.height=S$+"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 PK),this._register(T$(this.bgDomNode,f1.POINTER_DOWN,(Z)=>this._arrowPointerDown(Z))),this._register(T$(this.domNode,f1.POINTER_DOWN,(Z)=>this._arrowPointerDown(Z))),this._pointerdownRepeatTimer=this._register(new l2),this._pointerdownScheduleRepeatTimer=this._register(new WG)}_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()}},i2=class U{constructor(Z,X,G,K,F,$,L){this._forceIntegerValues=Z,this._scrollStateBrand=void 0,this._forceIntegerValues&&(X=X|0,G=G|0,K=K|0,F=F|0,$=$|0,L=L|0),this.rawScrollLeft=K,this.rawScrollTop=L,X<0&&(X=0),K+X>G&&(K=G-X),K<0&&(K=0),F<0&&(F=0),L+F>$&&(L=$-F),L<0&&(L=0),this.width=X,this.scrollWidth=G,this.scrollLeft=K,this.height=F,this.scrollHeight=$,this.scrollTop=L}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 G=this.width!==Z.width,K=this.scrollWidth!==Z.scrollWidth,F=this.scrollLeft!==Z.scrollLeft,$=this.height!==Z.height,L=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:G,scrollWidthChanged:K,scrollLeftChanged:F,heightChanged:$,scrollHeightChanged:L,scrollTopChanged:M}}},e2=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 i2(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 G;Z?G=new P$(this._smoothScrolling.from,X,this._smoothScrolling.startTime,this._smoothScrolling.duration):G=this._smoothScrolling.combine(this._state,X,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=G}else{let X=this._state.withScrollPosition(U);this._smoothScrolling=P$.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)))}},E$=class{constructor(U,Z,X){this.scrollLeft=U,this.scrollTop=Z,this.isDone=X}};function MJ(U,Z){let X=Z-U;return function(G){return U+X*XC(G)}}function UC(U,Z,X){return function(G){return G<X?U(G/X):Z((G-X)/(1-X))}}var P$=class U{constructor(Z,X,G,K){this.from=Z,this.to=X,this.duration=K,this.startTime=G,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,G){if(Math.abs(Z-X)>2.5*G){let K,F;return Z<X?(K=Z+0.75*G,F=X-0.75*G):(K=Z-0.75*G,F=X+0.75*G),UC(MJ(Z,K),MJ(F,X),0.33)}return MJ(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 G=this.scrollLeft(X),K=this.scrollTop(X);return new E$(G,K,!1)}return new E$(this.to.scrollLeft,this.to.scrollTop,!0)}combine(Z,X,G){return U.start(Z,X,G)}static start(Z,X,G){G=G+10;let K=Date.now()-10;return new U(Z,X,K,G)}};function ZC(U){return Math.pow(U,3)}function XC(U){return 1-ZC(1-U)}var YC=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 WG)}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":"")))}},JC=140,kK=class extends FG{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 YC(U.visibility,"visible scrollbar "+U.extraScrollbarClassName,"invisible scrollbar "+U.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new PK),this._shouldRender=!0,this.domNode=QX(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 t2(U));this.domNode.domNode.appendChild(Z.bgDomNode),this.domNode.domNode.appendChild(Z.domNode)}_createSlider(U,Z,X,G){this.slider=QX(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 G=="number"&&this.slider.setHeight(G),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(),G=Z+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),K=this._sliderPointerPosition(U);X<=K&&K<=G?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=o2(this.domNode.domNode);Z=U.pageX-K.left,X=U.pageY-K.top}let G=this._pointerDownRelativePosition(Z,X);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(G):this._scrollbarState.getDesiredScrollPositionFromOffset(G)),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),G=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(qK&&$>JC){this._setDesiredScrollPositionNow(G.getScrollPosition());return}let L=this._sliderPointerPosition(K)-Z;this._setDesiredScrollPositionNow(G.getDesiredScrollPositionFromDelta(L))},()=>{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()}},jK=class U{constructor(Z,X,G,K,F,$){this._scrollbarSize=Math.round(X),this._oppositeScrollbarSize=Math.round(G),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,G,K,F){let $=Math.max(0,G-Z),L=Math.max(0,$-2*X),M=K>0&&K>G;if(!M)return{computedAvailableSize:Math.round($),computedIsNeeded:M,computedSliderSize:Math.round(L),computedSliderRatio:0,computedSliderPosition:0};let D=Math.round(Math.max(20,Math.floor(G*L/K))),T=(L-D)/(K-G),A=F*T;return{computedAvailableSize:Math.round($),computedIsNeeded:M,computedSliderSize:Math.round(D),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,G=this._scrollPosition;return X<this._computedSliderPosition?G-=this._visibleSize:G+=this._visibleSize,G}getDesiredScrollPositionFromDelta(Z){if(!this._computedIsNeeded)return 0;let X=this._computedSliderPosition+Z;return Math.round(X/this._computedSliderRatio)}},GC=class extends kK{constructor(U,Z,X){let G=U.getScrollDimensions(),K=U.getCurrentScrollPosition();if(super({lazyRender:Z.lazyRender,host:X,scrollbarState:new jK(Z.horizontalHasArrows?Z.arrowSize:0,Z.horizontal===2?0:Z.horizontalScrollbarSize,Z.vertical===2?0:Z.verticalScrollbarSize,G.width,G.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}},QC=class extends kK{constructor(U,Z,X){let G=U.getScrollDimensions(),K=U.getCurrentScrollPosition();if(super({lazyRender:Z.lazyRender,host:X,scrollbarState:new jK(Z.verticalHasArrows?Z.arrowSize:0,Z.vertical===2?0:Z.verticalScrollbarSize,0,G.height,G.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}},VC=500,k$=50,j$=!0,$C=class{constructor(U,Z,X){this.timestamp=U,this.deltaX=Z,this.deltaY=X,this.score=0}},uJ=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,G=1,K=this._rear;do{let F=K===this._front?Z:Math.pow(2,-G);if(Z-=F,X+=this._memory[K].score*F,K===this._front)break;K=(this._capacity+K-1)%this._capacity,G++}while(!0);return X<=0.5}acceptStandardWheelEvent(Z){if($G){let X=OU(Z.browserEvent),G=Z2(X);this.accept(Date.now(),Z.deltaX*G,Z.deltaY*G)}else this.accept(Date.now(),Z.deltaX,Z.deltaY)}accept(Z,X,G){let K=null,F=new $C(Z,X,G);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 G=0.5;if((!this._isAlmostInt(Z.deltaX)||!this._isAlmostInt(Z.deltaY))&&(G+=0.25),X){let K=Math.abs(Z.deltaX),F=Math.abs(Z.deltaY),$=Math.abs(X.deltaX),L=Math.abs(X.deltaY),M=Math.max(Math.min(K,$),1),D=Math.max(Math.min(F,L),1),T=Math.max(K,$),A=Math.max(F,L);T%M===0&&A%D===0&&(G-=0.5)}return Math.min(Math.max(G,0),1)}_isAlmostInt(Z){return Math.abs(Math.round(Z)-Z)<0.01}};uJ.INSTANCE=new uJ;var KC=uJ,WC=class extends FG{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=FC(Z),this._scrollable=X,this._register(this._scrollable.onScroll((K)=>{this._onWillScroll.fire(K),this._onDidScroll(K),this._onScroll.fire(K)}));let G={onMouseWheel:(K)=>this._onMouseWheel(K),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new QC(this._scrollable,this._options,G)),this._horizontalScrollbar=this._register(new GC(this._scrollable,this._options,G)),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=QX(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=QX(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=QX(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 WG),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 D$(U))}_setListeningToMouseWheel(U){if(this._mouseWheelToDispose.length>0!==U&&(this._mouseWheelToDispose=VZ(this._mouseWheelToDispose),U)){let Z=(X)=>{this._onMouseWheel(new D$(X))};this._mouseWheelToDispose.push(u0(this._listenOnDomNode,f1.MOUSE_WHEEL,Z,{passive:!1}))}}_onMouseWheel(U){if(U.browserEvent?.defaultPrevented)return;let Z=KC.INSTANCE;j$&&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 L=this._scrollable.getFutureScrollPosition(),M={};if(K){let D=k$*K,T=L.scrollTop-(D<0?Math.floor(D):Math.ceil(D));this._verticalScrollbar.writeScrollPosition(M,T)}if(F){let D=k$*F,T=L.scrollLeft-(D<0?Math.floor(D):Math.ceil(D));this._horizontalScrollbar.writeScrollPosition(M,T)}M=this._scrollable.validateScrollPosition(M),(L.scrollLeft!==M.scrollLeft||L.scrollTop!==M.scrollTop)&&(j$&&this._options.mouseWheelSmoothScroll&&Z.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(M):this._scrollable.setScrollPositionNow(M),X=!0)}let G=X;!G&&this._options.alwaysConsumeMouseWheel&&(G=!0),!G&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(G=!0),G&&(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,G=X?" left":"",K=Z?" top":"",F=X||Z?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${G}`),this._topShadowDomNode.setClassName(`shadow${K}`),this._topLeftShadowDomNode.setClassName(`shadow${F}${K}${G}`)}}_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(),VC)}},IC=class extends WC{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 FC(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 bJ=class extends d0{constructor(U,Z,X,G,K,F,$,L){super();this._bufferService=X,this._optionsService=$,this._renderService=L,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 e2({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:(D)=>iX(G.window,D)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{M.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new IC(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((D)=>{this._scrollableElement.updateOptions({handleMouseWheel:!(D&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=G.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(`
|
|
457
|
-
`)})),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((D)=>this._handleScroll(D)))}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}};bJ=$1([p0(2,r1),p0(3,NU),p0(4,$K),p0(5,EZ),p0(6,a1),p0(7,gU)],bJ);var dJ=class extends d0{constructor(U,Z,X,G,K){super();this._screenElement=U,this._bufferService=Z,this._coreBrowserService=X,this._decorationService=G,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()}};dJ=$1([p0(1,r1),p0(2,NU),p0(3,FX),p0(4,gU)],dJ);var HC=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)}},LU={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},eX=class extends d0{constructor(U,Z,X,G,K,F,$,L){super();this._viewportElement=U,this._screenElement=Z,this._bufferService=X,this._decorationService=G,this._renderService=K,this._optionsService=F,this._themeService=$,this._coreBrowserService=L,this._colorZoneStore=new HC,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(){LU.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);LU.left=Z,LU.center=Z,LU.right=Z}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*LU.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*LU.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*LU.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*LU.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)-LU[U.position||"full"]/2),bU[U.position||"full"],Math.round((this._canvas.height-1)*((U.endBufferLine-U.startBufferLine)/this._bufferService.buffers.active.lines.length)+LU[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}))}};eX=$1([p0(2,r1),p0(3,FX),p0(4,gU),p0(5,a1),p0(6,EZ),p0(7,NU)],eX);var z0;((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=`
|
|
458
|
-
`,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=""))(z0||={});var mX;((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=""))(mX||={});var vK;((U)=>U.ST=`${z0.ESC}\\`)(vK||={});var lJ=class{constructor(U,Z,X,G,K,F){this._textarea=U,this._compositionView=Z,this._bufferService=X,this._optionsService=G,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(`${z0.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,G=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=G+"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=G+"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)}}};lJ=$1([p0(2,r1),p0(3,a1),p0(4,KZ),p0(5,gU)],lJ);var w1=0,y1=0,p1=0,V1=0,v$={css:"#00000000",rgba:0},F1;((U)=>{function Z(K,F,$,L){return L!==void 0?`#${XZ(K)}${XZ(F)}${XZ($)}${XZ(L)}`:`#${XZ(K)}${XZ(F)}${XZ($)}`}U.toCss=Z;function X(K,F,$,L=255){return(K<<24|F<<16|$<<8|L)>>>0}U.toRgba=X;function G(K,F,$,L){return{css:U.toCss(K,F,$,L),rgba:U.toRgba(K,F,$,L)}}U.toColor=G})(F1||={});var e0;((U)=>{function Z(M,D){if(V1=(D.rgba&255)/255,V1===1)return{css:D.css,rgba:D.rgba};let T=D.rgba>>24&255,A=D.rgba>>16&255,q=D.rgba>>8&255,S=M.rgba>>24&255,E=M.rgba>>16&255,j=M.rgba>>8&255;w1=S+Math.round((T-S)*V1),y1=E+Math.round((A-E)*V1),p1=j+Math.round((q-j)*V1);let k=F1.toCss(w1,y1,p1),B=F1.toRgba(w1,y1,p1);return{css:k,rgba:B}}U.blend=Z;function X(M){return(M.rgba&255)===255}U.isOpaque=X;function G(M,D,T){let A=sX.ensureContrastRatio(M.rgba,D.rgba,T);if(A)return F1.toColor(A>>24&255,A>>16&255,A>>8&255)}U.ensureContrastRatio=G;function K(M){let D=(M.rgba|255)>>>0;return[w1,y1,p1]=sX.toChannels(D),{css:F1.toCss(w1,y1,p1),rgba:D}}U.opaque=K;function F(M,D){return V1=Math.round(D*255),[w1,y1,p1]=sX.toChannels(M.rgba),{css:F1.toCss(w1,y1,p1,V1),rgba:F1.toRgba(w1,y1,p1,V1)}}U.opacity=F;function $(M,D){return V1=M.rgba&255,F(M,V1*D/255)}U.multiplyOpacity=$;function L(M){return[M.rgba>>24&255,M.rgba>>16&255,M.rgba>>8&255]}U.toColorRGB=L})(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 G(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),p1=parseInt(K.slice(3,4).repeat(2),16),F1.toColor(w1,y1,p1);case 5:return w1=parseInt(K.slice(1,2).repeat(2),16),y1=parseInt(K.slice(2,3).repeat(2),16),p1=parseInt(K.slice(3,4).repeat(2),16),V1=parseInt(K.slice(4,5).repeat(2),16),F1.toColor(w1,y1,p1,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]),p1=parseInt(F[3]),V1=Math.round((F[5]===void 0?1:parseFloat(F[5]))*255),F1.toColor(w1,y1,p1,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,p1,V1]=Z.getImageData(0,0,1,1).data,V1!==255)throw Error("css.toColor: Unsupported css format");return{rgba:F1.toRgba(w1,y1,p1,V1),css:K}}U.toColor=G})(Y1||={});var s1;((U)=>{function Z(G){return X(G>>16&255,G>>8&255,G&255)}U.relativeLuminance=Z;function X(G,K,F){let $=G/255,L=K/255,M=F/255,D=$<=0.03928?$/12.92:Math.pow(($+0.055)/1.055,2.4),T=L<=0.03928?L/12.92:Math.pow((L+0.055)/1.055,2.4),A=M<=0.03928?M/12.92:Math.pow((M+0.055)/1.055,2.4);return D*0.2126+T*0.7152+A*0.0722}U.relativeLuminance2=X})(s1||={});var sX;((U)=>{function Z($,L){if(V1=(L&255)/255,V1===1)return L;let M=L>>24&255,D=L>>16&255,T=L>>8&255,A=$>>24&255,q=$>>16&255,S=$>>8&255;return w1=A+Math.round((M-A)*V1),y1=q+Math.round((D-q)*V1),p1=S+Math.round((T-S)*V1),F1.toRgba(w1,y1,p1)}U.blend=Z;function X($,L,M){let D=s1.relativeLuminance($>>8),T=s1.relativeLuminance(L>>8);if(vU(D,T)<M){if(T<D){let S=G($,L,M),E=vU(D,s1.relativeLuminance(S>>8));if(E<M){let j=K($,L,M),k=vU(D,s1.relativeLuminance(j>>8));return E>k?S:j}return S}let A=K($,L,M),q=vU(D,s1.relativeLuminance(A>>8));if(q<M){let S=G($,L,M),E=vU(D,s1.relativeLuminance(S>>8));return q>E?A:S}return A}}U.ensureContrastRatio=X;function G($,L,M){let D=$>>24&255,T=$>>16&255,A=$>>8&255,q=L>>24&255,S=L>>16&255,E=L>>8&255,j=vU(s1.relativeLuminance2(q,S,E),s1.relativeLuminance2(D,T,A));for(;j<M&&(q>0||S>0||E>0);)q-=Math.max(0,Math.ceil(q*0.1)),S-=Math.max(0,Math.ceil(S*0.1)),E-=Math.max(0,Math.ceil(E*0.1)),j=vU(s1.relativeLuminance2(q,S,E),s1.relativeLuminance2(D,T,A));return(q<<24|S<<16|E<<8|255)>>>0}U.reduceLuminance=G;function K($,L,M){let D=$>>24&255,T=$>>16&255,A=$>>8&255,q=L>>24&255,S=L>>16&255,E=L>>8&255,j=vU(s1.relativeLuminance2(q,S,E),s1.relativeLuminance2(D,T,A));for(;j<M&&(q<255||S<255||E<255);)q=Math.min(255,q+Math.ceil((255-q)*0.1)),S=Math.min(255,S+Math.ceil((255-S)*0.1)),E=Math.min(255,E+Math.ceil((255-E)*0.1)),j=vU(s1.relativeLuminance2(q,S,E),s1.relativeLuminance2(D,T,A));return(q<<24|S<<16|E<<8|255)>>>0}U.increaseLuminance=K;function F($){return[$>>24&255,$>>16&255,$>>8&255,$&255]}U.toChannels=F})(sX||={});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 OC=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()]}},UY=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=[],G=Z.translateToString(!0),K=0,F=0,$=0,L=Z.getFg(0),M=Z.getBg(0);for(let D=0;D<Z.getTrimmedLength();D++)if(Z.loadCell(D,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==L||this._workCell.bg!==M){if(D-K>1){let T=this._getJoinedRanges(G,$,F,Z,K);for(let A=0;A<T.length;A++)X.push(T[A])}K=D,$=F,L=this._workCell.fg,M=this._workCell.bg}F+=this._workCell.getChars().length||oU.length}if(this._bufferService.cols-K>1){let D=this._getJoinedRanges(G,$,F,Z,K);for(let T=0;T<D.length;T++)X.push(D[T])}return X}_getJoinedRanges(U,Z,X,G,K){let F=U.substring(Z,X),$=[];try{$=this._characterJoiners[0].handler(F)}catch(L){console.error(L)}for(let L=1;L<this._characterJoiners.length;L++)try{let M=this._characterJoiners[L].handler(F);for(let D=0;D<M.length;D++)UY._mergeRanges($,M[D])}catch(M){console.error(M)}return this._stringRangesToCellRanges($,G,K),$}_stringRangesToCellRanges(U,Z,X){let G=0,K=!1,F=0,$=U[G];if($){for(let L=X;L<this._bufferService.cols;L++){let M=Z.getWidth(L),D=Z.getString(L).length||oU.length;if(M!==0){if(!K&&$[0]<=F&&($[0]=L,K=!0),$[1]<=F){if($[1]=L,$=U[++G],!$)break;$[0]<=F?($[0]=L,K=!0):K=!1}F+=D}}$&&($[1]=this._bufferService.cols)}}static _mergeRanges(U,Z){let X=!1;for(let G=0;G<U.length;G++){let K=U[G];if(X){if(Z[1]<=K[0])return U[G-1][1]=Z[1],U;if(Z[1]<=K[1])return U[G-1][1]=Math.max(Z[1],K[1]),U.splice(G,1),U;U.splice(G,1),G--}else{if(Z[1]<=K[0])return U.splice(G,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}};UY=$1([p0(0,r1)],UY);function CC(U){return 57508<=U&&U<=57558}function AC(U){return 9472<=U&&U<=9631}function DC(U){return CC(U)||AC(U)}function zC(){return{css:{canvas:yX(),cell:yX()},device:{canvas:yX(),cell:yX(),char:{width:0,height:0,left:0,top:0}}}}function yX(){return{width:0,height:0}}var oJ=class{constructor(U,Z,X,G,K,F,$){this._document=U,this._characterJoinerService=Z,this._optionsService=X,this._coreBrowserService=G,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,G,K,F,$,L,M,D,T){let A=[],q=this._characterJoinerService.getJoinedCharacters(Z),S=this._themeService.colors,E=U.getNoBgTrimmedLength();X&&E<F+1&&(E=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=D!==-1&&T!==-1;for(let V=0;V<E;V++){U.loadCell(V,this._workCell);let I=this._workCell.getWidth();if(I===0)continue;let Q=!1,W=V>=b,C=V,z=this._workCell;if(q.length>0&&V===q[0][0]&&W){let s=q.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?(Q=!0,z=new OC(this._workCell,U.translateToString(!0,s[0],s[1]),s[1]-s[0]),C=s[1]-1,I=z.getWidth()):b=s[1]}let H=this._isCellInSelection(V,Z),J=X&&V===F,O=Y&&V>=D&&V<=T,P=!1;this._decorationService.forEachDecorationAtCell(V,Z,void 0,(s)=>{P=!0});let R=z.getChars()||oU;if(R===" "&&(z.isUnderline()||z.isOverline())&&(R=" "),Y0=I*L-M.get(R,z.isBold(),z.isItalic()),!j)j=this._document.createElement("span");else if(k&&(H&&V0||!H&&!V0&&z.bg===x)&&(H&&V0&&S.selectionForeground||z.fg===N)&&z.extended.ext===w&&O===u&&Y0===Z0&&!J&&!Q&&!P&&W){z.isInvisible()?B+=oU:B+=R,k++;continue}else k&&(j.textContent=B),j=this._document.createElement("span"),k=0,B="";if(x=z.bg,N=z.fg,w=z.extended.ext,u=O,Z0=Y0,V0=H,Q&&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(G==="bar"?"xterm-cursor-bar":G==="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(z.isBold()&&i.push("xterm-bold"),z.isItalic()&&i.push("xterm-italic"),z.isDim()&&i.push("xterm-dim"),z.isInvisible()?B=oU:B=z.getChars()||oU,z.isUnderline()&&(i.push(`xterm-underline-${z.extended.underlineStyle}`),B===" "&&(B=" "),!z.isUnderlineColorDefault()))if(z.isUnderlineColorRGB())j.style.textDecorationColor=`rgb(${IX.toColorRGB(z.getUnderlineColor()).join(",")})`;else{let s=z.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&z.isBold()&&s<8&&(s+=8),j.style.textDecorationColor=S.ansi[s].css}z.isOverline()&&(i.push("xterm-overline"),B===" "&&(B=" ")),z.isStrikethrough()&&i.push("xterm-strikethrough"),O&&(j.style.textDecoration="underline");let _=z.getFgColor(),f=z.getFgColorMode(),p=z.getBgColor(),o=z.getBgColorMode(),K0=!!z.isInverse();if(K0){let s=_;_=p,p=s;let f0=f;f=o,o=f0}let a,l,G0=!1;this._decorationService.forEachDecorationAtCell(V,Z,void 0,(s)=>{s.options.layer!=="top"&&G0||(s.backgroundColorRGB&&(o=50331648,p=s.backgroundColorRGB.rgba>>8&16777215,a=s.backgroundColorRGB),s.foregroundColorRGB&&(f=50331648,_=s.foregroundColorRGB.rgba>>8&16777215,l=s.foregroundColorRGB),G0=s.options.layer==="top")}),!G0&&H&&(a=this._coreBrowserService.isFocused?S.selectionBackgroundOpaque:S.selectionInactiveBackgroundOpaque,p=a.rgba>>8&16777215,o=50331648,G0=!0,S.selectionForeground&&(f=50331648,_=S.selectionForeground.rgba>>8&16777215,l=S.selectionForeground)),G0&&i.push("xterm-decoration-top");let n;switch(o){case 16777216:case 33554432:n=S.ansi[p],i.push(`xterm-bg-${p}`);break;case 50331648:n=F1.toColor(p>>16,p>>8&255,p&255),this._addStyle(j,`background-color:#${_$((p>>>0).toString(16),"0",6)}`);break;case 0:default:K0?(n=S.foreground,i.push("xterm-bg-257")):n=S.background}switch(a||z.isDim()&&(a=e0.multiplyOpacity(n,0.5)),f){case 16777216:case 33554432:z.isBold()&&_<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(_+=8),this._applyMinimumContrast(j,n,S.ansi[_],z,a,void 0)||i.push(`xterm-fg-${_}`);break;case 50331648:let s=F1.toColor(_>>16&255,_>>8&255,_&255);this._applyMinimumContrast(j,n,s,z,a,l)||this._addStyle(j,`color:#${_$(_.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(j,n,S.foreground,z,a,l)||K0&&i.push("xterm-fg-257")}i.length&&(j.className=i.join(" "),i.length=0),!J&&!Q&&!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,G,K,F){if(this._optionsService.rawOptions.minimumContrastRatio===1||DC(G.getCode()))return!1;let $=this._getContrastCache(G),L;if(!K&&!F&&(L=$.getColor(Z.rgba,X.rgba)),L===void 0){let M=this._optionsService.rawOptions.minimumContrastRatio/(G.isDim()?2:1);L=e0.ensureContrastRatio(K||Z,F||X,M),$.setColor((K||Z).rgba,(F||X).rgba,L??null)}return L?(this._addStyle(U,`color:${L.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,G=this._selectionEnd;return!X||!G?!1:this._columnSelectMode?X[0]<=G[0]?U>=X[0]&&Z>=X[1]&&U<G[0]&&Z<=G[1]:U<X[0]&&Z>=X[1]&&U>=G[0]&&Z<=G[1]:Z>X[1]&&Z<G[1]||X[1]===G[1]&&Z===X[1]&&U>=X[0]&&U<G[0]||X[1]<G[1]&&Z===G[1]&&U<G[0]||X[1]<G[1]&&Z===X[1]&&U>=X[0]}};oJ=$1([p0(1,IK),p0(2,a1),p0(3,NU),p0(4,KZ),p0(5,FX),p0(6,EZ)],oJ);function _$(U,Z,X){for(;U.length<X;)U=Z+U;return U}var LC=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 G=U.createElement("span");G.classList.add("xterm-char-measure-element"),G.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,G,K,F],this._container.appendChild(X),this._container.appendChild(G),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,G){U===this._font&&Z===this._fontSize&&X===this._weight&&G===this._weightBold||(this._font=U,this._fontSize=Z,this._weight=X,this._weightBold=G,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${X}`,this._measureElements[1].style.fontWeight=`${G}`,this._measureElements[2].style.fontWeight=`${X}`,this._measureElements[3].style.fontWeight=`${G}`,this.clear())}get(U,Z,X){let G=0;if(!Z&&!X&&U.length===1&&(G=U.charCodeAt(0))<256){if(this._flat[G]!==-9999)return this._flat[G];let $=this._measure(U,0);return $>0&&(this._flat[G]=$),$}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}},MC=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,G=!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,L=Math.max(F,0),M=Math.min($,U.rows-1);if(L>=U.rows||M<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=G,this.viewportStartRow=F,this.viewportEndRow=$,this.viewportCappedStartRow=L,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 qC(){return new MC}var qJ="xterm-dom-renderer-owner-",IU="xterm-rows",pX="xterm-fg-",B$="xterm-bg-",sZ="xterm-focus",cX="xterm-selection",TC=1,nJ=class extends d0{constructor(U,Z,X,G,K,F,$,L,M,D,T,A,q,S){super();this._terminal=U,this._document=Z,this._element=X,this._screenElement=G,this._viewportElement=K,this._helperContainer=F,this._linkifier2=$,this._charSizeService=M,this._optionsService=D,this._bufferService=T,this._coreService=A,this._coreBrowserService=q,this._themeService=S,this._terminalClass=TC++,this._rowElements=[],this._selectionRenderModel=qC(),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=zC(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors((E)=>this._injectCss(E))),this._injectCss(this._themeService.colors),this._rowFactory=L.createInstance(oJ,document),this._element.classList.add(qJ+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline((E)=>this._handleLinkHover(E))),this._register(this._linkifier2.onHideLinkUnderline((E)=>this._handleLinkLeave(E))),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 LC(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}`,G=`blink_bar_${this._terminalClass}`,K=`blink_block_${this._terminalClass}`;Z+=`@keyframes ${X} { 50% { border-bottom-style: hidden; }}`,Z+=`@keyframes ${G} { 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: ${G} 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} .${pX}${F} { color: ${$.css}; }${this._terminalSelector} .${pX}${F}.xterm-dim { color: ${e0.multiplyOpacity($,0.5).css}; }${this._terminalSelector} .${B$}${F} { background-color: ${$.css}; }`;Z+=`${this._terminalSelector} .${pX}257 { color: ${e0.opaque(U.background).css}; }${this._terminalSelector} .${pX}257.xterm-dim { color: ${e0.multiplyOpacity(e0.opaque(U.background),0.5).css}; }${this._terminalSelector} .${B$}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 G=this._document.createElement("div");this._rowContainer.appendChild(G),this._rowElements.push(G)}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 G=this._selectionRenderModel.viewportStartRow,K=this._selectionRenderModel.viewportEndRow,F=this._selectionRenderModel.viewportCappedStartRow,$=this._selectionRenderModel.viewportCappedEndRow,L=this._document.createDocumentFragment();if(X){let M=U[0]>Z[0];L.appendChild(this._createSelectionElement(F,M?Z[0]:U[0],M?U[0]:Z[0],$-F+1))}else{let M=G===F?U[0]:0,D=F===K?Z[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(F,M,D));let T=$-F-1;if(L.appendChild(this._createSelectionElement(F+1,0,this._bufferService.cols,T)),F!==$){let A=K===$?Z[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement($,0,A))}}this._selectionContainer.appendChild(L)}_createSelectionElement(U,Z,X,G=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=`${G*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,G=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,L=this._optionsService.rawOptions.cursorInactiveStyle;for(let M=U;M<=Z;M++){let D=M+X.ydisp,T=this._rowElements[M],A=X.lines.get(D);if(!T||!A)break;T.replaceChildren(...this._rowFactory.createRow(A,D,D===G,$,L,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,G,K,F){X<0&&(U=0),G<0&&(Z=0);let $=this._bufferService.rows-1;X=Math.max(Math.min(X,$),0),G=Math.max(Math.min(G,$),0),K=Math.min(K,this._bufferService.cols);let L=this._bufferService.buffer,M=L.ybase+L.y,D=Math.min(L.x,K-1),T=this._optionsService.rawOptions.cursorBlink,A=this._optionsService.rawOptions.cursorStyle,q=this._optionsService.rawOptions.cursorInactiveStyle;for(let S=X;S<=G;++S){let E=S+L.ydisp,j=this._rowElements[S],k=L.lines.get(E);if(!j||!k)break;j.replaceChildren(...this._rowFactory.createRow(k,E,E===M,A,q,D,T,this.dimensions.css.cell.width,this._widthCache,F?S===X?U:0:-1,F?(S===G?Z:K)-1:-1))}}};nJ=$1([p0(7,GG),p0(8,GY),p0(9,a1),p0(10,r1),p0(11,KZ),p0(12,NU),p0(13,EZ)],nJ);var mJ=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 SC(this._optionsService))}catch{this._measureStrategy=this._register(new RC(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())}};mJ=$1([p0(2,a1)],mJ);var _K=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)}},RC=class extends _K{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}},SC=class extends _K{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}},EC=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 PC(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((G)=>this._screenDprMonitor.setWindow(G))),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}},PC=class extends d0{constructor(U){super();this._parentWindow=U,this._windowResizeListener=this._register(new SZ),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)}},kC=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 HG(U,Z,X){let G=X.getBoundingClientRect(),K=U.getComputedStyle(X),F=parseInt(K.getPropertyValue("padding-left")),$=parseInt(K.getPropertyValue("padding-top"));return[Z.clientX-G.left-F,Z.clientY-G.top-$]}function jC(U,Z,X,G,K,F,$,L,M){if(!F)return;let D=HG(U,Z,X);if(D)return D[0]=Math.ceil((D[0]+(M?$/2:0))/$),D[1]=Math.ceil(D[1]/L),D[0]=Math.min(Math.max(D[0],1),G+(M?1:0)),D[1]=Math.min(Math.max(D[1],1),K),D}var sJ=class{constructor(U,Z){this._renderService=U,this._charSizeService=Z}getCoords(U,Z,X,G,K){return jC(window,U,Z,X,G,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,K)}getMouseReportCoords(U,Z){let X=HG(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])}}};sJ=$1([p0(0,gU),p0(1,GY)],sJ);var vC=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=[]}},BK={};FO(BK,{getSafariVersion:()=>BC,isChromeOS:()=>fK,isFirefox:()=>xK,isIpad:()=>xC,isIphone:()=>NC,isLegacyEdge:()=>_C,isLinux:()=>OG,isMac:()=>ZY,isNode:()=>$Y,isSafari:()=>NK,isWindows:()=>gK});var $Y=typeof process<"u"&&"title"in process,HX=$Y?"node":navigator.userAgent,OX=$Y?"node":navigator.platform,xK=HX.includes("Firefox"),_C=HX.includes("Edge"),NK=/^((?!chrome|android).)*safari/i.test(HX);function BC(){if(!NK)return 0;let U=HX.match(/Version\/(\d+)/);return U===null||U.length<2?0:parseInt(U[1])}var ZY=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(OX),xC=OX==="iPad",NC=OX==="iPhone",gK=["Windows","Win16","Win32","WinCE"].includes(OX),OG=OX.indexOf("Linux")>=0,fK=/\bCrOS\b/.test(HX),wK=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,G=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){G-Z<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(G-Z))}ms`),this._start();return}G=K}this.clear()}},gC=class extends wK{_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())}}},fC=class extends wK{_requestCallback(U){return requestIdleCallback(U)}_cancelCallback(U){cancelIdleCallback(U)}},XY=!$Y&&"requestIdleCallback"in window?fC:gC,wC=class{constructor(){this._queue=new XY}set(U){this._queue.clear(),this._queue.enqueue(U)}flush(){this._queue.flush()}},rJ=class extends d0{constructor(U,Z,X,G,K,F,$,L,M){super();this._rowCount=U,this._optionsService=X,this._charSizeService=G,this._coreService=K,this._coreBrowserService=L,this._renderer=this._register(new SZ),this._pausedResizeTask=new wC,this._observerDisposable=this._register(new SZ),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 vC((D,T)=>this._renderRows(D,T),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new yC(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((D)=>this._registerIntersectionObserver(D,Z)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(U,Z){if("IntersectionObserver"in U){let X=new U.IntersectionObserver((G)=>this._handleIntersectionChange(G[G.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 G=this._syncOutputHandler.flush();G&&(U=Math.min(U,G.start),Z=Math.max(Z,G.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()}};rJ=$1([p0(2,a1),p0(3,GY),p0(4,KZ),p0(5,FX),p0(6,r1),p0(7,NU),p0(8,EZ)],rJ);var yC=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 pC(U,Z,X,G){let K=X.buffer.x,F=X.buffer.y;if(!X.buffer.hasScrollback)return uC(K,F,U,Z,X,G)+KY(F,Z,X,G)+bC(K,F,U,Z,X,G);let $;if(F===Z)return $=K>U?"D":"C",KX(Math.abs(K-U),$X($,G));$=F>Z?"D":"C";let L=Math.abs(F-Z),M=hC(F>Z?U:K,X)+(L-1)*X.cols+1+cC(F>Z?K:U,X);return KX(M,$X($,G))}function cC(U,Z){return U-1}function hC(U,Z){return Z.cols-U}function uC(U,Z,X,G,K,F){return KY(Z,G,K,F).length===0?"":KX(pK(U,Z,U,Z-$Z(Z,K),!1,K).length,$X("D",F))}function KY(U,Z,X,G){let K=U-$Z(U,X),F=Z-$Z(Z,X),$=Math.abs(K-F)-dC(U,Z,X);return KX($,$X(yK(U,Z),G))}function bC(U,Z,X,G,K,F){let $;KY(Z,G,K,F).length>0?$=G-$Z(G,K):$=Z;let L=G,M=lC(U,Z,X,G,K,F);return KX(pK(U,$,X,L,M==="C",K).length,$X(M,F))}function dC(U,Z,X){let G=0,K=U-$Z(U,X),F=Z-$Z(Z,X);for(let $=0;$<Math.abs(K-F);$++){let L=yK(U,Z)==="A"?-1:1;X.buffer.lines.get(K+L*$)?.isWrapped&&G++}return G}function $Z(U,Z){let X=0,G=Z.buffer.lines.get(U),K=G?.isWrapped;for(;K&&U>=0&&U<Z.rows;)X++,G=Z.buffer.lines.get(--U),K=G?.isWrapped;return X}function lC(U,Z,X,G,K,F){let $;return KY(X,G,K,F).length>0?$=G-$Z(G,K):$=Z,U<X&&$<=G||U>=X&&$<G?"C":"D"}function yK(U,Z){return U>Z?"A":"B"}function pK(U,Z,X,G,K,F){let $=U,L=Z,M="";for(;($!==X||L!==G)&&L>=0&&L<F.buffer.lines.length;)$+=K?1:-1,K&&$>F.cols-1?(M+=F.buffer.translateBufferLineToString(L,!1,U,$),$=0,U=0,L++):!K&&$<0&&(M+=F.buffer.translateBufferLineToString(L,!1,0,U+1),$=F.cols-1,U=$,L--);return M+F.buffer.translateBufferLineToString(L,!1,U,$)}function $X(U,Z){let X=Z?"O":"[";return z0.ESC+X+U}function KX(U,Z){U=Math.floor(U);let X="";for(let G=0;G<U;G++)X+=Z;return X}var oC=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 x$(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 TJ=50,nC=15,mC=50,sC=500,rC=" ",aC=new RegExp(rC,"g"),aJ=class extends d0{constructor(U,Z,X,G,K,F,$,L,M){super();this._element=U,this._screenElement=Z,this._linkifier=X,this._bufferService=G,this._coreService=K,this._mouseService=F,this._optionsService=$,this._renderService=L,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=(D)=>this._handleMouseMove(D),this._mouseUpListener=(D)=>this._handleMouseUp(D),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim((D)=>this._handleTrim(D)),this._register(this._bufferService.buffers.onBufferActivate((D)=>this._handleBufferActivate(D))),this.enable(),this._model=new oC(this._bufferService),this._activeSelectionMode=0,this._register(U1(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize((D)=>{D.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,G=[];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 L=X.translateBufferLineToString($,!0,K,F);G.push(L)}}else{let K=U[1]===Z[1]?Z[0]:void 0;G.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),L=X.translateBufferLineToString(F,!0);$?.isWrapped?G[G.length-1]+=L:G.push(L)}if(U[1]!==Z[1]){let F=X.lines.get(Z[1]),$=X.translateBufferLineToString(Z[1],!0,0,Z[0]);F&&F.isWrapped?G[G.length-1]+=$:G.push($)}}return G.map((K)=>K.replace(aC," ")).join(gK?`\r
|
|
459
|
-
`:`
|
|
460
|
-
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(U){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),OG&&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,G=this._model.finalSelectionEnd;return!X||!G||!Z?!1:this._areCoordsInSelection(Z,X,G)}isCellInSelection(U,Z){let X=this._model.finalSelectionStart,G=this._model.finalSelectionEnd;return!X||!G?!1:this._areCoordsInSelection([U,Z],X,G)}_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=x$(X,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let G=this._getMouseBufferCoords(U);return G?(this._selectWordAt(G,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=HG(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,-TJ),TJ),Z/=TJ,Z/Math.abs(Z)+Math.round(Z*(nC-1)))}shouldForceSelection(U){return ZY?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(),mC)}_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&&!(ZY&&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 G=X.lines.get(this._model.selectionEnd[1]);G&&G.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<sC&&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 G=pC(X[0]-1,X[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(G,!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 G=0;Z>=G;G++){let K=U.loadCell(G,this._workCell).getChars().length;this._workCell.getWidth()===0?X--:K>1&&Z!==G&&(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,G=!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),L=this._convertViewportColToCharacterIndex(F,U[0]),M=L,D=U[0]-L,T=0,A=0,q=0,S=0;if($.charAt(L)===" "){for(;L>0&&$.charAt(L-1)===" ";)L--;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&&(S+=v-1,M+=v-1);k>0&&L>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&&(q+=x-1,L-=x-1),L--,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&&(S+=x-1,M+=x-1),M++,B++}}M++;let E=L+D-T+q,j=Math.min(this._bufferService.cols,M-L+T+A-q-S);if(!(!Z&&$.slice(L,M).trim()==="")){if(X&&E===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;E-=v,j+=v}}}if(G&&E+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:E,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=x$(X,this._bufferService.cols)}};aJ=$1([p0(3,r1),p0(4,KZ),p0(5,QG),p0(6,a1),p0(7,gU),p0(8,NU)],aJ);var N$=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={}}},g$=class{constructor(){this._color=new N$,this._css=new N$}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 G=Z[X/36%6|0],K=Z[X/6%6|0],F=Z[X%6];U.push({css:F1.toCss(G,K,F),rgba:F1.toRgba(G,K,F)})}for(let X=0;X<24;X++){let G=8+X*10;U.push({css:F1.toCss(G,G,G),rgba:F1.toRgba(G,G,G)})}return U})()),YZ=Y1.toColor("#ffffff"),ZX=Y1.toColor("#000000"),f$=Y1.toColor("#ffffff"),w$=ZX,rZ={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},tC=YZ,tJ=class extends d0{constructor(U){super();this._optionsService=U,this._contrastCache=new g$,this._halfContrastCache=new g$,this._onChangeColors=this._register(new w0),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:YZ,background:ZX,cursor:f$,cursorAccent:w$,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,f$)),Z.cursorAccent=e0.blend(Z.background,a0(U.cursorAccent,w$)),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,v$):void 0,Z.selectionForeground===v$&&(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,tC),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 G=0;G<X;G++)Z.ansi[G+16]=a0(U.extendedAnsi[G],k1[G+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()}}};tJ=$1([p0(0,a1)],tJ);function a0(U,Z){if(U!==void 0)try{return Y1.toColor(U)}catch{}return Z}var iC=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)}},eC=class{constructor(){this._services=new iC,this._services.set(GG,this)}setService(U,Z){this._services.set(U,Z)}getService(U){return this._services.get(U)}createInstance(U,...Z){let X=LO(U).sort((F,$)=>F.index-$.index),G=[];for(let F of X){let $=this._services.get(F.id);if(!$)throw Error(`[createInstance] ${U.name} depends on UNKNOWN service ${F.id._id}.`);G.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,...G)}},U8={trace:0,debug:1,info:2,warn:3,error:4,off:5},Z8="xterm.js: ",iJ=class extends d0{constructor(U){super();this._optionsService=U,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),X8=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=U8[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?"":Z8)+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)}};iJ=$1([p0(0,a1)],iJ);var X8,y$=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 G=U;G<this._length-Z;G++)this._array[this._getCyclicIndex(G)]=this._array[this._getCyclicIndex(G+Z)];this._length-=Z,this.onDeleteEmitter.fire({index:U,amount:Z})}for(let G=this._length-1;G>=U;G--)this._array[this._getCyclicIndex(G+X.length)]=this._array[this._getCyclicIndex(G)];for(let G=0;G<X.length;G++)this._array[this._getCyclicIndex(U+G)]=X[G];if(X.length&&this.onInsertEmitter.fire({index:U,amount:X.length}),this._length+X.length>this._maxLength){let G=this._length+X.length-this._maxLength;this._startIndex+=G,this._length=this._maxLength,this.onTrimEmitter.fire(G)}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 G=U+Z+X-this._length;if(G>0)for(this._length+=G;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let G=0;G<Z;G++)this.set(U+G+X,this.get(U+G))}}_getCyclicIndex(U){return(this._startIndex+U)%this._maxLength}},n0=3,I1=Object.freeze(new IX),hX=0,RJ=2,XX=class U{constructor(Z,X,G=!1){this.isWrapped=G,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(Z*n0);let K=X||HU.fromCharData([0,VK,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],G=X&2097151;return[this._data[Z*n0+1],X&2097152?this._combined[Z]:G?lU(G):"",X>>22,X&2097152?this._combined[Z].charCodeAt(this._combined[Z].length-1):G]}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 hX=Z*n0,X.content=this._data[hX+0],X.fg=this._data[hX+1],X.bg=this._data[hX+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,G,K){K.bg&268435456&&(this._extendedAttrs[Z]=K.extended),this._data[Z*n0+0]=X|G<<22,this._data[Z*n0+1]=K.fg,this._data[Z*n0+2]=K.bg}addCodepointToCell(Z,X,G){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,G&&(K&=-12582913,K|=G<<22),this._data[Z*n0+0]=K}insertCells(Z,X,G){if(Z%=this.length,Z&&this.getWidth(Z-1)===2&&this.setCellFromCodepoint(Z-1,0,1,G),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,G)}else for(let K=Z;K<this.length;++K)this.setCell(K,G);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,G)}deleteCells(Z,X,G){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,G)}else for(let K=Z;K<this.length;++K)this.setCell(K,G);Z&&this.getWidth(Z-1)===2&&this.setCellFromCodepoint(Z-1,0,1,G),this.getWidth(Z)===0&&!this.hasContent(Z)&&this.setCellFromCodepoint(Z,0,1,G)}replaceCells(Z,X,G,K=!1){if(K){for(Z&&this.getWidth(Z-1)===2&&!this.isProtected(Z-1)&&this.setCellFromCodepoint(Z-1,0,1,G),X<this.length&&this.getWidth(X-1)===2&&!this.isProtected(X)&&this.setCellFromCodepoint(X,0,1,G);Z<X&&Z<this.length;)this.isProtected(Z)||this.setCell(Z,G),Z++;return}for(Z&&this.getWidth(Z-1)===2&&this.setCellFromCodepoint(Z-1,0,1,G),X<this.length&&this.getWidth(X-1)===2&&this.setCellFromCodepoint(X,0,1,G);Z<X&&Z<this.length;)this.setCell(Z++,G)}resize(Z,X){if(Z===this.length)return this._data.length*4*RJ<this._data.buffer.byteLength;let G=Z*n0;if(Z>this.length){if(this._data.buffer.byteLength>=G*4)this._data=new Uint32Array(this._data.buffer,0,G);else{let K=new Uint32Array(G);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,G);let K=Object.keys(this._combined);for(let $=0;$<K.length;$++){let L=parseInt(K[$],10);L>=Z&&delete this._combined[L]}let F=Object.keys(this._extendedAttrs);for(let $=0;$<F.length;$++){let L=parseInt(F[$],10);L>=Z&&delete this._extendedAttrs[L]}}return this.length=Z,G*4*RJ<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*RJ<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 G=0;G<this.length;++G)this.isProtected(G)||this.setCell(G,Z);return}this._combined={},this._extendedAttrs={};for(let G=0;G<this.length;++G)this.setCell(G,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,G,K,F){let $=Z._data;if(F)for(let M=K-1;M>=0;M--){for(let D=0;D<n0;D++)this._data[(G+M)*n0+D]=$[(X+M)*n0+D];$[(X+M)*n0+2]&268435456&&(this._extendedAttrs[G+M]=Z._extendedAttrs[X+M])}else for(let M=0;M<K;M++){for(let D=0;D<n0;D++)this._data[(G+M)*n0+D]=$[(X+M)*n0+D];$[(X+M)*n0+2]&268435456&&(this._extendedAttrs[G+M]=Z._extendedAttrs[X+M])}let L=Object.keys(Z._combined);for(let M=0;M<L.length;M++){let D=parseInt(L[M],10);D>=X&&(this._combined[D-X+G]=Z._combined[D])}}translateToString(Z,X,G,K){X=X??0,G=G??this.length,Z&&(G=Math.min(G,this.getTrimmedLength())),K&&(K.length=0);let F="";for(;X<G;){let $=this._data[X*n0+0],L=$&2097151,M=$&2097152?this._combined[X]:L?lU(L):oU;if(F+=M,K)for(let D=0;D<M.length;++D)K.push(X);X+=$>>22||1}return K&&K.push(X),F}};function Y8(U,Z,X,G,K,F){let $=[];for(let L=0;L<U.length-1;L++){let M=L,D=U.get(++M);if(!D.isWrapped)continue;let T=[U.get(L)];for(;M<U.length&&D.isWrapped;)T.push(D),D=U.get(++M);if(!F&&G>=L&&G<M){L+=T.length-1;continue}let A=0,q=WX(T,A,Z),S=1,E=0;for(;S<T.length;){let k=WX(T,S,Z),B=k-E,v=X-q,x=Math.min(B,v);T[A].copyCellsFrom(T[S],E,q,x,!1),q+=x,q===X&&(A++,q=0),E+=x,E===k&&(S++,E=0),q===0&&A!==0&&T[A-1].getWidth(X-1)===2&&(T[A].copyCellsFrom(T[A-1],X-1,q++,1,!1),T[A-1].setCell(X-1,K))}T[A].replaceCells(q,X,K);let j=0;for(let k=T.length-1;k>0&&(k>A||T[k].getTrimmedLength()===0);k--)j++;j>0&&($.push(L+T.length-j),$.push(j)),L+=T.length-1}return $}function J8(U,Z){let X=[],G=0,K=Z[G],F=0;for(let $=0;$<U.length;$++)if(K===$){let L=Z[++G];U.onDeleteEmitter.fire({index:$-F,amount:L}),$+=L-1,F+=L,K=Z[++G]}else X.push($);return{layout:X,countRemoved:F}}function G8(U,Z){let X=[];for(let G=0;G<Z.length;G++)X.push(U.get(Z[G]));for(let G=0;G<X.length;G++)U.set(G,X[G]);U.length=Z.length}function Q8(U,Z,X){let G=[],K=U.map((M,D)=>WX(U,D,Z)).reduce((M,D)=>M+D),F=0,$=0,L=0;for(;L<K;){if(K-L<X){G.push(K-L);break}F+=X;let M=WX(U,$,Z);F>M&&(F-=M,$++);let D=U[$].getWidth(F-1)===2;D&&F--;let T=D?X-1:X;G.push(T),L+=T}return G}function WX(U,Z,X){if(Z===U.length-1)return U[Z].getTrimmedLength();let G=!U[Z].hasContent(X-1)&&U[Z].getWidth(X-1)===1,K=U[Z+1].getWidth(0)===2;return G&&K?X-1:X}var cK=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}};cK._nextId=1;var V8=cK,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 p$=4294967295,c$=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,VK,1,0]),this._whitespaceCell=HU.fromCharData([0,oU,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new XY,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new y$(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 rX),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 rX),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>p$?p$: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 y$(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(U,Z){let X=this.getNullCell(I1),G=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;$++)G+=+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++)G+=+this.lines.get(F).resize(U,X);this._cols=U,this._rows=Z,this._memoryCleanupQueue.clear(),G>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,G=Y8(this.lines,this._cols,U,this.ybase+this.y,this.getNullCell(I1),X);if(G.length>0){let K=J8(this.lines,G);G8(this.lines,K.layout),this._reflowLargerAdjustViewport(U,Z,K.countRemoved)}}_reflowLargerAdjustViewport(U,Z,X){let G=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,G))):(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,G=this.getNullCell(I1),K=[],F=0;for(let $=this.lines.length-1;$>=0;$--){let L=this.lines.get($);if(!L||!L.isWrapped&&L.getTrimmedLength()<=U)continue;let M=[L];for(;L.isWrapped&&$>0;)L=this.lines.get(--$),M.unshift(L);if(!X){let x=this.ybase+this.y;if(x>=$&&x<$+M.length)continue}let D=M[M.length-1].getTrimmedLength(),T=Q8(M,this._cols,U),A=T.length-M.length,q;this.ybase===0&&this.y!==this.lines.length-1?q=Math.max(0,this.y-this.lines.maxLength+A):q=Math.max(0,this.lines.length-this.lines.maxLength+A);let S=[];for(let x=0;x<A;x++){let N=this.getBlankLine(I1,!0);S.push(N)}S.length>0&&(K.push({start:$+M.length+F,newLines:S}),F+=S.length),M.push(...S);let E=T.length-1,j=T[E];j===0&&(E--,j=T[E]);let k=M.length-A-1,B=D;for(;k>=0;){let x=Math.min(B,j);if(M[E]===void 0)break;if(M[E].copyCellsFrom(M[k],B-x,j-x,x,!0),j-=x,j===0&&(E--,j=T[E]),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],G);let v=A-q;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 $=[],L=[];for(let j=0;j<this.lines.length;j++)L.push(this.lines.get(j));let M=this.lines.length,D=M-1,T=0,A=K[T];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+F);let q=0;for(let j=Math.min(this.lines.maxLength-1,M+F-1);j>=0;j--)if(A&&A.start>D+q){for(let k=A.newLines.length-1;k>=0;k--)this.lines.set(j--,A.newLines[k]);j++,$.push({index:D+1,amount:A.newLines.length}),q+=A.newLines.length,A=K[++T]}else this.lines.set(j,L[D--]);let S=0;for(let j=$.length-1;j>=0;j--)$[j].index+=S,this.lines.onInsertEmitter.fire($[j]),S+=$[j].amount;let E=Math.max(0,M+F-this.lines.maxLength);E>0&&this.lines.onTrimEmitter.fire(E)}}translateBufferLineToString(U,Z,X=0,G){let K=this.lines.get(U);return K?K.translateToString(Z,X,G):""}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 V8(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)}},$8=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 c$(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new c$(!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)}},hK=2,uK=1,eJ=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,hK),this.rows=Math.max(U.rawOptions.rows||0,uK),this.buffers=this._register(new $8(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,G=this.rows!==Z;this.cols=U,this.rows=Z,this.buffers.resize(U,Z),this._onResize.fire({cols:U,rows:Z,colsChanged:X,rowsChanged:G})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(U,Z=!1){let X=this.buffer,G;G=this._cachedBlankLine,(!G||G.length!==this.cols||G.getFg(0)!==U.fg||G.getBg(0)!==U.bg)&&(G=X.getBlankLine(U,Z),this._cachedBlankLine=G),G.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(G):X.lines.push(G.clone()):X.lines.splice(F+1,0,G.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,G.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 G=X.ydisp;X.ydisp=Math.max(Math.min(X.ydisp+U,X.ybase),0),G!==X.ydisp&&(Z||this._onScroll.fire(X.ydisp))}};eJ=$1([p0(0,a1)],eJ);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:ZY,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},K8=["normal","bold","100","200","300","400","500","600","700","800","900"],W8=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 G=U[X];Z[X]=this._sanitizeAndValidateOption(X,G)}catch(G){console.error(G)}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,G)=>{if(!(X in TZ))throw Error(`No option with key "${X}"`);G=this._sanitizeAndValidateOption(X,G),this.rawOptions[X]!==G&&(this.rawOptions[X]=G,this._onOptionChange.fire(X))};for(let X in this.rawOptions){let G={get:U.bind(this,X),set:Z.bind(this,X)};Object.defineProperty(this.options,X,G)}}_sanitizeAndValidateOption(U,Z){switch(U){case"cursorStyle":if(Z||(Z=TZ[U]),!I8(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=K8.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 I8(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 G in U)X[G]=Z<=1?U[G]:U[G]&&YX(U[G],Z-1);return X}var h$=Object.freeze({insertMode:!1}),u$=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),UG=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(h$),this.decPrivateModes=YX(u$)}reset(){this.modes=YX(h$),this.decPrivateModes=YX(u$)}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((G)=>G.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))}};UG=$1([p0(0,r1),p0(1,KK),p0(2,a1)],UG);var b$={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 SJ(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 EJ=String.fromCharCode,d$={DEFAULT:(U)=>{let Z=[SJ(U,!1)+32,U.col+32,U.row+32];return Z[0]>255||Z[1]>255||Z[2]>255?"":`\x1B[M${EJ(Z[0])}${EJ(Z[1])}${EJ(Z[2])}`},SGR:(U)=>{let Z=U.action===0&&U.button!==4?"m":"M";return`\x1B[<${SJ(U,!0)};${U.col};${U.row}${Z}`},SGR_PIXELS:(U)=>{let Z=U.action===0&&U.button!==4?"m":"M";return`\x1B[<${SJ(U,!0)};${U.x};${U.y}${Z}`}},ZG=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 G of Object.keys(b$))this.addProtocol(G,b$[G]);for(let G of Object.keys(d$))this.addEncoding(G,d$[G]);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 G=Z/X,K=this._applyScrollModifier(U.deltaY,U);return U.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(K/=G+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)}};ZG=$1([p0(0,r1),p0(1,KZ),p0(2,a1)],ZG);var PJ=[[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]],F8=[[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 H8(U,Z){let X=0,G=Z.length-1,K;if(U<Z[0][0]||U>Z[G][1])return!1;for(;G>=X;)if(K=X+G>>1,U>Z[K][1])X=K+1;else if(U<Z[K][0])G=K-1;else return!0;return!1}var O8=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<PJ.length;++U)j1.fill(0,PJ[U][0],PJ[U][1]+1)}}wcwidth(U){return U<32?0:U<127?1:U<65536?j1[U]:H8(U,F8)?0:U>=131072&&U<=196605||U>=196608&&U<=262141?2:1}charProperties(U,Z){let X=this.wcwidth(U),G=X===0&&Z!==0;if(G){let K=GZ.extractWidth(Z);K===0?G=!1:K>X&&(X=K)}return GZ.createPropertyValue(0,X,G)}},GZ=class U{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new w0,this.onChange=this._onChange.event;let Z=new O8;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,G=!1){return(Z&16777215)<<3|(X&3)<<1|(G?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,G=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 D=Z.charCodeAt(F);56320<=D&&D<=57343?$=($-55296)*1024+D-56320+65536:X+=this.wcwidth(D)}let L=this.charProperties($,G),M=U.extractWidth(L);U.extractShouldJoin(L)&&(M-=U.extractWidth(G)),X+=M,G=L}return X}charProperties(Z,X){return this._activeProvider.charProperties(Z,X)}},C8=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 l$(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,A8=256,bK=class U{constructor(Z=32,X=32){if(this.maxLength=Z,this.maxSubParamsLength=X,X>A8)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 G=Array.isArray(Z[0])?1:0;G<Z.length;++G){let K=Z[G];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 G=this._subParamsIdx[X]>>8,K=this._subParamsIdx[X]&255;K-G>0&&Z.push(Array.prototype.slice.call(this._subParams,G,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,G=this._subParamsIdx[Z]&255;return G-X>0?this._subParams.subarray(X,G):null}getSubParamsAll(){let Z={};for(let X=0;X<this.length;++X){let G=this._subParamsIdx[X]>>8,K=this._subParamsIdx[X]&255;K-G>0&&(Z[X]=this._subParams.slice(G,K))}return Z}addDigit(Z){let X;if(this._rejectDigits||!(X=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let G=this._digitIsSub?this._subParams:this.params,K=G[X-1];G[X-1]=~K?Math.min(K*10+Z,aZ):Z}},tZ=[],D8=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 G=X.indexOf(Z);G!==-1&&X.splice(G,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",JY(U,Z,X));else for(let G=this._active.length-1;G>=0;G--)this._active[G].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 G=U[Z++];if(G===59){this._state=2,this._start();break}if(G<48||57<G){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+G-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,G=this._active.length-1,K=!1;if(this._stack.paused&&(G=this._stack.loopPosition-1,X=Z,K=this._stack.fallThrough,this._stack.paused=!1),!K&&X===!1){for(;G>=0&&(X=this._active[G].end(U),X!==!0);G--)if(X instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=G,this._stack.fallThrough=!1,X;G--}for(;G>=0;G--)if(X=this._active[G].end(!1),X instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=G,this._stack.fallThrough=!0,X}this._active=tZ,this._id=-1,this._state=0}}},QU=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+=JY(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=[],z8=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 G=X.indexOf(Z);G!==-1&&X.splice(G,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",JY(U,Z,X));else for(let G=this._active.length-1;G>=0;G--)this._active[G].put(U,Z,X)}unhook(U,Z=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",U);else{let X=!1,G=this._active.length-1,K=!1;if(this._stack.paused&&(G=this._stack.loopPosition-1,X=Z,K=this._stack.fallThrough,this._stack.paused=!1),!K&&X===!1){for(;G>=0&&(X=this._active[G].unhook(U),X!==!0);G--)if(X instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=G,this._stack.fallThrough=!1,X;G--}for(;G>=0;G--)if(X=this._active[G].unhook(!1),X instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=G,this._stack.fallThrough=!0,X}this._active=iZ,this._ident=0}},JX=new bK;JX.addParam(0);var o$=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+=JY(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}},L8=class{constructor(U){this.table=new Uint8Array(U)}setDefault(U,Z){this.table.fill(U<<4|Z)}add(U,Z,X,G){this.table[Z<<8|U]=X<<4|G}addMany(U,Z,X,G){for(let K=0;K<U.length;K++)this.table[Z<<8|U[K]]=X<<4|G}},FU=160,M8=function(){let U=new L8(4095),Z=Array.apply(null,Array(256)).map((L,M)=>M),X=(L,M)=>Z.slice(L,M),G=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(G,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(G,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(G,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(G,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}(),q8=class extends d0{constructor(U=M8){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 bK,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(Z,X,G)=>{},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 D8),this._dcsParser=this._register(new z8),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 G=U.final.charCodeAt(0);if(Z[0]>G||G>Z[1])throw Error(`final must be in range ${Z[0]} .. ${Z[1]}`);return X<<=8,X|=G,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 G=this._escHandlers[X];return G.push(Z),{dispose:()=>{let K=G.indexOf(Z);K!==-1&&G.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 G=this._csiHandlers[X];return G.push(Z),{dispose:()=>{let K=G.indexOf(Z);K!==-1&&G.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,G,K){this._parseStack.state=U,this._parseStack.handlers=Z,this._parseStack.handlerPos=X,this._parseStack.transition=G,this._parseStack.chunkPos=K}parse(U,Z,X){let G=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 L=this._parseStack.handlers,M=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(X===!1&&M>-1){for(;M>=0&&($=L[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&&($=L[M](),$!==!0);M--)if($ instanceof Promise)return this._parseStack.handlerPos=M,$}this._parseStack.handlers=[];break;case 6:if(G=U[this._parseStack.chunkPos],$=this._dcsParser.unhook(G!==24&&G!==26,X),$)return $;G===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(G=U[this._parseStack.chunkPos],$=this._oscParser.end(G!==24&&G!==26,X),$)return $;G===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 L=F;L<Z;++L){switch(G=U[L],K=this._transitions.table[this.currentState<<8|(G<160?G:FU)],K>>4){case 2:for(let q=L+1;;++q){if(q>=Z||(G=U[q])<32||G>126&&G<FU){this._printHandler(U,L,q),L=q-1;break}if(++q>=Z||(G=U[q])<32||G>126&&G<FU){this._printHandler(U,L,q),L=q-1;break}if(++q>=Z||(G=U[q])<32||G>126&&G<FU){this._printHandler(U,L,q),L=q-1;break}if(++q>=Z||(G=U[q])<32||G>126&&G<FU){this._printHandler(U,L,q),L=q-1;break}}break;case 3:this._executeHandlers[G]?this._executeHandlers[G]():this._executeHandlerFb(G),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:L,code:G,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let M=this._csiHandlers[this._collect<<8|G],D=M?M.length-1:-1;for(;D>=0&&($=M[D](this._params),$!==!0);D--)if($ instanceof Promise)return this._preserveStack(3,M,D,K,L),$;D<0&&this._csiHandlerFb(this._collect<<8|G,this._params),this.precedingJoinState=0;break;case 8:do switch(G){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(G-48)}while(++L<Z&&(G=U[L])>47&&G<60);L--;break;case 9:this._collect<<=8,this._collect|=G;break;case 10:let T=this._escHandlers[this._collect<<8|G],A=T?T.length-1:-1;for(;A>=0&&($=T[A](),$!==!0);A--)if($ instanceof Promise)return this._preserveStack(4,T,A,K,L),$;A<0&&this._escHandlerFb(this._collect<<8|G),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|G,this._params);break;case 13:for(let q=L+1;;++q)if(q>=Z||(G=U[q])===24||G===26||G===27||G>127&&G<FU){this._dcsParser.put(U,L,q),L=q-1;break}break;case 14:if($=this._dcsParser.unhook(G!==24&&G!==26),$)return this._preserveStack(6,[],0,K,L),$;G===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 q=L+1;;q++)if(q>=Z||(G=U[q])<32||G>127&&G<FU){this._oscParser.put(U,L,q),L=q-1;break}break;case 6:if($=this._oscParser.end(G!==24&&G!==26),$)return this._preserveStack(5,[],0,K,L),$;G===27&&(K|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=K&15}}},T8=/^([\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})$/,R8=/^[\da-f]+$/;function n$(U){if(!U)return;let Z=U.toLowerCase();if(Z.indexOf("rgb:")===0){Z=Z.slice(4);let X=T8.exec(Z);if(X){let G=X[1]?15:X[4]?255:X[7]?4095:65535;return[Math.round(parseInt(X[1]||X[4]||X[7]||X[10],16)/G*255),Math.round(parseInt(X[2]||X[5]||X[8]||X[11],16)/G*255),Math.round(parseInt(X[3]||X[6]||X[9]||X[12],16)/G*255)]}}else if(Z.indexOf("#")===0&&(Z=Z.slice(1),R8.exec(Z)&&[3,6,9,12].includes(Z.length))){let X=Z.length/3,G=[0,0,0];for(let K=0;K<3;++K){let F=parseInt(Z.slice(X*K,X*K+X),16);G[K]=X===1?F<<4:X===2?F:X===3?F>>4:F>>8}return G}}function kJ(U,Z){let X=U.toString(16),G=X.length<2?"0"+X:X;switch(Z){case 4:return X[0];case 8:return G;case 12:return(G+G).slice(0,3);default:return G+G}}function S8(U,Z=16){let[X,G,K]=U;return`rgb:${kJ(X,Z)}/${kJ(G,Z)}/${kJ(K,Z)}`}var E8={"(":0,")":1,"*":2,"+":3,"-":1,".":2},dU=131072,m$=10;function s$(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 r$=5000,a$=0,P8=class extends d0{constructor(U,Z,X,G,K,F,$,L,M=new q8){super();this._bufferService=U,this._charsetService=Z,this._coreService=X,this._logService=G,this._optionsService=K,this._oscLinkService=F,this._coreMouseService=$,this._unicodeService=L,this._parser=M,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new DO,this._utf8Decoder=new zO,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 XG(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate((D)=>this._activeBuffer=D.activeBuffer)),this._parser.setCsiHandlerFallback((D,T)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(D),params:T.toArray()})}),this._parser.setEscHandlerFallback((D)=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(D)})}),this._parser.setExecuteHandlerFallback((D)=>{this._logService.debug("Unknown EXECUTE code: ",{code:D})}),this._parser.setOscHandlerFallback((D,T,A)=>{this._logService.debug("Unknown OSC code: ",{identifier:D,action:T,data:A})}),this._parser.setDcsHandlerFallback((D,T,A)=>{T==="HOOK"&&(A=A.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(D),action:T,payload:A})}),this._parser.setPrintHandler((D,T,A)=>this.print(D,T,A)),this._parser.registerCsiHandler({final:"@"},(D)=>this.insertChars(D)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(D)=>this.scrollLeft(D)),this._parser.registerCsiHandler({final:"A"},(D)=>this.cursorUp(D)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(D)=>this.scrollRight(D)),this._parser.registerCsiHandler({final:"B"},(D)=>this.cursorDown(D)),this._parser.registerCsiHandler({final:"C"},(D)=>this.cursorForward(D)),this._parser.registerCsiHandler({final:"D"},(D)=>this.cursorBackward(D)),this._parser.registerCsiHandler({final:"E"},(D)=>this.cursorNextLine(D)),this._parser.registerCsiHandler({final:"F"},(D)=>this.cursorPrecedingLine(D)),this._parser.registerCsiHandler({final:"G"},(D)=>this.cursorCharAbsolute(D)),this._parser.registerCsiHandler({final:"H"},(D)=>this.cursorPosition(D)),this._parser.registerCsiHandler({final:"I"},(D)=>this.cursorForwardTab(D)),this._parser.registerCsiHandler({final:"J"},(D)=>this.eraseInDisplay(D,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},(D)=>this.eraseInDisplay(D,!0)),this._parser.registerCsiHandler({final:"K"},(D)=>this.eraseInLine(D,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},(D)=>this.eraseInLine(D,!0)),this._parser.registerCsiHandler({final:"L"},(D)=>this.insertLines(D)),this._parser.registerCsiHandler({final:"M"},(D)=>this.deleteLines(D)),this._parser.registerCsiHandler({final:"P"},(D)=>this.deleteChars(D)),this._parser.registerCsiHandler({final:"S"},(D)=>this.scrollUp(D)),this._parser.registerCsiHandler({final:"T"},(D)=>this.scrollDown(D)),this._parser.registerCsiHandler({final:"X"},(D)=>this.eraseChars(D)),this._parser.registerCsiHandler({final:"Z"},(D)=>this.cursorBackwardTab(D)),this._parser.registerCsiHandler({final:"`"},(D)=>this.charPosAbsolute(D)),this._parser.registerCsiHandler({final:"a"},(D)=>this.hPositionRelative(D)),this._parser.registerCsiHandler({final:"b"},(D)=>this.repeatPrecedingCharacter(D)),this._parser.registerCsiHandler({final:"c"},(D)=>this.sendDeviceAttributesPrimary(D)),this._parser.registerCsiHandler({prefix:">",final:"c"},(D)=>this.sendDeviceAttributesSecondary(D)),this._parser.registerCsiHandler({final:"d"},(D)=>this.linePosAbsolute(D)),this._parser.registerCsiHandler({final:"e"},(D)=>this.vPositionRelative(D)),this._parser.registerCsiHandler({final:"f"},(D)=>this.hVPosition(D)),this._parser.registerCsiHandler({final:"g"},(D)=>this.tabClear(D)),this._parser.registerCsiHandler({final:"h"},(D)=>this.setMode(D)),this._parser.registerCsiHandler({prefix:"?",final:"h"},(D)=>this.setModePrivate(D)),this._parser.registerCsiHandler({final:"l"},(D)=>this.resetMode(D)),this._parser.registerCsiHandler({prefix:"?",final:"l"},(D)=>this.resetModePrivate(D)),this._parser.registerCsiHandler({final:"m"},(D)=>this.charAttributes(D)),this._parser.registerCsiHandler({final:"n"},(D)=>this.deviceStatus(D)),this._parser.registerCsiHandler({prefix:"?",final:"n"},(D)=>this.deviceStatusPrivate(D)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(D)=>this.softReset(D)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(D)=>this.setCursorStyle(D)),this._parser.registerCsiHandler({final:"r"},(D)=>this.setScrollRegion(D)),this._parser.registerCsiHandler({final:"s"},(D)=>this.saveCursor(D)),this._parser.registerCsiHandler({final:"t"},(D)=>this.windowOptions(D)),this._parser.registerCsiHandler({final:"u"},(D)=>this.restoreCursor(D)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(D)=>this.insertColumns(D)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(D)=>this.deleteColumns(D)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(D)=>this.selectProtected(D)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(D)=>this.requestMode(D,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(D)=>this.requestMode(D,!1)),this._parser.setExecuteHandler(z0.BEL,()=>this.bell()),this._parser.setExecuteHandler(z0.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(z0.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(z0.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(z0.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(z0.BS,()=>this.backspace()),this._parser.setExecuteHandler(z0.HT,()=>this.tab()),this._parser.setExecuteHandler(z0.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(z0.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(mX.IND,()=>this.index()),this._parser.setExecuteHandler(mX.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(mX.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new QU((D)=>(this.setTitle(D),this.setIconName(D),!0))),this._parser.registerOscHandler(1,new QU((D)=>this.setIconName(D))),this._parser.registerOscHandler(2,new QU((D)=>this.setTitle(D))),this._parser.registerOscHandler(4,new QU((D)=>this.setOrReportIndexedColor(D))),this._parser.registerOscHandler(8,new QU((D)=>this.setHyperlink(D))),this._parser.registerOscHandler(10,new QU((D)=>this.setOrReportFgColor(D))),this._parser.registerOscHandler(11,new QU((D)=>this.setOrReportBgColor(D))),this._parser.registerOscHandler(12,new QU((D)=>this.setOrReportCursorColor(D))),this._parser.registerOscHandler(104,new QU((D)=>this.restoreIndexedColor(D))),this._parser.registerOscHandler(110,new QU((D)=>this.restoreFgColor(D))),this._parser.registerOscHandler(111,new QU((D)=>this.restoreBgColor(D))),this._parser.registerOscHandler(112,new QU((D)=>this.restoreCursorColor(D))),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 D in v1)this._parser.registerEscHandler({intermediates:"(",final:D},()=>this.selectCharset("("+D)),this._parser.registerEscHandler({intermediates:")",final:D},()=>this.selectCharset(")"+D)),this._parser.registerEscHandler({intermediates:"*",final:D},()=>this.selectCharset("*"+D)),this._parser.registerEscHandler({intermediates:"+",final:D},()=>this.selectCharset("+"+D)),this._parser.registerEscHandler({intermediates:"-",final:D},()=>this.selectCharset("-"+D)),this._parser.registerEscHandler({intermediates:".",final:D},()=>this.selectCharset("."+D)),this._parser.registerEscHandler({intermediates:"/",final:D},()=>this.selectCharset("/"+D));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler((D)=>(this._logService.error("Parsing error: ",D),D)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new o$((D,T)=>this.requestStatusString(D,T)))}getAttrData(){return this._curAttrData}_preserveStack(U,Z,X,G){this._parseStack.paused=!0,this._parseStack.cursorStartX=U,this._parseStack.cursorStartY=Z,this._parseStack.decodedLength=X,this._parseStack.position=G}_logSlowResolvingAsync(U){this._logService.logLevel<=3&&Promise.race([U,new Promise((Z,X)=>setTimeout(()=>X("#SLOW_TIMEOUT"),r$))]).catch((Z)=>{if(Z!=="#SLOW_TIMEOUT")throw Z;console.warn(`async parser handler taking longer than ${r$} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(U,Z){let X,G=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;G=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,(D)=>String.fromCharCode(D)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof U=="string"?U.split("").map((D)=>D.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 D=F;D<U.length;D+=dU){let T=D+dU<U.length?D+dU:U.length,A=typeof U=="string"?this._stringDecoder.decode(U.substring(D,T),this._parseBuffer):this._utf8Decoder.decode(U.subarray(D,T),this._parseBuffer);if(X=this._parser.parse(this._parseBuffer,A))return this._preserveStack(G,K,A,D),this._logSlowResolvingAsync(X),X}else if(!$){let D=typeof U=="string"?this._stringDecoder.decode(U,this._parseBuffer):this._utf8Decoder.decode(U,this._parseBuffer);if(X=this._parser.parse(this._parseBuffer,D))return this._preserveStack(G,K,D,0),this._logSlowResolvingAsync(X),X}(this._activeBuffer.x!==G||this._activeBuffer.y!==K)&&this._onCursorMove.fire();let L=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(L,this._bufferService.rows-1)})}print(U,Z,X){let G,K,F=this._charsetService.charset,$=this._optionsService.rawOptions.screenReaderMode,L=this._bufferService.cols,M=this._coreService.decPrivateModes.wraparound,D=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 q=this._parser.precedingJoinState;for(let S=Z;S<X;++S){if(G=U[S],G<127&&F){let B=F[String.fromCharCode(G)];B&&(G=B.charCodeAt(0))}let E=this._unicodeService.charProperties(G,q);K=GZ.extractWidth(E);let j=GZ.extractShouldJoin(E),k=j?GZ.extractWidth(q):0;if(q=E,$&&this._onA11yChar.fire(lU(G)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+K-k>L){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<L;)B.setCellFromCodepoint(v++,0,1,T)}else if(this._activeBuffer.x=L-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,G,K);for(let v=K-k;--v>=0;)A.setCellFromCodepoint(this._activeBuffer.x++,0,0,T);continue}if(D&&(A.insertCells(this._activeBuffer.x,K-k,this._activeBuffer.getNullCell(T)),A.getWidth(L-1)===2&&A.setCellFromCodepoint(L-1,0,1,T)),A.setCellFromCodepoint(this._activeBuffer.x++,G,K,T),K>0)for(;--K;)A.setCellFromCodepoint(this._activeBuffer.x++,0,0,T)}this._parser.precedingJoinState=q,this._activeBuffer.x<L&&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)=>s$(X.params[0],this._optionsService.rawOptions.windowOptions)?Z(X):!0):this._parser.registerCsiHandler(U,Z)}registerDcsHandler(U,Z){return this._parser.registerDcsHandler(U,new o$(Z))}registerEscHandler(U,Z){return this._parser.registerEscHandler(U,Z)}registerOscHandler(U,Z){return this._parser.registerOscHandler(U,new QU(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,G=!1,K=!1){let F=this._activeBuffer.lines.get(this._activeBuffer.ybase+U);F.replaceCells(Z,X,this._activeBuffer.getNullCell(this._eraseAttrData()),K),G&&(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 G=this._activeBuffer.lines.length-this._bufferService.rows;G>0&&(this._activeBuffer.lines.trimStart(G),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-G,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-G,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,G=this._bufferService.rows-1-this._activeBuffer.scrollBottom,K=this._bufferService.rows-1+this._activeBuffer.ybase-G+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,G;for(G=this._bufferService.rows-1-this._activeBuffer.scrollBottom,G=this._bufferService.rows-1+this._activeBuffer.ybase-G;Z--;)this._activeBuffer.lines.splice(X,1),this._activeBuffer.lines.splice(G,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 G=this._activeBuffer.lines.get(this._activeBuffer.ybase+X);G.deleteCells(0,Z,this._activeBuffer.getNullCell(this._eraseAttrData())),G.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 G=this._activeBuffer.lines.get(this._activeBuffer.ybase+X);G.insertCells(0,Z,this._activeBuffer.getNullCell(this._eraseAttrData())),G.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 G=this._activeBuffer.lines.get(this._activeBuffer.ybase+X);G.insertCells(this._activeBuffer.x,Z,this._activeBuffer.getNullCell(this._eraseAttrData())),G.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 G=this._activeBuffer.lines.get(this._activeBuffer.ybase+X);G.deleteCells(this._activeBuffer.x,Z,this._activeBuffer.getNullCell(this._eraseAttrData())),G.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,G=GZ.extractWidth(Z),K=this._activeBuffer.x-G,F=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(K),$=new Uint32Array(F.length*X),L=0;for(let D=0;D<F.length;){let T=F.codePointAt(D)||0;$[L++]=T,D+=T>65535?2:1}let M=L;for(let D=1;D<X;++D)$.copyWithin(M,0,L),M+=L;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(z0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(z0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(U){return U.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(z0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(z0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(U.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(z0.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 G=this._coreService.decPrivateModes,{activeProtocol:K,activeEncoding:F}=this._coreMouseService,$=this._coreService,{buffers:L,cols:M}=this._bufferService,{active:D,alt:T}=L,A=this._optionsService.rawOptions,q=(j,k)=>($.triggerDataEvent(`${z0.ESC}[${Z?"":"?"}${j};${k}$y`),!0),S=(j)=>j?1:2,E=U.params[0];return Z?E===2?q(E,4):E===4?q(E,S($.modes.insertMode)):E===12?q(E,3):E===20?q(E,S(A.convertEol)):q(E,0):E===1?q(E,S(G.applicationCursorKeys)):E===3?q(E,A.windowOptions.setWinLines?M===80?2:M===132?1:0:0):E===6?q(E,S(G.origin)):E===7?q(E,S(G.wraparound)):E===8?q(E,3):E===9?q(E,S(K==="X10")):E===12?q(E,S(A.cursorBlink)):E===25?q(E,S(!$.isCursorHidden)):E===45?q(E,S(G.reverseWraparound)):E===66?q(E,S(G.applicationKeypad)):E===67?q(E,4):E===1000?q(E,S(K==="VT200")):E===1002?q(E,S(K==="DRAG")):E===1003?q(E,S(K==="ANY")):E===1004?q(E,S(G.sendFocus)):E===1005?q(E,4):E===1006?q(E,S(F==="SGR")):E===1015?q(E,4):E===1016?q(E,S(F==="SGR_PIXELS")):E===1048?q(E,1):E===47||E===1047||E===1049?q(E,S(D===T)):E===2004?q(E,S(G.bracketedPasteMode)):E===2026?q(E,S(G.synchronizedOutput)):q(E,0)}_updateAttrColor(U,Z,X,G,K){return Z===2?(U|=50331648,U&=-16777216,U|=IX.fromColorRGB([X,G,K])):Z===5&&(U&=-50331904,U|=33554432|X&255),U}_extractColor(U,Z,X){let G=[0,0,-1,0,0,0],K=0,F=0;do{if(G[F+K]=U.params[Z+F],U.hasSubParams(Z+F)){let $=U.getSubParams(Z+F),L=0;do G[1]===5&&(K=1),G[F+L+1+K]=$[L];while(++L<$.length&&L+F+1+K<G.length);break}if(G[1]===5&&F+K>=2||G[1]===2&&F+K>=5)break;G[1]&&(K=1)}while(++F+Z<U.length&&F+K<G.length);for(let $=2;$<G.length;++$)G[$]===-1&&(G[$]=0);switch(G[0]){case 38:X.fg=this._updateAttrColor(X.fg,G[1],G[3],G[4],G[5]);break;case 48:X.bg=this._updateAttrColor(X.bg,G[1],G[3],G[4],G[5]);break;case 58:X.extended=X.extended.clone(),X.extended.underlineColor=this._updateAttrColor(X.extended.underlineColor,G[1],G[3],G[4],G[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,G=this._curAttrData;for(let K=0;K<Z;K++)X=U.params[K],X>=30&&X<=37?(G.fg&=-50331904,G.fg|=16777216|X-30):X>=40&&X<=47?(G.bg&=-50331904,G.bg|=16777216|X-40):X>=90&&X<=97?(G.fg&=-50331904,G.fg|=16777216|X-90|8):X>=100&&X<=107?(G.bg&=-50331904,G.bg|=16777216|X-100|8):X===0?this._processSGR0(G):X===1?G.fg|=134217728:X===3?G.bg|=67108864:X===4?(G.fg|=268435456,this._processUnderline(U.hasSubParams(K)?U.getSubParams(K)[0]:1,G)):X===5?G.fg|=536870912:X===7?G.fg|=67108864:X===8?G.fg|=1073741824:X===9?G.fg|=2147483648:X===2?G.bg|=134217728:X===21?this._processUnderline(2,G):X===22?(G.fg&=-134217729,G.bg&=-134217729):X===23?G.bg&=-67108865:X===24?(G.fg&=-268435457,this._processUnderline(0,G)):X===25?G.fg&=-536870913:X===27?G.fg&=-67108865:X===28?G.fg&=-1073741825:X===29?G.fg&=2147483647:X===39?(G.fg&=-67108864,G.fg|=I1.fg&16777215):X===49?(G.bg&=-67108864,G.bg|=I1.bg&16777215):X===38||X===48||X===58?K+=this._extractColor(U,K,G):X===53?G.bg|=1073741824:X===55?G.bg&=-1073741825:X===59?(G.extended=G.extended.clone(),G.extended.underlineColor=-1,G.updateExtended()):X===100?(G.fg&=-67108864,G.fg|=I1.fg&16777215,G.bg&=-67108864,G.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(`${z0.ESC}[0n`);break;case 6:let Z=this._activeBuffer.y+1,X=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${z0.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(`${z0.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(!s$(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(`${z0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(Z===0||Z===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>m$&&this._windowTitleStack.shift()),(Z===0||Z===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>m$&&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 G=X.shift(),K=X.shift();if(/^\d+$/.exec(G)){let F=parseInt(G);if(t$(F))if(K==="?")Z.push({type:0,index:F});else{let $=n$(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(),G=U.slice(Z+1);return G?this._createHyperlink(X,G):X.trim()?!1:this._finishHyperlink()}_createHyperlink(U,Z){this._getCurrentLinkId()&&this._finishHyperlink();let X=U.split(":"),G,K=X.findIndex((F)=>F.startsWith("id="));return K!==-1&&(G=X[K].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:G,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 G=0;G<X.length&&!(Z>=this._specialColors.length);++G,++Z)if(X[G]==="?")this._onColor.fire([{type:0,index:this._specialColors[Z]}]);else{let K=n$(X[G]);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 G=0;G<X.length;++G)if(/^\d+$/.exec(X[G])){let K=parseInt(X[G]);t$(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(E8[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,G=this._activeBuffer.lines.get(X);G&&(G.fill(U),G.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(U,Z){let X=($)=>(this._coreService.triggerDataEvent(`${z0.ESC}${$}${z0.ESC}\\`),!0),G=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${G.scrollTop+1};${G.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)}},XG=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&&(a$=U,U=Z,Z=a$),U<this.start&&(this.start=U),Z>this.end&&(this.end=Z)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};XG=$1([p0(0,r1)],XG);function t$(U){return 0<=U&&U<256}var k8=50000000,i$=12,j8=50,v8=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 G=this._callbacks.shift();G&&G()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(U,Z){if(this._pendingData>k8)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 G=this._writeBuffer[this._bufferOffset],K=this._action(G,Z);if(K){let $=(L)=>performance.now()-X>=i$?setTimeout(()=>this._innerWrite(0,L)):this._innerWrite(X,L);K.catch((L)=>(queueMicrotask(()=>{throw L}),Promise.resolve(!1))).then($);return}let F=this._callbacks[this._bufferOffset];if(F&&F(),this._bufferOffset++,this._pendingData-=G.length,performance.now()-X>=i$)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>j8&&(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()}},YG=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 L=Z.addMarker(Z.ybase+Z.y),M={data:U,id:this._nextId++,lines:[L]};return L.onDispose(()=>this._removeMarkerFromLink(M,L)),this._dataByLinkId.set(M.id,M),M.id}let X=U,G=this._getEntryIdKey(X),K=this._entriesWithId.get(G);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((G)=>G.line!==Z)){let G=this._bufferService.buffer.addMarker(Z);X.lines.push(G),G.onDispose(()=>this._removeMarkerFromLink(X,G))}}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)))}};YG=$1([p0(0,r1)],YG);var e$=!1,_8=class extends d0{constructor(U){super();this._windowsWrappingHeuristics=this._register(new SZ),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 eC,this.optionsService=this._register(new W8(U)),this._instantiationService.setService(a1,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(eJ)),this._instantiationService.setService(r1,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(iJ)),this._instantiationService.setService(KK,this._logService),this.coreService=this._register(this._instantiationService.createInstance(UG)),this._instantiationService.setService(KZ,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(ZG)),this._instantiationService.setService($K,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(GZ)),this._instantiationService.setService(TO,this.unicodeService),this._charsetService=this._instantiationService.createInstance(C8),this._instantiationService.setService(qO,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(YG),this._instantiationService.setService(WK,this._oscLinkService),this._inputHandler=this._register(new P8(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 v8((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&&!e$&&(this._logService.warn("writeSync is unreliable and will be removed soon."),e$=!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,hK),Z=Math.max(Z,uK),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(l$.bind(null,this._bufferService))),U.push(this.registerCsiHandler({final:"H"},()=>(l$(this._bufferService),!1))),this._windowsWrappingHeuristics.value=U1(()=>{for(let Z of U)Z.dispose()})}}},B8={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 x8(U,Z,X,G){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=z0.ESC+"OA":K.key=z0.ESC+"[A":U.key==="UIKeyInputLeftArrow"?Z?K.key=z0.ESC+"OD":K.key=z0.ESC+"[D":U.key==="UIKeyInputRightArrow"?Z?K.key=z0.ESC+"OC":K.key=z0.ESC+"[C":U.key==="UIKeyInputDownArrow"&&(Z?K.key=z0.ESC+"OB":K.key=z0.ESC+"[B");break;case 8:K.key=U.ctrlKey?"\b":z0.DEL,U.altKey&&(K.key=z0.ESC+K.key);break;case 9:if(U.shiftKey){K.key=z0.ESC+"[Z";break}K.key=z0.HT,K.cancel=!0;break;case 13:K.key=U.altKey?z0.ESC+z0.CR:z0.CR,K.cancel=!0;break;case 27:K.key=z0.ESC,U.altKey&&(K.key=z0.ESC+z0.ESC),K.cancel=!0;break;case 37:if(U.metaKey)break;F?K.key=z0.ESC+"[1;"+(F+1)+"D":Z?K.key=z0.ESC+"OD":K.key=z0.ESC+"[D";break;case 39:if(U.metaKey)break;F?K.key=z0.ESC+"[1;"+(F+1)+"C":Z?K.key=z0.ESC+"OC":K.key=z0.ESC+"[C";break;case 38:if(U.metaKey)break;F?K.key=z0.ESC+"[1;"+(F+1)+"A":Z?K.key=z0.ESC+"OA":K.key=z0.ESC+"[A";break;case 40:if(U.metaKey)break;F?K.key=z0.ESC+"[1;"+(F+1)+"B":Z?K.key=z0.ESC+"OB":K.key=z0.ESC+"[B";break;case 45:!U.shiftKey&&!U.ctrlKey&&(K.key=z0.ESC+"[2~");break;case 46:F?K.key=z0.ESC+"[3;"+(F+1)+"~":K.key=z0.ESC+"[3~";break;case 36:F?K.key=z0.ESC+"[1;"+(F+1)+"H":Z?K.key=z0.ESC+"OH":K.key=z0.ESC+"[H";break;case 35:F?K.key=z0.ESC+"[1;"+(F+1)+"F":Z?K.key=z0.ESC+"OF":K.key=z0.ESC+"[F";break;case 33:U.shiftKey?K.type=2:U.ctrlKey?K.key=z0.ESC+"[5;"+(F+1)+"~":K.key=z0.ESC+"[5~";break;case 34:U.shiftKey?K.type=3:U.ctrlKey?K.key=z0.ESC+"[6;"+(F+1)+"~":K.key=z0.ESC+"[6~";break;case 112:F?K.key=z0.ESC+"[1;"+(F+1)+"P":K.key=z0.ESC+"OP";break;case 113:F?K.key=z0.ESC+"[1;"+(F+1)+"Q":K.key=z0.ESC+"OQ";break;case 114:F?K.key=z0.ESC+"[1;"+(F+1)+"R":K.key=z0.ESC+"OR";break;case 115:F?K.key=z0.ESC+"[1;"+(F+1)+"S":K.key=z0.ESC+"OS";break;case 116:F?K.key=z0.ESC+"[15;"+(F+1)+"~":K.key=z0.ESC+"[15~";break;case 117:F?K.key=z0.ESC+"[17;"+(F+1)+"~":K.key=z0.ESC+"[17~";break;case 118:F?K.key=z0.ESC+"[18;"+(F+1)+"~":K.key=z0.ESC+"[18~";break;case 119:F?K.key=z0.ESC+"[19;"+(F+1)+"~":K.key=z0.ESC+"[19~";break;case 120:F?K.key=z0.ESC+"[20;"+(F+1)+"~":K.key=z0.ESC+"[20~";break;case 121:F?K.key=z0.ESC+"[21;"+(F+1)+"~":K.key=z0.ESC+"[21~";break;case 122:F?K.key=z0.ESC+"[23;"+(F+1)+"~":K.key=z0.ESC+"[23~";break;case 123:F?K.key=z0.ESC+"[24;"+(F+1)+"~":K.key=z0.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=z0.NUL:U.keyCode>=51&&U.keyCode<=55?K.key=String.fromCharCode(U.keyCode-51+27):U.keyCode===56?K.key=z0.DEL:U.keyCode===219?K.key=z0.ESC:U.keyCode===220?K.key=z0.FS:U.keyCode===221&&(K.key=z0.GS);else if((!X||G)&&U.altKey&&!U.metaKey){let $=B8[U.keyCode]?.[U.shiftKey?1:0];if($)K.key=z0.ESC+$;else if(U.keyCode>=65&&U.keyCode<=90){let L=U.ctrlKey?U.keyCode-64:U.keyCode+32,M=String.fromCharCode(L);U.shiftKey&&(M=M.toUpperCase()),K.key=z0.ESC+M}else if(U.keyCode===32)K.key=z0.ESC+(U.ctrlKey?z0.NUL:" ");else if(U.key==="Dead"&&U.code.startsWith("Key")){let L=U.code.slice(3,4);U.shiftKey||(L=L.toLowerCase()),K.key=z0.ESC+L,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=z0.US),U.key==="@"&&(K.key=z0.NUL));break}return K}var W1=0,N8=class{constructor(U){this._getKey=U,this._array=[],this._insertedValues=[],this._flushInsertedTask=new XY,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new XY,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,G=Array(this._array.length+this._insertedValues.length);for(let K=0;K<G.length;K++)X>=this._array.length||this._getKey(U[Z])<=this._getKey(this._array[X])?(G[K]=U[Z],Z++):G[K]=this._array[X++];this._array=G,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),G=0;for(let K=0;K<this._array.length;K++)U[Z]===K?Z++:X[G++]=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 G=Z+X>>1,K=this._getKey(this._array[G]);if(K>U)X=G-1;else if(K<U)Z=G+1;else{for(;G>0&&this._getKey(this._array[G-1])===U;)G--;return G}}return Z}},jJ=0,UK=0,g8=class extends d0{constructor(){super();this._decorations=new N8((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 f8(U);if(Z){let X=Z.marker.onDispose(()=>Z.dispose()),G=Z.onDispose(()=>{G.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 G=0,K=0;for(let F of this._decorations.getKeyIterator(Z))G=F.options.x??0,K=G+(F.options.width??1),U>=G&&U<K&&(!X||(F.options.layer??"bottom")===X)&&(yield F)}forEachDecorationAtCell(U,Z,X,G){this._decorations.forEachByKey(Z,(K)=>{jJ=K.options.x??0,UK=jJ+(K.options.width??1),U>=jJ&&U<UK&&(!X||(K.options.layer??"bottom")===X)&&G(K)})}},f8=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()}},w8=1000,y8=class{constructor(U,Z=w8){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 G=performance.now();if(G-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=G,this._innerRefresh();else if(!this._additionalRefreshRequested){let K=G-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)}},ZK=20,XK=!1,YY=class extends d0{constructor(U,Z,X,G){super();this._terminal=U,this._coreBrowserService=X,this._renderService=G,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 y8(this._renderRows.bind(this))),!this._terminal.element)throw Error("Cannot enable accessibility before Terminal.open");XK?(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(`
|
|
461
|
-
`))),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(()=>{XK?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<ZK+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==U&&(this._charsToAnnounce+=U):this._charsToAnnounce+=U,U===`
|
|
462
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===ZK+1&&(this._liveRegion.textContent+=_J.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,G=X.lines.length.toString();for(let K=U;K<=Z;K++){let F=X.lines.get(X.ydisp+K),$=[],L=F?.translateToString(!0,void 0,void 0,$)||"",M=(X.ydisp+K+1).toString(),D=this._rowElements[K];D&&(L.length===0?(D.textContent=" ",this._rowColumns.set(D,[0,1])):(D.textContent=L,this._rowColumns.set(D,$)),D.setAttribute("aria-posinset",M),D.setAttribute("aria-setsize",G),this._alignRowWidth(D))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(U,Z){let X=U.target,G=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!==G)return;let $,L;if(Z===0?($=X,L=this._rowElements.pop(),this._rowContainer.removeChild(L)):($=this._rowElements.shift(),L=X,this._rowContainer.removeChild($)),$.removeEventListener("focus",this._topBoundaryFocusListener),L.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 G=this._rowElements.slice(-1)[0];if(X.node.compareDocumentPosition(G)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(X={node:G,offset:G.textContent?.length??0}),!this._rowContainer.contains(X.node))return;let K=({node:L,offset:M})=>{let D=L instanceof Text?L.parentNode:L,T=parseInt(D?.getAttribute("aria-posinset"),10)-1;if(isNaN(T))return console.warn("row is invalid. Race condition?"),null;let A=this._rowColumns.get(D);if(!A)return console.warn("columns is null. Race condition?"),null;let q=M<A.length?A[M]:A.slice(-1)[0]+1;return q>=this._terminal.cols&&(++T,q=0),{row:T,column:q}},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 G=X*this._renderService.dimensions.css.cell.width;U.style.transform=`scaleX(${G/Z})`}};YY=$1([p0(1,GG),p0(2,NU),p0(3,gU)],YY);var JG=class extends d0{constructor(U,Z,X,G,K){super();this._element=U,this._mouseService=Z,this._renderService=X,this._bufferService=G,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 G=0;G<X.length;G++){let K=X[G];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((G)=>{G?.forEach((K)=>{K.link.dispose&&K.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=U.y);let X=!1;for(let[G,K]of this._linkProviderService.linkProviders.entries())Z?this._activeProviderReplies?.get(G)&&(X=this._checkLinkProviderResult(G,U,X)):K.provideLinks(U.y,(F)=>{if(this._isMouseOut)return;let $=F?.map((L)=>({link:L}));this._activeProviderReplies?.set(G,$),X=this._checkLinkProviderResult(G,U,X),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(U.y,this._activeProviderReplies)})}_removeIntersectingLinks(U,Z){let X=new Set;for(let G=0;G<Z.size;G++){let K=Z.get(G);if(K)for(let F=0;F<K.length;F++){let $=K[F],L=$.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 D=L;D<=M;D++){if(X.has(D)){K.splice(F--,1);break}X.add(D)}}}}_checkLinkProviderResult(U,Z,X){if(!this._activeProviderReplies)return X;let G=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&&G){let F=G.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((L)=>this._linkAtPosition(L.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&&p8(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 G=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>=G&&this._currentLink.link.range.end.y<=K&&(this._clearCurrentLink(G,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,G=this._bufferService.buffer.ydisp,K=this._createLinkUnderlineEvent(X.start.x-1,X.start.y-G-1,X.end.x,X.end.y-G-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,G=U.range.end.y*this._bufferService.cols+U.range.end.x,K=Z.y*this._bufferService.cols+Z.x;return X<=K&&K<=G}_positionFromMouseEvent(U,Z,X){let G=X.getCoords(U,Z,this._bufferService.cols,this._bufferService.rows);if(G)return{x:G[0],y:G[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(U,Z,X,G,K){return{x1:U,y1:Z,x2:X,y2:G,cols:this._bufferService.cols,fg:K}}};JG=$1([p0(1,QG),p0(2,gU),p0(3,r1),p0(4,FK)],JG);function p8(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 c8=class extends _8{constructor(U={}){super(U);this._linkifier=this._register(new SZ),this.browser=BK,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new SZ),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(g8),this._instantiationService.setService(FX,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(kC),this._instantiationService.setService(FK,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(xJ)),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,G="";switch(Z.index){case 256:X="foreground",G="10";break;case 257:X="background",G="11";break;case 258:X="cursor",G="12";break;default:X="ansi",G="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(`${z0.ESC}]${G};${S8(K)}${vK.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(YY,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(U){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(z0.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(z0.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),G=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,L=X*this._renderService.dimensions.css.cell.width;this.textarea.style.left=L+"px",this.textarea.style.top=$+"px",this.textarea.style.width=F+"px",this.textarea.style.height=G+"px",this.textarea.style.lineHeight=G+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(u0(this.element,"copy",(Z)=>{this.hasSelection()&&CO(Z,this._selectionService)}));let U=(Z)=>AO(Z,this.textarea,this.coreService,this.optionsService);this._register(u0(this.textarea,"paste",U)),this._register(u0(this.element,"paste",U)),xK?this._register(u0(this.element,"mousedown",(Z)=>{Z.button===2&&Y$(Z,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(u0(this.element,"contextmenu",(Z)=>{Y$(Z,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),OG&&this._register(u0(this.element,"auxclick",(Z)=>{Z.button===1&&QK(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",vJ.get()),fK||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(EC,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(mJ,this._document,this._helperContainer),this._instantiationService.setService(GY,this._charSizeService),this._themeService=this._instantiationService.createInstance(tJ),this._instantiationService.setService(EZ,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(UY),this._instantiationService.setService(IK,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(rJ,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(lJ,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(sJ),this._instantiationService.setService(QG,this._mouseService);let G=this._linkifier.value=this._register(this._instantiationService.createInstance(JG,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(bJ,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(aJ,this.element,this.screenElement,G)),this._instantiationService.setService(SO,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(dJ,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(YY,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",(K)=>this._handleScreenReaderModeOptionChange(K))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(eX,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",(K)=>{!this._overviewRulerRenderer&&K&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(eX,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(nJ,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 L,M;switch(F.overrideType||F.type){case"mousemove":M=32,F.buttons===void 0?(L=3,F.button!==void 0&&(L=F.button<3?F.button:3)):L=F.buttons&1?0:F.buttons&4?1:F.buttons&2?2:3;break;case"mouseup":M=0,L=F.button<3?F.button:3;break;case"mousedown":M=1,L=F.button<3?F.button:3;break;case"wheel":if(U._customWheelEventHandler&&U._customWheelEventHandler(F)===!1)return!1;let D=F.deltaY;if(D===0||U.coreMouseService.consumeWheelEvent(F,U._renderService?.dimensions?.device?.cell?.height,U._coreBrowserService?.dpr)===0)return!1;M=D<0?0:1,L=4;break;default:return!1}return M===void 0||L===void 0||L>4?!1:U.coreMouseService.triggerMouseEvent({col:$.col,row:$.row,x:$.x,y:$.y,button:L,action:M,ctrl:F.ctrlKey,alt:F.altKey,shift:F.shiftKey})}let G={mouseup:null,wheel:null,mousedrag:null,mousemove:null},K={mouseup:(F)=>(X(F),F.buttons||(this._document.removeEventListener("mouseup",G.mouseup),G.mousedrag&&this._document.removeEventListener("mousemove",G.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?G.mousemove||(Z.addEventListener("mousemove",K.mousemove),G.mousemove=K.mousemove):(Z.removeEventListener("mousemove",G.mousemove),G.mousemove=null),F&16?G.wheel||(Z.addEventListener("wheel",K.wheel,{passive:!1}),G.wheel=K.wheel):(Z.removeEventListener("wheel",G.wheel),G.wheel=null),F&2?G.mouseup||(G.mouseup=K.mouseup):(this._document.removeEventListener("mouseup",G.mouseup),G.mouseup=null),F&4?G.mousedrag||(G.mousedrag=K.mousedrag):(this._document.removeEventListener("mousemove",G.mousedrag),G.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),G.mouseup&&this._document.addEventListener("mouseup",G.mouseup),G.mousedrag&&this._document.addEventListener("mousemove",G.mousedrag),this.cancel(F)})),this._register(u0(Z,"wheel",(F)=>{if(!G.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 $=z0.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){GK(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=x8(U,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(U),X.type===3||X.type===2){let G=this.rows-1;return this.scrollLines(X.type===2?-G:G),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===z0.ETX||X.key===z0.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)&&(h8(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(z0.ESC+"[I"):this.coreService.triggerDataEvent(z0.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(`${z0.ESC}[4;${X};${Z}t`);break;case 1:let G=this._renderService.dimensions.css.cell.width.toFixed(0),K=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${z0.ESC}[6;${K};${G}t`);break}}cancel(U,Z){if(!(!this.options.cancelEvents&&!Z))return U.preventDefault(),U.stopPropagation(),!1}};function h8(U){return U.keyCode===16||U.keyCode===17||U.keyCode===18}var u8=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)}},b8=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)}},YK=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 b8(Z)}getNullCell(){return new HU}},d8=class extends d0{constructor(U){super();this._core=U,this._onBufferChange=this._register(new w0),this.onBufferChange=this._onBufferChange.event,this._normal=new YK(this._core.buffers.normal,"normal"),this._alternate=new YK(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)}},l8=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,G)=>Z(X,G.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)}},o8=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}},n8=["cols","rows"],MU=0,dK=class extends d0{constructor(U){super(),this._core=this._register(new c8(U)),this._addonManager=this._register(new u8),this._publicOptions={...this._core.options};let Z=(G)=>this._core.options[G],X=(G,K)=>{this._checkReadonlyOptions(G),this._core.options[G]=K};for(let G in this._core.options){let K={get:Z.bind(this,G),set:X.bind(this,G)};Object.defineProperty(this._publicOptions,G,K)}}_checkReadonlyOptions(U){if(n8.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 l8(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new o8(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 d8(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
|
|
463
|
-
`,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 vJ.get()},set promptLabel(U){vJ.set(U)},get tooMuchOutput(){return _J.get()},set tooMuchOutput(U){_J.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 CG=null,AG=null,WY=null,IY={"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",headerBackground:"#181825",headerTitle:"#6c7086",shadow:"0 4px 24px rgba(0, 0, 0, 0.3)"},"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",headerBackground:"#dce0e8",headerTitle:"#8c8fa1",shadow:"0 4px 24px rgba(0, 0, 0, 0.08)"}},CX="catppuccin-mocha",lK={copy:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg>',clear:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 6h18"></path><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"></path><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"></path></svg>'};function m8(U){let Z,X,G=U.dataset.themeConfig;if(G)try{Z=JSON.parse(G),X="custom"}catch($){console.warn("pyrepl-web: invalid data-theme-config JSON, falling back to default"),Z=IY[CX],X=CX}else if(X=U.dataset.theme||CX,Z=window.pyreplThemes?.[X]||IY[X]||IY[CX],!window.pyreplThemes?.[X]&&!IY[X])console.warn(`pyrepl-web: unknown theme "${X}", falling back to default`),X=CX;let K=U.dataset.packages,F=K?K.split(",").map(($)=>$.trim()).filter(Boolean):[];return{theme:Z,themeName:X,showHeader:U.dataset.header!=="false",showButtons:U.dataset.buttons!=="false",title:U.dataset.title||"python",packages:F,src:U.dataset.src||null,readonly:U.dataset.readonly==="true"}}function s8(){if(!CG)CG=FJ({indexURL:"https://cdn.jsdelivr.net/pyodide/v0.29.1/full/",stdout:(U)=>{if(WY)WY.write(U+`\r
|
|
464
|
-
`)},stderr:(U)=>{if(WY)WY.write(U+`\r
|
|
465
|
-
`)}});return CG}function r8(){if(!AG)AG=Promise.resolve(MG);return AG}function a8(){if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",oK);else oK()}function t8(){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=`
|
|
466
|
-
.pyrepl {
|
|
467
|
-
display: inline-block;
|
|
468
|
-
border-radius: 8px;
|
|
469
|
-
overflow: hidden;
|
|
470
|
-
box-shadow: var(--pyrepl-shadow);
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
.pyrepl-header {
|
|
474
|
-
background: var(--pyrepl-header-bg);
|
|
475
|
-
padding: 8px 12px;
|
|
476
|
-
display: flex;
|
|
477
|
-
align-items: center;
|
|
478
|
-
gap: 8px;
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
.pyrepl-header-dots {
|
|
482
|
-
display: flex;
|
|
483
|
-
gap: 6px;
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
.pyrepl-header-dot {
|
|
487
|
-
width: 12px;
|
|
488
|
-
height: 12px;
|
|
489
|
-
border-radius: 50%;
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
.pyrepl-header-dot.red { background: var(--pyrepl-red); }
|
|
493
|
-
.pyrepl-header-dot.yellow { background: var(--pyrepl-yellow); }
|
|
494
|
-
.pyrepl-header-dot.green { background: var(--pyrepl-green); }
|
|
495
|
-
|
|
496
|
-
.pyrepl-header-title {
|
|
497
|
-
flex: 1;
|
|
498
|
-
text-align: center;
|
|
499
|
-
color: var(--pyrepl-header-title);
|
|
500
|
-
font-family: monospace;
|
|
501
|
-
font-size: 13px;
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
.pyrepl-header-buttons {
|
|
505
|
-
display: flex;
|
|
506
|
-
gap: 4px;
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
.pyrepl-header-btn {
|
|
510
|
-
background: transparent;
|
|
511
|
-
border: none;
|
|
512
|
-
color: var(--pyrepl-header-title);
|
|
513
|
-
cursor: pointer;
|
|
514
|
-
padding: 4px;
|
|
515
|
-
border-radius: 4px;
|
|
516
|
-
display: flex;
|
|
517
|
-
align-items: center;
|
|
518
|
-
justify-content: center;
|
|
519
|
-
opacity: 0.7;
|
|
520
|
-
transition: opacity 0.15s;
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
.pyrepl-header-btn:hover {
|
|
524
|
-
opacity: 1;
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
.pyrepl-header-btn svg {
|
|
528
|
-
width: 14px;
|
|
529
|
-
height: 14px;
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
.pyrepl .xterm {
|
|
533
|
-
padding: 8px 12px 12px 12px;
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
.pyrepl .xterm-viewport::-webkit-scrollbar {
|
|
537
|
-
display: none;
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
.pyrepl .xterm-viewport {
|
|
541
|
-
scrollbar-width: none;
|
|
542
|
-
background-color: var(--pyrepl-bg) !important;
|
|
543
|
-
}
|
|
544
|
-
`,document.head.appendChild(Z)}function i8(U,Z){let X=Z.headerBackground||Z.black,G=Z.headerTitle||Z.brightBlack,K=Z.shadow||"0 4px 24px rgba(0, 0, 0, 0.3)";U.style.setProperty("--pyrepl-bg",Z.background),U.style.setProperty("--pyrepl-header-bg",X),U.style.setProperty("--pyrepl-header-title",G),U.style.setProperty("--pyrepl-red",Z.red),U.style.setProperty("--pyrepl-yellow",Z.yellow),U.style.setProperty("--pyrepl-green",Z.green),U.style.setProperty("--pyrepl-shadow",K)}function e8(U){let Z=document.createElement("div");return Z.className="pyrepl-header",Z.innerHTML=`
|
|
545
|
-
<div class="pyrepl-header-dots">
|
|
546
|
-
<div class="pyrepl-header-dot red"></div>
|
|
547
|
-
<div class="pyrepl-header-dot yellow"></div>
|
|
548
|
-
<div class="pyrepl-header-dot green"></div>
|
|
549
|
-
</div>
|
|
550
|
-
<div class="pyrepl-header-title">${U.title}</div>
|
|
551
|
-
${U.showButtons?`
|
|
552
|
-
<div class="pyrepl-header-buttons">
|
|
553
|
-
<button class="pyrepl-header-btn" data-action="copy" title="Copy output">${lK.copy}</button>
|
|
554
|
-
<button class="pyrepl-header-btn" data-action="clear" title="Clear terminal">${lK.clear}</button>
|
|
555
|
-
</div>
|
|
556
|
-
`:'<div style="width: 48px"></div>'}
|
|
557
|
-
`,Z}function UA(U){t8();let Z=m8(U);if(i8(U,Z.theme),Z.showHeader)U.appendChild(e8(Z));let X=document.createElement("div");U.appendChild(X);let G=new dK({cursorBlink:!Z.readonly,cursorStyle:Z.readonly?"bar":"block",fontSize:14,fontFamily:"monospace",theme:Z.theme,disableStdin:Z.readonly});return G.open(X),{term:G,config:Z}}async function ZA(U,Z,X){let G=await s8();if(await G.loadPackage("micropip"),X.packages.length>0)await G.pyimport("micropip").install(X.packages);let F=`Python 3.13${X.packages.length>0?` (installed packages: ${X.packages.join(", ")})`:""}`;if(Z.write(`\x1B[90m${F}\x1B[0m\r
|
|
558
|
-
`),globalThis.term=Z,globalThis.pyreplTheme=X.themeName,globalThis.pyreplInfo=F,globalThis.pyreplReadonly=X.readonly,X.src)try{let M=await fetch(X.src);if(M.ok)globalThis.pyreplStartupScript=await M.text();else console.warn(`pyrepl-web: failed to fetch script from ${X.src}`)}catch(M){console.warn(`pyrepl-web: error fetching script from ${X.src}`,M)}let $=await r8();G.runPython($),G.runPythonAsync("await start_repl()");while(!globalThis.currentBrowserConsole)await new Promise((M)=>setTimeout(M,10));let L=globalThis.currentBrowserConsole;if(globalThis.currentBrowserConsole=null,!X.readonly)Z.onData((M)=>{for(let D of M)L.push_char(D.charCodeAt(0))});if(X.showHeader&&X.showButtons){let M=U.querySelector('[data-action="copy"]'),D=U.querySelector('[data-action="clear"]');M?.addEventListener("click",()=>{let T=Z.buffer.active,A="";for(let q=0;q<T.length;q++){let S=T.getLine(q);if(S)A+=S.translateToString(!0)+`
|
|
559
|
-
`}navigator.clipboard.writeText(A.trimEnd())}),D?.addEventListener("click",()=>{Z.reset(),Z.write(`\x1B[90m${F}\x1B[0m\r
|
|
560
|
-
`),Z.write("\x1B[32m>>> \x1B[0m")})}}async function oK(){let U=document.querySelectorAll(".pyrepl");if(U.length===0){console.warn("pyrepl-web: no .pyrepl elements found");return}let Z=Array.from(U).map((X)=>({container:X,...UA(X)}));for(let{container:X,term:G,config:K}of Z)await ZA(X,G,K)}a8();
|
|
1
|
+
(()=>{(()=>{let f=document.currentScript,g=f?f.src:null;if(g){let b=document.createElement("link");b.rel="preload",b.as="fetch",b.href="https://cdn.jsdelivr.net/pyodide/v0.29.2/full/pyodide.asm.wasm",b.crossOrigin="anonymous",document.head.appendChild(b),import(g.replace("pyrepl.js","pyrepl.esm.js")).catch((j)=>{console.error("pyrepl-web: Failed to load module:",j)})}else console.error("pyrepl-web: Could not determine script URL")})();})();
|